Skip to content

Instantly share code, notes, and snippets.

@synchromesh
Created November 30, 2015 08:15
Show Gist options
  • Save synchromesh/2a741e1b9f61ceb548f7 to your computer and use it in GitHub Desktop.
Save synchromesh/2a741e1b9f61ceb548f7 to your computer and use it in GitHub Desktop.
Attempt at ABCL build.lisp to call ABCL-JAR:PACKAGE from Ant
(eval-when (:execute)
(format t "EVAL-WHEN: :execute~%"))
;; Copied from my .abclrc
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname))))
(when (probe-file quicklisp-init)
(format t "Loading ~A~%" quicklisp-init)
(load quicklisp-init)))
(format t "Requiring~%")
(require 'asdf)
(require 'abcl-contrib)
(require 'asdf-jar)
(in-package :cl-user)
(defparameter *self* nil)
(defparameter *project* nil)
(defun get-property (name)
(let ((value (jcall "getProperty" *project* name)))
(format t "get-property: ~A = '~A'.~%" name value)
value))
(eval-when (:execute)
(setq *self* self
*project* (jcall "getProject" self))
(format t "ASDF package = ~A, ASDF-JAR package = ~A, QUICKLISP package = ~A~%"
(find-package "ASDF") (find-package "ASDF-JAR") (find-package "QUICKLISP"))
(format t "ASDF:LOAD-SYSTEM~%")
;;(ql:quickload "gabacle")
(asdf:load-system "gabacle" :verbose t)
(format t "ASDF-JAR:PACKAGE~%")
#+nil (asdf-jar:package "gabacle"
:out (get-property "dist.dir")
:verbose t))
;; Output:
;; john@yuyi:~/src/synchromesh/gabacle$ ant make.lisp.jar
;; Buildfile: /Volumes/SoftRAID/Users/john/src/synchromesh/gabacle/build.xml
;; init.dist:
;; make.lisp.jar:
;; [script] EVAL-WHEN: :execute
;; [script] Loading /Volumes/SoftRAID/Users/john/quicklisp/setup.lisp
;; [script] Requiring
;; [script] Failed to require ABCL-CONTRIB because 'Java exception 'java.lang.NoSuchMethodException: No applicable method named getURLs found in java.lang.ClassLoader or org.apache.tools.ant.loader.AntClassLoader5'.'
;; BUILD FAILED
;; /Volumes/SoftRAID/Users/john/src/synchromesh/gabacle/build.xml:110: org.armedbear.lisp.Interpreter$UnhandledCondition: Unhandled lisp condition: Don't know how to REQUIRE ABCL-CONTRIB.
;; at org.armedbear.lisp.Interpreter$1.execute(Interpreter.java:569)
;; at org.armedbear.lisp.LispThread.execute(LispThread.java:832)
;; etc.
@synchromesh
Copy link
Author

My build.xml contains (amongst other things):

  <property name="abcl.home"
            location="/opt/local/share/java/abcl"/>

  <path id="abcl.jars">
      <fileset dir="${abcl.home}">
          <include name="abcl.jar"/>
          <include name="abcl-contrib.jar"/>
      </fileset>
  </path>

   <target name="make.lisp.jar"
          depends="init.dist">
      <script language="ABCL"
              classpathref="abcl.jars" 
              src="${lisp.src.dir}/build.lisp"/>
  </target>

@synchromesh
Copy link
Author

Mark Evenson said that there's an issue with the Ant classloader that is stopping REQUIRE 'ABCL-CONTRIB from working. The workaround is to use the <java fork="true"/> Ant task instead of the <script/> task.

He also suggested dropping JSS etc. as an ASDF dependency in my DEFSYSTEM form and just using REQUIRE 'JSS where necessary. And this fixed the "nested JAR" problem I ran into next! Thanks Mark!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment