1 (in-package :parenscript.asdf
)
3 (defvar *parenscript-file-extension
* "paren")
5 ;;; ASDF manual: http://constantly.at/lisp/asdf/index.html
7 ;;; a parenscript file is a source file:
8 ;;; A source file is any file that the system does not know how to generate
9 ;;; from other components of the system.
10 (defclass asdf
::parenscript-file
(asdf:source-file
)
13 (defclass asdf
::parenscript-compile-op
(asdf:operation
)
14 ((output-spec :initarg
:output-spec
:initform
:javascript
:accessor output-spec
)
15 (comp-env :initarg
:comp-env
:initform nil
:accessor comp-env
)
16 (pretty-print-p :initarg
:pretty-print
:initform nil
:accessor pretty-print-p
)
17 (output-stream :initarg
:output-stream
:initform
*standard-output
* :accessor output-stream
)
18 (force-p :initarg
:force-p
:initform nil
:accessor force-p
19 :documentation
"T to force compilation."))
20 (:documentation
"The operation used in conjunction with parenscript:compile-script-system."))
22 ;;;; STANDARD LISP COMPILATION
24 ;;; file extension for parenscript files is ".paren"
25 ;;; e.g. (defmethod source-file-type ((c cl-source-file) (s module)) "lisp")
26 (defmethod asdf:source-file-type
((c asdf
::parenscript-file
) (s asdf
:module
))
27 (declare (ignore c
) (ignore s
))
28 *parenscript-file-extension
*)
30 ;;; when you compile the system, compile the Parenscript files in it.
31 (defmethod asdf:perform
((op compile-op
) (paren-file asdf
::parenscript-file
))
32 ; (parenscript:compile-parenscript-file (component-pathname paren-file)))
35 ;;; when you load the system, do nothing with the parenscript files. This could
36 ;;; be enhanced so that files are automatically installed into the appropriate web
37 ;;; framework, etc. for now we do nothing.
38 (defmethod asdf:perform
((op load-op
) (paren-file asdf
::parenscript-file
))
41 ;;;; OUR CUSTOM PARENSCRIPT COMPILATION
43 (defmethod output-files ((op asdf
::parenscript-compile-op
) general-component
)
46 (defmethod perform ((op asdf
::parenscript-compile-op
) general-component
)
47 ; (format t "General component: ~A~%" general-component)
50 (defmethod perform ((op asdf
::parenscript-compile-op
) (file asdf
:source-file
))
51 ; (format t "Source file ignored: ~A~%" file)
54 (defmethod perform ((op asdf
::parenscript-compile-op
) (file asdf
::parenscript-file
))
55 (compile-script-file (component-pathname file
)
56 :comp-env
(comp-env op
)
57 :output-spec
(output-spec op
)
58 :pretty-print
(pretty-print-p op
)
59 :output-stream
(output-stream op
))
60 (write-char #\Newline
(output-stream op
)))
62 (defmethod operation-done-p ((op asdf
::parenscript-compile-op
) general-component
)
66 (defmethod operation-done-p ((op asdf
::parenscript-compile-op
) (file asdf
::parenscript-file
))
67 (and (not (force-p op
))
71 ;;; FIXME: we simply copy load-op's dependencies. this is Just Not Right.
72 (defmethod asdf:component-depends-on
((op asdf
::parenscript-compile-op
) (c component
))
73 (let ((what-would-load-op-do (cdr (assoc 'load-op
74 (slot-value c
'asdf
::in-order-to
)))))
76 (if (eq (car dep
) 'load-op
)
77 (cons 'asdf
::parenscript-compile-op
(cdr dep
))
79 what-would-load-op-do
)))