[armedbear-cvs] r14190 - trunk/abcl/contrib/mvn

mevenson at common-lisp.net mevenson at common-lisp.net
Fri Oct 12 13:18:12 UTC 2012


Author: mevenson
Date: Fri Oct 12 06:18:12 2012
New Revision: 14190

Log:
The Bear gets medieval with JNA.

If jna.jar is in your path, we should count as having required.

Modified:
   trunk/abcl/contrib/mvn/jna.asd

Modified: trunk/abcl/contrib/mvn/jna.asd
==============================================================================
--- trunk/abcl/contrib/mvn/jna.asd	Fri Oct 12 05:52:58 2012	(r14189)
+++ trunk/abcl/contrib/mvn/jna.asd	Fri Oct 12 06:18:12 2012	(r14190)
@@ -3,31 +3,36 @@
 ;;;; Need to have jna.jar present for CFFI to have a chance of working.
 (asdf:defsystem :jna 
     :version "3.4.0"
-    :defsystem-depends-on (abcl-asdf))
+    :defsystem-depends-on (jss abcl-asdf))
 ;; FIXME:  install a better handler in abcl-asdf  :components ((:mvn "net.java.dev.jna/jna/3.4.0")))
 
 (defmethod asdf:perform :after ((o asdf:load-op) (c (eql (asdf:find-system :jna))))
+  (when (jss:find-java-class "com.sun.jna.Native")
+    (provide :jna)))
+
+(defmethod asdf:perform :before ((o asdf:load-op) (c (eql (asdf:find-system :jna))))
   ;; Theoretically this should be the same thing as the MVN component.
   (handler-case 
-      (unless 
-          (flet ((match-jna-jar (p)
-                   "Match `jna.jar`,`jna-3.0.9.jar`, or `jna-3.4.0.jar`."
-                   (and (pathnamep p)
-                        (equal (pathname-type p) "jar")
-                        (java:jstatic "matches"
-                                      "java.util.regex.Pattern" 
-                                      "jna(-[0-9]\\.[0-9]\\.[0-9](-.+)?)?" 
-                                      (pathname-name p))
-                        p)))
-            (dolist (loader (java:dump-classpath))
-              (let ((jna-jar (some #'match-jna-jar loader)))
-                (when jna-jar
-                  (return abcl-jar)))))
-        (java:add-to-classpath (abcl-asdf:resolve
-                                "net.java.dev.jna:jna:3.4.0")))
+      (unless (jss:find-java-class "com.sun.jna.Native")
+        (unless 
+            (flet ((match-jna-jar (p)
+                     "Match `jna.jar`,`jna-3.0.9.jar`, or `jna-3.4.0.jar`."
+                     (and (pathnamep p)
+                          (equal (pathname-type p) "jar")
+                          (java:jstatic "matches"
+                                        "java.util.regex.Pattern" 
+                                        "jna(-[0-9]\\.[0-9]\\.[0-9](-.+)?)?" 
+                                        (pathname-name p))
+                          p)))
+              (dolist (loader (java:dump-classpath))
+                (let ((jna-jar (some #'match-jna-jar loader)))
+                  (when jna-jar
+                    (return abcl-jar)))))
+          (unless 
+              (java:add-to-classpath (abcl-asdf:resolve
+                                      "net.java.dev.jna:jna:3.4.0"))
+            (java:add-to-classpath "http://repo1.maven.org/maven2/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar"))))
     (t (e) 
-      (progn 
-        (unless (jss:find-java-class "com.sun.jna.Native")
-          (error "Failed to resolve 'jna.jar' because~&~A." e))))))
+      (error "Failed to resolve 'jna.jar' because~&~A." e))))
 
                          




More information about the armedbear-cvs mailing list