-
Notifications
You must be signed in to change notification settings - Fork 0
/
gbbopen.asd
171 lines (132 loc) · 6.03 KB
/
gbbopen.asd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
;;;; -*- Mode:Common-Lisp; Package:COMMON-LISP-USER; Syntax:common-lisp -*-
;;;; *-* File: /usr/local/gbbopen/gbbopen.asd *-*
;;;; *-* Edited-By: cork *-*
;;;; *-* Last-Edit: Sun Mar 10 22:28:01 2013 *-*
;;;; *-* Machine: phoenix.corkills.org *-*
;;;; **************************************************************************
;;;; **************************************************************************
;;;; *
;;;; * GBBopen ASDF Interface
;;;; *
;;;; **************************************************************************
;;;; **************************************************************************
;;;
;;; Written by: Dan Corkill
;;;
;;; Copyright (C) 2005-2013, Dan Corkill <corkill@GBBopen.org>
;;; Part of the GBBopen Project.
;;; Licensed under Apache License 2.0 (see LICENSE for license information).
;;;
;;; Interfaces GBBopen's Module Manager facility, a lightweight and easy to use
;;; mechanism for maintaining (compiling and loading) modules, with ASDF.
;;;
;;; After ASDF loading, via (asdf:operate 'asdf:load-op :gbbbopen) or
;;; (require :gbbopen), GBBopen REPL commands, such as :gbbopen-user,
;;; :gbbopen-test, :agenda-shell-test, :tutorial-example, ... and their
;;; COMMON-LISP-USER functional equivalents, are available.
;;;
;;; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;;;
;;; 12-12-05 File created. (Corkill)
;;;
;;; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
(in-package :common-lisp-user)
(require :asdf)
;;; ---------------------------------------------------------------------------
(let ((truename *load-truename*))
(load (make-pathname
:name "initiate"
:type "lisp"
:defaults truename))
(defparameter *gbbopen-version*
(with-open-file (version-file
(make-pathname :name "VERSION"
:type nil
:defaults truename))
(read version-file))))
;;; ===========================================================================
;;; Compile/load GBBopen's Module Manager
(module-manager-user :propagate :create-dirs)
(in-package :module-manager)
;;; ===========================================================================
;;; Utilities
(defun do-mm-component (mm-component &rest options)
(declare (dynamic-extent options))
(apply 'compile-module
;; Support cross-case mode CLs:
(read-from-string (format nil ":~a" (asdf:component-name mm-component)))
:propagate
options))
;;; ---------------------------------------------------------------------------
(defun mm-component-done-p (mm-component)
(module-loaded-p
;; Support cross-case mode CLs:
(read-from-string (format nil ":~a" (asdf:component-name mm-component)))))
;;; ---------------------------------------------------------------------------
(defun mm-component-defsystem (module-name documentation
&optional no-components-p)
(eval `(asdf:defsystem ,module-name
:description
,(or documentation
(if (eq ':gbbopen module-name)
"The GBBopen blackboard-system framework"
(format nil
"GBBopen ~s module; part of the GBBopen blackboard-system framework"
module-name)))
:author "The GBBopen Project <gbbopen@GBBopen.org>"
:maintainer "Dan Corkill <corkill@GBBopen.org>"
:version ,common-lisp-user::*gbbopen-version*
:licence "Licensed under Apache License 2.0 (see LICENSE for license information)."
,@(unless no-components-p
`(:components ((:mm-component ,module-name)))))))
;;; ---------------------------------------------------------------------------
(defun mm-component-undefsystem (module-name)
(asdf:clear-system module-name))
;;; ===========================================================================
;;; Module-Manager ASDF component
(defclass mm-component (asdf:component)
())
(defmethod asdf:component-pathname ((component mm-component))
nil)
(defmethod asdf:operation-done-p ((op asdf:compile-op)
(component mm-component))
(mm-component-done-p component))
(defmethod asdf:operation-done-p ((op asdf:load-op)
(component mm-component))
(mm-component-done-p component))
(defmethod asdf:operation-done-p ((op asdf:load-source-op)
(component mm-component))
(mm-component-done-p component))
(defmethod asdf:perform ((op asdf:compile-op) (component mm-component))
(do-mm-component component))
(defmethod asdf:perform ((op asdf:load-op) (component mm-component))
(do-mm-component component))
(defmethod asdf:perform ((op asdf:load-source-op) (component mm-component))
(do-mm-component component :source))
;;; ===========================================================================
;;; Generate an asdf:defsystem for each defined module
(format t "~&;; Defining an ASDF defsystem for each Module Manager module...~%")
(dolist (module-name (list-modules 't))
(mm-component-defsystem module-name nil))
;;; ---------------------------------------------------------------------------
;;; We have trivially completed all of the :gbbopen system operations by
;;; loading this file:
#|
(defclass gbbopen (asdf:component)
())
(defmethod asdf:component-pathname ((component gbbopen))
nil)
(defmethod asdf:operation-done-p ((op asdf:compile-op) (component gbbopen))
t)
(defmethod asdf:operation-done-p ((op asdf:load-op) (component gbbopen))
t)
(defmethod asdf:operation-done-p ((op asdf:load-source-op) (component gbbopen))
t)
(defmethod asdf:perform ((op asdf:compile-op) (component gbbopen)))
(defmethod asdf:perform ((op asdf:load-op) (component gbbopen)))
(defmethod asdf:perform ((op asdf:load-source-op) (component gbbopen)))
|#
(mm-component-defsystem :gbbopen nil 't)
;;; ===========================================================================
;;; End of File
;;; ===========================================================================