Changeset 14908
- Timestamp:
- 11/16/16 12:47:36 (7 years ago)
- Location:
- trunk/abcl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/build.xml
r14907 r14908 41 41 <property name="abcl.jar.path" 42 42 value="${dist.dir}/abcl.jar"/> 43 <property name="abcl .aio.jar.path"43 <property name="abcl-aio.jar.path" 44 44 value="${dist.dir}/abcl-aio.jar"/> 45 45 <property name="abcl.ext.dir" … … 493 493 </target> 494 494 495 <target name="abcl .aio" depends="abcl.compile,abcl.stamp">495 <target name="abcl-aio.jar" depends="abcl.compile,abcl.version"> 496 496 <mkdir dir="${dist.dir}"/> 497 <jar destfile="${abcl .aio.jar.path}"497 <jar destfile="${abcl-aio.jar.path}" 498 498 compress="true" 499 499 update="true" … … 507 507 <patternset refid="abcl.contrib.source"/> 508 508 </fileset> 509 <!-- According to <http://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html> 510 any attributes not specified are ignored, so we are free to make up new attributes if necessary. For now we just overload Implementation-Title and Implementation-Version. 511 --> 509 512 <manifest> 510 513 <attribute name="Main-Class" value="org.armedbear.lisp.Main"/> … … 517 520 value="${build}"/> 518 521 </section> 522 <section name="contrib"> 523 <attribute name="Implementation-Title" 524 value="org.abcl-contrib"/> 525 <!-- FIXME: declare separate abcl-contrib version? --> 526 <attribute name="Implementation-Version" 527 value="${abcl.implementation.version}"/> 528 </section> 529 <section name="tools"> 530 <attribute name="Implementation-Title" 531 value="org.abcl-tools"/> 532 </section> 533 <section name="src"> 534 <attribute name="Implementation-Title" 535 value="org.abcl-source"/> 536 <attribute name="Implementation-Version" 537 value="${abcl.implementation.version}"/> 538 </section> 519 539 </manifest> 520 540 <metainf dir="${src.dir}/META-INF"> … … 529 549 depends="abcl.jar,abcl.contrib,abcl.wrapper.unix,abcl.wrapper.windows"> 530 550 <description> 531 Creates in-place executable shell wrapper in '${abcl.wrapper.file}' 551 Creates in-place executable shell wrapper in 552 '${abcl.wrapper.file}' 532 553 </description> 533 554 <!-- Set from commandline or in 'build.properties' --> … … 1173 1194 <import file="build-snapshot.xml" optional="true"/> 1174 1195 1175 <import file="build-maven.xml" optional="true"/> 1176 </project> 1177 1178 1179 1180 1196 <import file="build-maven.xml" optional="true"/> </project> -
trunk/abcl/src/org/armedbear/lisp/abcl-contrib.lisp
r14907 r14908 34 34 35 35 (defun find-system () 36 "Find the location of the system.36 "Find the location of the Armed Bear system implementation 37 37 38 38 Used to determine relative pathname to find 'abcl-contrib.jar'." … … 72 72 (defparameter *verbose* t) 73 73 74 (defun add-contrib (abcl-contrib-jar &optional relative) 75 "Introspects ABCL-CONTRIB-JAR for asdf systems to add to ASDF:*CENTRAL-REGISTRY*" 76 (when abcl-contrib-jar 74 ;;; FIXME: stop using the obsolete ASDF:*CENTRAL-REGISTRY* 75 (defun add-contrib (abcl-contrib-jar) 76 "Introspects a abcl-contrib-jar path whose immediate sub-directories 77 contain asdf definitions, adding those found to asdf." 78 (let ((jar-path (if (ext:pathname-jar-p abcl-contrib-jar) 79 abcl-contrib-jar 80 (make-pathname :device (list abcl-contrib-jar))))) 77 81 (dolist (asdf-file 78 (directory (make-pathname :device (list abcl-contrib-jar) 79 :directory (if relative `(:absolute ,relative :wild) '(:absolute :wild)) 80 :name :wild 81 :type "asd"))) 82 (directory (merge-pathnames "*/*.asd" jar-path))) 82 83 (let ((asdf-directory (make-pathname :defaults asdf-file :name nil :type nil))) 83 84 (unless (find asdf-directory asdf:*central-registry* :test #'equal) … … 87 88 (defun find-and-add-contrib (&key (verbose nil)) 88 89 "Attempt to find the ABCL contrib jar and add its contents to ASDF. 89 Returns the pathname of the contrib if it can be found." 90 (if *abcl-contrib* 91 (format verbose "~&Using already initialized value of abcl-contrib:~&'~A'.~%" 92 *abcl-contrib*) 93 (progn 94 (setf *abcl-contrib* (find-contrib)) 95 (format verbose "~&Using probed value of abcl-contrib:~&'~A'.~%" 96 *abcl-contrib*))) 97 (add-contrib *abcl-contrib* 98 (and (equalp *abcl-contrib* (find-system-jar)) 99 "contrib")) 100 ) 90 returns the pathname of the contrib if it can be found." 91 (if *abcl-contrib* 92 (format verbose "~&Using already initialized value of abcl-contrib:~&'~A'.~%" 93 *abcl-contrib*) 94 (progn 95 (let ((contrib (find-contrib))) 96 (when contrib 97 (format verbose "~&Using probed value of abcl-contrib:~&'~A'.~%" 98 contrib) 99 (setf *abcl-contrib* contrib))))) 100 (when *abcl-contrib* ;; For bootstrap compile there will be no contrib 101 (add-contrib *abcl-contrib*))) 102 103 (defun find-name-for-implementation-title (file id) 104 "For a jar FILE containing a manifest, return the name of the 105 section which annotates 'Implementation-Title' whose string value is 106 ID." 107 (declare (type pathname file)) 108 (let* ((jar (java:jnew "java.util.jar.JarFile" (namestring file))) 109 (manifest (java:jcall "getManifest" jar)) 110 (entries (java:jcall "toArray" 111 (java:jcall "entrySet" 112 (java:jcall "getEntries" manifest))))) 113 (dolist (entry 114 (loop :for entry :across entries 115 :collecting entry)) 116 (let ((title (java:jcall "getValue" 117 (java:jcall "getValue" entry) 118 "Implementation-Title"))) 119 (when (string-equal title id) 120 (return-from find-name-for-implementation-title 121 (java:jcall "getKey" entry)))) 122 nil))) 101 123 102 124 (defun find-contrib () 103 "Introspect runtime classpaths to find a loadable ABCL-CONTRIB." 104 (or (ignore-errors 105 (let ((system-jar (find-system-jar))) 106 (and 107 (probe-file (make-pathname 108 :device (list system-jar) 109 :directory '(:absolute "contrib") 110 :name "README" :type "markdown" )) 111 system-jar))) 112 (ignore-errors 113 (find-contrib-jar)) 114 (ignore-errors 115 (let ((system-jar (find-system-jar))) 116 (when system-jar 117 (probe-file (make-pathname 118 :defaults system-jar 119 :name (concatenate 'string 120 "abcl-contrib" 121 (subseq (pathname-name system-jar) 4))))))) 122 (some 123 (lambda (u) 125 "Introspect runtime classpaths to return a pathname containing 126 subdirectories containing ASDF definitions." 127 128 (or 129 ;; We identify the location of the directory within a jar file 130 ;; containing abcl-contrib ASDF definitions by looking for a section 131 ;; which contains the Implementation-Title "org.abcl-contrib". The 132 ;; name of that section then identifies the relative pathname to the 133 ;; top-most directory in the Jar 134 ;; 135 ;; e.g. for an entry of the form 136 ;; 137 ;; Name: contrib 138 ;; Implementation-Title: org.abcl-contrib 139 ;; 140 ;; the directory 'contrib' would be searched for ASDF definitions. 141 (ignore-errors 142 (let* ((system-jar 143 (find-system-jar)) 144 (relative-pathname 145 (find-name-for-implementation-title system-jar "org.abcl-contrib"))) 146 (when (and system-jar relative-pathname) 147 (merge-pathnames (pathname (concatenate 'string 148 relative-pathname "/")) 149 (make-pathname 150 :device (list system-jar)))))) 151 (ignore-errors 152 (find-contrib-jar)) 153 (ignore-errors 154 (let ((system-jar (find-system-jar))) 155 (when system-jar 124 156 (probe-file (make-pathname 125 :defaults (java:jcall "toString" u) 126 :name "abcl-contrib"))) 127 (java:jcall "getURLs" (boot-classloader))))) 157 :defaults system-jar 158 :name (concatenate 'string 159 "abcl-contrib" 160 (subseq (pathname-name system-jar) 4))))))) 161 (some 162 (lambda (u) 163 (probe-file (make-pathname 164 :defaults (java:jcall "toString" u) 165 :name "abcl-contrib"))) 166 (java:jcall "getURLs" (boot-classloader))))) 128 167 129 168 (export `(find-system
Note: See TracChangeset
for help on using the changeset viewer.