Last active
February 10, 2019 00:06
-
-
Save privet-kitty/40965688f1e78bfe102f4fdfb550ceb5 to your computer and use it in GitHub Desktop.
Private system on ASDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- mode: lisp -*- | |
(defpackage :foo.asdf | |
(:use :cl :asdf :uiop) | |
(:export #:hideable-system)) | |
(in-package :foo.asdf) | |
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(defclass hideable-system (system) | |
((private :initform nil :initarg :private :reader private-p)) | |
(:documentation "If PRIVATE is true, ASDF signals an error when one tries to OPERATE this system.")) | |
(defmethod operate :around (operation (component hideable-system) &key &allow-other-keys) | |
(if (private-p component) | |
(error "Private system ~S cannot be directly operated." (component-name component)) | |
(call-next-method)))) | |
(defsystem "foo" | |
:version "0.0.1" | |
:author "Hugo I." | |
:license "public domain" | |
:depends-on ("foo/private") | |
:components ((:file "main"))) | |
(defsystem "foo/private" | |
:pathname "private" | |
:class "FOO.ASDF:HIDEABLE-SYSTEM" | |
:private t | |
:components ((:file "package"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment