[armedbear-devel] asdf loading from jar files

Alan Ruttenberg alanruttenberg at gmail.com
Fri Jan 8 18:41:22 UTC 2010


I've believe I've written code that can load a compiled asdf system
from a jar file. Final testing is pending the patch for loading a
compiled file from a subdirectory of a jar.

In order to do that I needed to do 3 things.

1) Patch probe file so that it understands jar:file pathnames
2) Patch truename so that it understands jar:file pathnames
3) Create a new asdf op that knows to load only the compiled files.

These patches are in

http://svn.mumble.net:8080/svn/lsw/trunk/patches/jarfile.lisp

I used advise (http://svn.mumble.net:8080/svn/lsw/trunk/util/encapsulate.lisp)
to patch, probe-file, directory, and truename, but don't mind merging
the changes into source if it's deemed that they are the right thing.

I'd submit the code for advise too (adapted from MCL), but it's not
quite cleaned up yet.

The asdf op is in that file too. It's a bit hacky because I use
asdf-binary-locations[1] and I didn't see how to cleanly integrate it.
If someone knows how to drive asdf better than I do, please suggest a
better way. There's still a nit in that if you load the system a
second time it warns about file-write-date not working. I'm not sure
file write date should return for a jar:file pathname. The write date
of the containing jar?

FWIW, I think that you should consider having asdf-binary-locations be
part of the standard distribution. As ABCL is under active development
I was always running into issues with stale fasls, but no more since
I've been using it.

-Alan

[1] http://common-lisp.net/project/asdf-binary-locations/

laptop:~/ % jar tf test.jar
META-INF/
META-INF/MANIFEST.MF
bar/
bar/armedbear-0.18.0-dev-darwin-unknown/
bar/armedbear-0.18.0-dev-darwin-unknown/bar1.abcl
bar/armedbear-0.18.0-dev-darwin-unknown/bar2.abcl
bar/bar.asd

CL-USER> (advise load (if (eql 0 (search "jar:file" (namestring (car arglist))))
			  (format t ";; would have loaded ~a~%" (car arglist))
			  (:do-it))
			  :when :around :name stub)
#<FUNCTION (ENCAPSULATE::ADVISED 'LOAD) {ACB16B}>

CL-USER> (load "jar:file:/Users/alanr/repos/lsw/trunk/patches/test.jar!/bar/bar.asd")
; Loading jar:file:/Users/alanr/repos/lsw/trunk/patches/test.jar!/bar/bar.asd
...
; Loaded jar:file:/Users/alanr/repos/lsw/trunk/patches/test.jar!/bar/bar.asd
(0.0030 seconds)
T

CL-USER> (asdf::oos 'asdf::load-just-fasls-op 'bar)
;; would have loaded
jar:file:/Users/alanr/repos/lsw/trunk/patches/test.jar!/bar/armedbear-0.18.0-dev-darwin-unknown/bar1.abcl
;; would have loaded
jar:file:/Users/alanr/repos/lsw/trunk/patches/test.jar!/bar/armedbear-0.18.0-dev-darwin-unknown/bar2.abcl

CL-USER> (asdf::oos 'asdf::load-just-fasls-op 'bar)
WARNING: Missing FILE-WRITE-DATE for
#P"jar:file:/Users/alanr/repos/lsw/trunk/patches/test.jar!/bar/bar1.lisp":
treating operation #<ASDF::LOAD-JUST-FASLS-OP NIL {8C2182}> on
component #<ASDF:CL-SOURCE-FILE "bar1" {B93BB6}> as done.
WARNING: Missing FILE-WRITE-DATE for
#P"jar:file:/Users/alanr/repos/lsw/trunk/patches/test.jar!/bar/bar2.lisp":
treating operation #<ASDF::LOAD-JUST-FASLS-OP NIL {8C2182}> on
component #<ASDF:CL-SOURCE-FILE "bar2" {7242FD}> as done.




More information about the armedbear-devel mailing list