source: trunk/abcl/contrib/asdf-jar/asdf-jar.org

Last change on this file was 15686, checked in by Mark Evenson, 13 months ago

asdf-jar: extensive grouting of accumulated bitrot

Source ASDF systems residing in jar files may now be repackaged, as
was the usually case for JSS which prompted this rework.

We now neither package nor read fasls from jar files by default for
two reasons. First, configuring ASDF to not compile systems seems to
have changed somewhat, so the finagling of output translations no
longer seems to work. Secondly, since the Lisp compiler is always
present at runtime, fasls can always be created provided that ASDF has
writable local directory, which would probably be true in almost
all (?) deployment scenarios.

We now attempt to package non-source artifacts declared in system
definitions via asdf components that are files but not compiled
artifacts as well as those which appear in the
ASDF/COMPONENT::ADDITIONAL-INPUT-FILES slot.

We have removed use of ASDF internal symbols as much as possible, but
alas still use a couple internal interfaces where unavoidable.

We no longer use the deprecated ASDF:*CENTRAL-REGISTRY* to add systems
to the source registry.

Resolves <https://github.com/armedbear/abcl/issues/476>.

File size: 4.4 KB
Line 
1#+TITLE: clearing the bitrot out of ASDF-JAR
2
3* @selwynsimsek GitHub issue
4<https://github.com/armedbear/abcl/issues/476>
5
6* Development
7
8** DONE package from system located in JAR
9CLOSED: [2023-03-28 Tue 09:54]
10
11- CLOSING NOTE [2023-03-28 Tue 09:54] \\
12  Implemented with new method in zip.java that uses a =java.io.InputStream= as well as an explicit lastModified parameter.
13Try to get a =java.io.File= reference to an entry in a jar file, so
14the current code path in =system-jar= works.
15
16#+caption: stuck at
17#+begin_example
18Caught java.lang.UnsupportedOperationException.
19   [Condition of type ERROR]
20#+end_example
21
22** DONE don't package fasls by default
23CLOSED: [2023-03-21 Tue 08:47]
24
25- CLOSING NOTE [2023-03-21 Tue 08:47] \\
26  Add :fasls keyword to various routines, with NIL as default
27** DONE add separate package file source unit, a test or two
28CLOSED: [2023-03-21 Tue 08:12]
29
30- CLOSING NOTE [2023-03-21 Tue 08:12] \\
31  Test present:  JSS still not working.
32** DONE eval IF-FEATURE for individual source files
33CLOSED: [2023-03-31 Fri 14:19]
34- CLOSING NOTE [2023-03-31 Fri 14:19] \\
35  Implemented as a semi-hacky thing that tries to interpret its arg as a system if it can't parse it as a feature.
36<[[file:asdf-jar.lisp::defun resolve-system-or-feature (system-or-feature]]>
37** DONE configure ASDF to find a contrib on the filesystem
38CLOSED: [2023-03-20 Mon 21:20]
39
40- CLOSING NOTE [2023-03-20 Mon 21:20]
41<[[info:asdf.info#Configuration DSL][asdf.info#Configuration DSL]]>
42#+begin_src lisp
43  (asdf:initialize-source-registry
44   '(:source-registry :ignore-inherited-configuration
45     (:directory #p"~/work/abcl/contrib/jss/")))
46#+end_src
47
48#+RESULTS:
49
50#+begin_src lisp
51    (asdf:locate-system :jss)
52#+end_src
53
54#+begin_src lisp
55  (mapcar
56   (lambda (p) (when (not (pathname-jar-p p)) p))
57   asdf:*central-registry*)
58#+end_src
59
60
61#+caption: save central registry
62#+begin_src lisp
63  (setf xx asdf:*central-registry*)
64#+end_src
65
66#+begin_src lisp
67  (defun collect-abcl-contrib-directories ()
68    (let* ((all-asd
69             (directory
70              (asdf:system-relative-pathname :abcl "contrib/**/*.asd")))
71           (unique-directories
72             (loop :for asd :in all-asd
73                   :with result = nil
74                   :doing
75                      (pushnew (make-pathname :directory (pathname-directory asd)
76                                              :name nil :type nil)
77                               result :test #'equalp)
78                   :finally
79                      (return result))))
80      (values
81       unique-directories
82       all-asd)))
83
84#+end_src
85
86#+RESULTS:
87: COLLECT-ABCL-CONTRIB-DIRECTORIES
88
89#+name: rig-asdf #
90#+caption: Rig ASDF to use the ASDF location of ABCL contrib source on filesystem
91#+begin_src lisp
92  (defun rig-asdf ()
93    (let* ((not-jars
94             (mapcar
95              (lambda (p) (when (not (pathname-jar-p p)) p))
96              asdf:*central-registry*))
97           (directories
98             (remove-if #'not not-jars))
99           (initial-without-jar
100             (loop :for d :in directories
101                   :collecting `(:directory ,d)))
102           (abcl-contrib-directories
103             (loop :for d :in (collect-abcl-contrib-directories)
104                   :collecting `(:directory ,d))))
105      (asdf:initialize-source-registry
106       `(:source-registry
107         ,#+nil
108         :ignore-inherited-configuration
109         ,@abcl-contrib-directories
110         ,@initial-without-jar
111         :inherit-configuration))))
112#+end_src
113
114#+caption: Transitioning away from use of ASDF:*CENTRAL-REGISTRY*
115#+begin_src lisp
116(setf asdf:*central-registry* nil)
117(rig-asdf)
118#+end_src
119
120** DONE Refactored rig-asdf as EXT:REGISTER-ASDF
121CLOSED: [2023-03-31 Fri 14:20]
122
123- CLOSING NOTE [2023-03-31 Fri 14:20] \\
124  TODO:  add an equivalent API to fiddle with asdf output-translations?  The current plan is to include that machinery in the ASDF-JAR contrib
125<[[file:~/work/abcl/src/org/armedbear/lisp/abcl-contrib.lisp::defun register-asdf (asdf-file-or-files]]>
126
127** TODO Use fasls from jar
128
129* Fragments
130
131** use EXT:ADD-TO-ASDF
132#+begin_src lisp
133  (ext:register-asdf '("/Users/evenson/easye/work/illithid/illithid.asd"
134                       "/Users/evenson/net/slack.net/home/mevenson/work/etch/etch.asd"))
135#+end_src
136
137#+RESULTS:
138
139* References
140
141** <https://docs.oracle.com/javase/8/docs/technotes/guides/io/fsp/zipfilesystemprovider.html>
142
143* Colophon 
144  #+begin_example
145    Mark <evenson@not.org>
146    Created: 2023-03-06
147    Revised: <2023-03-31 Fri 14:41>
148  #+end_example
Note: See TracBrowser for help on using the repository browser.