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

mevenson at common-lisp.net mevenson at common-lisp.net
Fri Oct 12 12:35:37 UTC 2012


Author: mevenson
Date: Fri Oct 12 05:35:37 2012
New Revision: 14188

Log:
jna.jar:  Try harder by introspecting the classpath.

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

Modified: trunk/abcl/contrib/mvn/jna.asd
==============================================================================
--- trunk/abcl/contrib/mvn/jna.asd	Fri Oct 12 05:04:34 2012	(r14187)
+++ trunk/abcl/contrib/mvn/jna.asd	Fri Oct 12 05:35:37 2012	(r14188)
@@ -8,6 +8,23 @@
 
 (defmethod asdf:perform :after ((o asdf:load-op) (c (eql (asdf:find-system :jna))))
   ;; Theoretically this should be the same thing as the MVN component.
-  (java:add-to-classpath (abcl-asdf:resolve "net.java.dev.jna:jna:3.4.0")))
+  (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")))
+    (t (e) (error "Failed to resolve 'jna.jar' because~&~A." e))))
 
                          




More information about the armedbear-cvs mailing list