Skip to content

Instantly share code, notes, and snippets.

@privet-kitty
Last active February 10, 2019 00:06
Show Gist options
  • Save privet-kitty/40965688f1e78bfe102f4fdfb550ceb5 to your computer and use it in GitHub Desktop.
Save privet-kitty/40965688f1e78bfe102f4fdfb550ceb5 to your computer and use it in GitHub Desktop.
Private system on ASDF
;; -*- 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