Automagically find contrib via (REQUIRE :ABCL-CONTRIB).

REQUIREing :ABCL-CONTRIB will look for a 'abcl-contrib.jar' in the
same directory as 'abcl.jar'.  If found, all the ASDF definitions one
level deep will be added to the ASDF search path, allowing contribs to
be loaded via REQUIRE or ASDF:LOAD-SYSTEM.

No longer compile contribs as ASDF will do this for us.  Since we
moved to ASDF2, the contrib FASLs have been compiled but not packaged,
so this doesn't change any behavior except making packaging shorter.
When we figure out how to package FASLs with ASDF systems in jar
files, we will revisit this topic.
parent c15ba1f9
......@@ -469,40 +469,30 @@ from ${abcl.home.dir}
<property name="" value=""/>
<!-- XXX Generalize when (if?) we get more contribs -->
<target name="abcl.contrib.compile" depends="abcl.jar">
<java fork="true"
inputstring="(require 'asdf) (handler-case (progn (setf *default-pathname-defaults* &quot;${basedir}/contrib/asdf-install/&quot;) (asdf:operate 'asdf:compile-op :asdf-install)) (t (x) (progn (format t &quot;~A: ~A~%&quot; (type-of x) x) (exit :status -1))))"
<arg value="--noinit"/>
<target name="abcl.contrib" depends="abcl.contrib.compile">
<target name="abcl.contrib">
<jar destfile="dist/abcl-contrib.jar"
<include name="**/*.asd"/>
<include name="**/*.lisp"/>
<include name="**/*.abcl"/>
Packaged contribs in ${dist.dir}/abcl-contrib.jar.
To use ASDF-INSTALL, use the following in your ~/.abclrc:
To use contribs, ensure that 'abcl-contrib.jar' is in the same
directory as 'abcl.jar', then
CL-USER> (require 'abcl-contrib)
(require 'asdf)
(pushnew "jar:file:${dist.dir}/abcl-contrib.jar!/asdf-install/" asdf:*central-registry*)
will place all the contribs in the ASDF registry path.
Then issuing
To load a contrib, something like
CL-USER> (require 'asdf-install)
CL-USER> (require 'jss)
will load ASDF-INSTALL.
will compile (if necessary) and load JSS.
(in-package :system)
(require :asdf)
;;; XXX make less sensitive to ABCL jar being called "abcl.jar"
;;; allow being called "abcl-x.y.z.jar for semantic versioning
;;; allow customization in system.lisp
(defun find-system-jar ()
(dolist (loader (java:dump-classpath))
(let ((abcl-jar
(find-if (lambda (p) (and (equal (pathname-name p) "abcl")
(equal (pathname-type p) "jar")))
(rest loader))))
(when abcl-jar
(return abcl-jar)))))
(defvar *abcl-jar* nil
"Pathname of the jar that ABCL was loaded from.
Initialized via SYSTEM::FIND-SYSTEM-JAR.")
(defvar *abcl-contrib* nil
"Pathname of the ABCL contrib.
Initialized via SYSTEM:FIND-CONTRIB")
(defun find-contrib (&optional (verbose nil))
"Attempt to find the ABCL contrib jar and add its contents to ASDF."
(unless *abcl-contrib*
(unless *abcl-jar*
(setf *abcl-jar* (find-system-jar)))
(when *abcl-jar*
(let ((abcl-contrib (make-pathname :defaults *abcl-jar*
:name "abcl-contrib")))
(when (probe-file abcl-contrib)
(setf *abcl-contrib* abcl-contrib)
(dolist (asdf-file
(directory (make-pathname :device (list *abcl-contrib*)
:directory '(:absolute :wild)
:name :wild
:type "asd")))
(let ((asdf-directory
(make-pathname :defaults asdf-file :name nil :type nil)))
(when verbose
(format t "Adding ~A to ASDF.~%" asdf-directory))
(push asdf-directory asdf:*central-registry*)))
(when (find-contrib)
(provide :abcl-contrib))
......@@ -126,7 +126,8 @@
(load (do-compile "destructuring-bind.lisp"))
(load (do-compile "asdf.lisp"))
;; But not for these.
(mapc #'do-compile '("adjoin.lisp"
(mapc #'do-compile '("abcl-contrib.lisp"
......@@ -47,6 +47,7 @@
(format *error-output* "Failed to require ~A because '~A'~%"
module e))
(defvar *module-provider-functions* nil)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment