Changeset 14192


Ignore:
Timestamp:
10/13/12 09:12:36 (8 years ago)
Author:
Mark Evenson
Message:

abcl-asdf: special case handling for finding com.sun.jna.Native et. al.

Fallback to finding 'jna.jar' via Maven is to download it ourselves.

Undefined what having a URI in your classpath means to your local JVM
implementation.

Location:
trunk/abcl/contrib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/contrib/abcl-asdf/abcl-asdf.lisp

    r13904 r14192  
    101101  "Resolve all runtime dependencies of MVN-COMPONENT.
    102102
    103 Returns a string in JVM CLASSPATH format as entries delimited by classpath separator string."
    104  
    105   (with-slots (asdf::group-id asdf::artifact-id asdf::version) mvn-component
    106     (resolve-dependencies asdf::group-id asdf::artifact-id asdf::version)))
     103Returns a string in JVM CLASSPATH format as entries delimited by
     104classpath separator string.  Can possibly be a single entry denoting a
     105remote binary artifact."
     106  (let ((name (asdf::component-name mvn-component)))
     107    (if (find-mvn)
     108        (with-slots (asdf::group-id asdf::artifact-id asdf::version) mvn-component
     109          (resolve-dependencies asdf::group-id asdf::artifact-id asdf::version))
     110        (cond
     111          ((string= name
     112                    "net.java.dev.jna/jna/3.4.0"
     113                    (let ((uri #p"http://repo1.maven.org/maven2/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar"))
     114                      (values (namestring uri) uri))))
     115          (t
     116           (error "Failed to resolve MVN component name ~A." name))))))
    107117
    108118(defun as-classpath (classpath)
  • trunk/abcl/contrib/mvn/jna.asd

    r14191 r14192  
    44(asdf:defsystem :jna
    55    :version "3.4.0"
    6     :defsystem-depends-on (jss abcl-asdf))
    7 ;; FIXME:  install a better handler in abcl-asdf  :components ((:mvn "net.java.dev.jna/jna/3.4.0")))
     6    :defsystem-depends-on (jss abcl-asdf)
     7;; FIXME:
     8    :components ((:mvn "net.java.dev.jna/jna/3.4.0")))
    89
    9 (defmethod asdf:perform :after ((o asdf:load-op) (c (eql (asdf:find-system :jna))))
     10(in-package :asdf)
     11(defmethod perform :after ((o load-op) (c (eql (find-system :jna))))
    1012  (when (jss:find-java-class "com.sun.jna.Native")
    1113    (provide :jna)))
    1214
    13 (defmethod asdf:perform :before ((o asdf:load-op) (c (eql (asdf:find-system :jna))))
     15;;; After ASDF performs COMPILE-OP, one expects that the JNA Java
     16;;; classes can be instantiated.  If not, execute various loading strategies.
     17(defmethod perform ((o compile-op) (c (eql (find-system :jna))))
    1418  ;; Theoretically this should be the same thing as the MVN component.
     19  (format *debug-io* "~&Attemping to locate jvm binary artifacts for JNA...~&")
    1520  (handler-case
    16       (unless (jss:find-java-class "com.sun.jna.Native")
    17         (unless (java:add-to-classpath (abcl-asdf:resolve "net.java.dev.jna:jna:3.4.0"))
    18           (java:add-to-classpath "http://repo1.maven.org/maven2/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar")))
     21      (jss:find-java-class "com.sun.jna.Native")
     22    (java:java-exception (e)
     23      (unless
     24          (java:add-to-classpath (abcl-asdf:resolve "net.java.dev.jna:jna:3.4.0"))
     25        (unless
     26            (java:add-to-classpath #p"http://repo1.maven.org/maven2/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar")
     27          (error "Failed to load jna-3.4.0.jar from the network via URI."))
     28        (error "Failed to load jna.jar via ABCL-ASDF.")))
    1929    (t (e)
    20       (error "Failed to resolve 'jna.jar' because~&~A." e))))
     30      (error "Failed to resolve 'jna.jar' because~&~A.~&" e))))
    2131
    2232                         
Note: See TracChangeset for help on using the changeset viewer.