source: trunk/abcl/contrib/mvn/jna.asd @ 14192

Last change on this file since 14192 was 14192, checked in by Mark Evenson, 9 years ago

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

File size: 1.3 KB
[13880]1;;;; -*- Mode: LISP -*-
3;;;; Need to have jna.jar present for CFFI to have a chance of working.
[13881]4(asdf:defsystem :jna
[14171]5    :version "3.4.0"
[14192]6    :defsystem-depends-on (jss abcl-asdf)
7;; FIXME:
8    :components ((:mvn "")))
[14192]10(in-package :asdf)
11(defmethod perform :after ((o load-op) (c (eql (find-system :jna))))
[14190]12  (when (jss:find-java-class "com.sun.jna.Native")
13    (provide :jna)))
[14192]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))))
[14187]18  ;; Theoretically this should be the same thing as the MVN component.
[14192]19  (format *debug-io* "~&Attemping to locate jvm binary artifacts for JNA...~&")
[14188]20  (handler-case
[14192]21      (jss:find-java-class "com.sun.jna.Native")
22    (java:java-exception (e)
23      (unless
24          (java:add-to-classpath (abcl-asdf:resolve ""))
25        (unless
26            (java:add-to-classpath #p"")
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.")))
[14189]29    (t (e)
[14192]30      (error "Failed to resolve 'jna.jar' because~&~A.~&" e))))
Note: See TracBrowser for help on using the repository browser.