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

Last change on this file since 14192 was 14192, checked in by Mark Evenson, 8 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
implementation.

File size: 1.3 KB
Line 
1;;;; -*- Mode: LISP -*-
2
3;;;; Need to have jna.jar present for CFFI to have a chance of working.
4(asdf:defsystem :jna
5    :version "3.4.0"
6    :defsystem-depends-on (jss abcl-asdf)
7;; FIXME:
8    :components ((:mvn "net.java.dev.jna/jna/3.4.0")))
9
10(in-package :asdf)
11(defmethod perform :after ((o load-op) (c (eql (find-system :jna))))
12  (when (jss:find-java-class "com.sun.jna.Native")
13    (provide :jna)))
14
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))))
18  ;; Theoretically this should be the same thing as the MVN component.
19  (format *debug-io* "~&Attemping to locate jvm binary artifacts for JNA...~&")
20  (handler-case
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.")))
29    (t (e)
30      (error "Failed to resolve 'jna.jar' because~&~A.~&" e))))
31
32                         
Note: See TracBrowser for help on using the repository browser.