ABCL-JAR issues & patch

John Pallister john at synchromesh.com
Tue Nov 24 11:25:34 UTC 2015


Hello list,

I've been trying to use ABCL-JAR to package up my app for deployment to
Google App Engine. I've come across a few issues; any comments would be
appreciated. I've attached a patch to the ABCL-JAR:PACKAGE function that
Works For Me(TM).

For the original code, see
http://abcl.org/trac/browser/trunk/abcl/contrib/asdf-jar/asdf-jar.lisp?rev=14695

First, there was an issue where if the ROOT parameter is NIL the function
would fail at line 90.

Second, The SYSTEM:ZIP function didn't want to nest JARs within the new
JAR, so systems that depended on e.g. JSS via abcl-contrib.jar would fail.
I filter out files in JARs on the assumption that one will just distribute
those JARs along with the new one.

Third, my ASDF file includes a system that looks like:

(asdf:defsystem #:gabacle-clack-java
  :defsystem-depends-on (#:abcl-asdf)
  :version "0.1"
  :description "Java interface classes for Gabacle/Clack."
  :depends-on ()
  :components ((:module java-src
:pathname "src/"
:components ((:class-file-directory "java")))))

This may or may not be good style, but it seems to be legal. When
traversing the ASDF files, the class file directory component comes back
with a PATHNAME-TYPE of :UNSPECIFIC, so I filter such entries out so that
SYSTEM:ZIP doesn't object.

On a minor note, at
http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/zip.java?rev=14695#L227
"incorporation" is spelled "incoporation".

I hope this is useful. If people could point out where I've just got the
wrong end of the stick, that would be great...

Cheers,

John :^P
-- 
John Pallister
john at johnp.net
john at synchromesh.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20151124/5eb4de5e/attachment.html>
-------------- next part --------------
--- asdf-jar.lisp at 14695	2015-11-24 10:29:22.000000000 +0000
+++ asdf-jar.lisp-jdp	2015-11-24 11:03:57.000000000 +0000
@@ -56,23 +56,26 @@
       (format verbose "~&Packaging contents in ~A" package-jar))
     (when (and verbose recursive dependencies) 
       (format verbose "~&  with recursive dependencies~{ ~A~^, ~}." dependencies))
+    (flet ((set-mapping (from to)
+	     (unless (string-equal (subseq (namestring from) 0 4) "jar:")
+	       (setf (gethash from mapping) to))))
+
     (dolist (system (append (list system) 
                             (when recursive 
                               (mapcar #'asdf:find-system dependencies))))
       (let ((base (slot-value system 'asdf::absolute-pathname))
             (name (slot-value system 'asdf::name))
             (asdf (slot-value system 'asdf::source-file)))
-        (setf (gethash asdf mapping) (let ((relative-path (archive-relative-path 
-                                                           base name asdf)))
+	  (set-mapping asdf (let ((relative-path (archive-relative-path base name asdf)))
                                        (if root
-                                         (merge-pathnames
-                                          relative-path
+				  (merge-pathnames relative-path
                                           (make-pathname :directory root))
                                          relative-path)))
         (loop :for component :in (all-files system) 
            :for source = (slot-value component 'asdf::absolute-pathname)
            :for source-entry = (archive-relative-path base name source)
-           :do (setf (gethash source mapping)
+	     :when (stringp (pathname-type source))
+	     :do (set-mapping source
                      (if root 
                          (merge-pathnames source-entry (make-pathname :directory root))
                          source-entry))
@@ -80,19 +83,19 @@
                  (format verbose "~&~A~& => ~A" source source-entry))
            :when (and (typep component 'asdf::source-file)
                       (not (typep component 'asdf::static-file)))
-           :do (let ((output 
-                      (make-pathname
-                       :defaults (asdf:apply-output-translations source)
+	     :do (let* ((output 
+			 (make-pathname :defaults (asdf:apply-output-translations source)
                        :type "abcl"))
+			(directory (pathname-directory source-entry))
                      (output-entry 
                       (make-pathname :defaults source-entry 
                                      :type "abcl"
-                                     :directory (append root
-                                                        (rest (pathname-directory source-entry))))))
+					:directory (if root
+						       (append root (rest directory))
+						       directory))))
                  (when *debug*
                    (format verbose "~&~A~& => ~A" output output-entry))
-                 (setf (gethash output mapping)
-                       output-entry)))))
+		   (set-mapping output output-entry))))))
     (system:zip package-jar mapping)))
 
 (defun all-files (component)


More information about the armedbear-devel mailing list