Merge remote-tracking branch 'marcliberatore/natives-update-java-library-path'
This commit is contained in:
commit
ededa95c2d
4 changed files with 33 additions and 12 deletions
|
@ -181,7 +181,8 @@
|
|||
(when (= (subvec dep 0 2) (subvec v 0 2 )) v))
|
||||
dependencies))
|
||||
|
||||
(defn- get-native-prefix
|
||||
(defn get-native-prefix
|
||||
"Return the :native-prefix of a dependency vector, or nil."
|
||||
[[id version & {:as opts}]]
|
||||
(get opts :native-prefix))
|
||||
|
||||
|
|
|
@ -59,13 +59,19 @@ leiningen.core.utils/platform-nullsink instead."
|
|||
|
||||
;; # Subprocess stuff
|
||||
|
||||
(defn native-arch-path
|
||||
"Path to the os/arch-specific directory containing native libs."
|
||||
(defn native-arch-paths
|
||||
"Paths to the os/arch-specific directory containing native libs."
|
||||
[project]
|
||||
(let [os (:os project (get-os))
|
||||
arch (:arch project (get-arch))]
|
||||
arch (:arch project (get-arch))
|
||||
native-path (:native-path project)]
|
||||
(if (and os arch)
|
||||
(io/file (:native-path project) (name os) (name arch)))))
|
||||
(conj
|
||||
(->> (:dependencies project)
|
||||
(map classpath/get-native-prefix)
|
||||
(remove nil?)
|
||||
(map #(io/file native-path %)))
|
||||
(io/file native-path (name os) (name arch))))))
|
||||
|
||||
(defn- as-str [x]
|
||||
(if (instance? clojure.lang.Named x)
|
||||
|
@ -91,7 +97,7 @@ leiningen.core.utils/platform-nullsink instead."
|
|||
(defn- get-jvm-args
|
||||
"Calculate command-line arguments for launching java subprocess."
|
||||
[project]
|
||||
(let [native-arch-path (native-arch-path project)]
|
||||
(let [native-arch-paths (native-arch-paths project)]
|
||||
`(~@(get-jvm-opts-from-env (System/getenv "JVM_OPTS"))
|
||||
~@(:jvm-opts project)
|
||||
~@(get arch-options (:arch project))
|
||||
|
@ -101,8 +107,12 @@ leiningen.core.utils/platform-nullsink instead."
|
|||
:file.encoding (or (System/getProperty "file.encoding") "UTF-8")
|
||||
:clojure.debug (boolean (or (System/getenv "DEBUG")
|
||||
(:debug project)))})
|
||||
~@(if (and native-arch-path (.exists native-arch-path))
|
||||
[(d-property [:java.library.path native-arch-path])])
|
||||
~@(if native-arch-paths
|
||||
(let [extant-paths (filter #(.exists %) native-arch-paths)]
|
||||
(if (seq extant-paths)
|
||||
[(d-property [:java.library.path
|
||||
(string/join java.io.File/pathSeparatorChar
|
||||
extant-paths)])])))
|
||||
~@(when-let [{:keys [host port non-proxy-hosts]} (classpath/get-proxy-settings)]
|
||||
[(d-property [:http.proxyHost host])
|
||||
(d-property [:http.proxyPort port])
|
||||
|
|
|
@ -31,14 +31,24 @@
|
|||
:url "http://www.eclipse.org/legal/epl-v10.html"
|
||||
:distribution :repo
|
||||
:comments "same as Clojure"}
|
||||
;; Dependencies are listed as [group-id/name version].
|
||||
;; Dependencies are listed as [group-id/name version]; in addition
|
||||
;; to keywords supported by Pomegranate, you can use :native-prefix
|
||||
;; to specify a prefix. This prefix is used to extract natives in
|
||||
;; jars that don't adhere to the default "<os>/<arch>/" layout that
|
||||
;; Leiningen expects.
|
||||
:dependencies [[org.clojure/clojure "1.3.0"]
|
||||
[org.jclouds/jclouds "1.0" :classifier "jdk15" :scope "test"]
|
||||
[net.sf.ehcache/ehcache "2.3.1" :extension "pom"]
|
||||
[log4j "1.2.15" :exclusions [[javax.mail/mail :extension "jar"]
|
||||
[javax.jms/jms :classifier "*"]
|
||||
com.sun.jdmk/jmxtools
|
||||
com.sun.jmx/jmxri]]]
|
||||
com.sun.jmx/jmxri]]
|
||||
[org.lwjgl.lwjgl/lwjgl "2.8.5"]
|
||||
[org.lwjgl.lwjgl/lwjgl-platform "2.8.5"
|
||||
:classifier "natives-osx"
|
||||
;; LWJGL stores natives in the root of the jar; this
|
||||
;; :native-prefix will extract them.
|
||||
:native-prefix ""]]
|
||||
;; Global exclusions are applied across the board, as an alternative
|
||||
;; to duplication for multiple dependencies with the same excluded libraries.
|
||||
:exclusions [org.apache.poi/poi
|
||||
|
|
|
@ -109,6 +109,6 @@
|
|||
(deps native-project)
|
||||
(is (= (conj (get-in native-lib-files-map [(eval/get-os) (eval/get-arch)])
|
||||
".gitkeep")
|
||||
(set (for [f (rest (file-seq (io/file (eval/native-arch-path
|
||||
native-project))))]
|
||||
(set (for [f (rest (file-seq (io/file (first (eval/native-arch-paths
|
||||
native-project)))))]
|
||||
(.getName f))))))
|
||||
|
|
Loading…
Reference in a new issue