[PATCH] ASDF load-only files

Jan UrbaƄski <[email protected]> Tue, 24 Apr 2007 23:09:29 +0200
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
Hi list,

I'm using ASDF in a university assignement and I needed the ability to 
tell ASDF to load a file without prior compilation (I'm using some 
packages that contain non-FAS-dumpable code). I skimmed through the list 
archives and found one patch proposal, followed by a discussion that I 
believe did not end in anything constructive.
So I thought I might submit my solution so I could
a) possibly help
or
b) get laughed upon by experienced Lisp hackers and maybe learn 
something from it

The patch adds a trivial functionality - you can specify a 
:dont-compile-p attribute for a component and it gets loaded without 
prior compilation. For example writing
(defsystem foo
   :components ((:file "bar") (:file "baz" :depends-on ("bar") 
:dont-compile-p t)))
and issuing
(asdf:oos 'asdf:load-op 'foo)
will make ASDF
1) compile file "foo"
2) load file "foo"
3) load file "bar"

The diff was made against the bleeding edge, but has been tested with 
the stable version also - it's a trivial modification really. I tested 
it using CLISP and CMUCL.

Anyway, here goes.

Regards,
Jan Urbanski
-- 
Jan Urbanski

ouden estin

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
cclan-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cclan-list
asdf.patch (text/plain, 1.3 KB)
diff -uNr asdf/asdf.lisp asdf-new/asdf.lisp
--- asdf/asdf.lisp	2007-03-21 23:08:33.000000000 +0100
+++ asdf-new/asdf.lisp	2007-04-24 22:43:58.000000000 +0200
@@ -202,6 +202,7 @@
    (relative-pathname :initarg :pathname)
    (operation-times :initform (make-hash-table )
 		    :accessor component-operation-times)
+   (dont-compile-p :initform nil :initarg :dont-compile-p :accessor component-dont-compile-p)
    ;; XXX we should provide some atomic interface for updating the
    ;; component properties
    (properties :accessor component-properties :initarg :properties
@@ -762,6 +763,7 @@
 ;;; its answers, in case it has been overridden for site policy
 (defmethod perform ((operation compile-op) (c cl-source-file))
   #-:broken-fasl-loader
+  (when (component-dont-compile-p c) (return-from perform))
   (let ((source-file (component-pathname c))
         (output-file (car (output-files operation c))))
     (multiple-value-bind (output warnings-p failure-p)
@@ -813,8 +815,10 @@
   nil)
 
 (defmethod component-depends-on ((operation load-op) (c component))
-  (cons (list 'compile-op (component-name c))
-        (call-next-method)))
+  (if (component-dont-compile-p c)
+      (call-next-method)
+      (cons (list 'compile-op (component-name c))
+	    (call-next-method))))
 
 ;;; load-source-op