aboutsummaryrefslogtreecommitdiff
path: root/lux-lein/src/leiningen
diff options
context:
space:
mode:
authorEduardo Julian2017-12-01 19:39:48 -0400
committerEduardo Julian2017-12-01 19:39:48 -0400
commit0ea9403e482b7f01df9e634ae2533b20ef56a9ab (patch)
treefd80f6b355c671383a66cd1f505c652b356a7a9b /lux-lein/src/leiningen
parente8f0f43673891152ea33f149ac3f28828368e013 (diff)
- Fixed path-separator bugs in the Leiningen plugin.
Diffstat (limited to 'lux-lein/src/leiningen')
-rw-r--r--lux-lein/src/leiningen/lux/test.clj6
-rw-r--r--lux-lein/src/leiningen/lux/utils.clj31
2 files changed, 20 insertions, 17 deletions
diff --git a/lux-lein/src/leiningen/lux/test.clj b/lux-lein/src/leiningen/lux/test.clj
index 209c060c4..49e30a7f2 100644
--- a/lux-lein/src/leiningen/lux/test.clj
+++ b/lux-lein/src/leiningen/lux/test.clj
@@ -15,7 +15,8 @@
"[JVM COMPILATION ENDED]")
(let [java-cmd (get project :java-cmd "java")
jvm-opts (->> (get project :jvm-opts) (interpose " ") (reduce str ""))
- output-package (str (get-in project [:lux :target] &utils/default-jvm-output-dir) "/"
+ output-package (str (get-in project [:lux :target] &utils/default-jvm-output-dir)
+ java.io.File/separator
(get project :jar-name &utils/output-package))]
(do (&packager/package project "jvm" jvm-module (get project :resource-paths (list)))
(&utils/run-process (str java-cmd " " jvm-opts " -jar " output-package)
@@ -28,7 +29,8 @@
nil
"[JS COMPILATION BEGAN]"
"[JS COMPILATION ENDED]")
- (let [output-package (str (get-in project [:lux :target] &utils/default-js-output-dir) "/"
+ (let [output-package (str (get-in project [:lux :target] &utils/default-js-output-dir)
+ java.io.File/separator
"program.js")]
(do (&packager/package project "js" js-module (get project :resource-paths (list)))
(&utils/run-process (str "node " output-package)
diff --git a/lux-lein/src/leiningen/lux/utils.clj b/lux-lein/src/leiningen/lux/utils.clj
index ae39c37b3..ae5cc1b96 100644
--- a/lux-lein/src/leiningen/lux/utils.clj
+++ b/lux-lein/src/leiningen/lux/utils.clj
@@ -16,14 +16,15 @@
;; "-server -Xms2048m -Xmx2048m -XX:+OptimizeStringConcat"
)
+(defn sanitize-path [^String path]
+ (.replace path "/" java.io.File/separator))
+
(defn prepare-path [path]
(let [is-windows? (and (.startsWith path "/")
- (= "\\" java.io.File/separator))
- path (if is-windows?
- (.substring path 1)
- path)
- path (.replace path "/" java.io.File/separator)]
- path))
+ (= "\\" java.io.File/separator))]
+ (sanitize-path (if is-windows?
+ (.substring path 1)
+ path))))
(def ^:private stdlib-id ["com.github.luxlang" "stdlib"])
@@ -33,24 +34,24 @@
(map #(.getFile ^java.net.URL %))
(filter #(.endsWith ^String % ".jar"))))
-(do-template [<name> <signal>]
+(do-template [<name> <path>]
(defn <name> [jar-paths]
{:post [(not (nil? %))]}
(some (fn [^:private path]
- (if (.contains path <signal>)
+ (if (.contains path <path>)
path
nil))
jar-paths))
- ^:private find-compiler-path "com/github/luxlang/luxc-jvm"
- ^:private find-stdlib-path "com/github/luxlang/stdlib"
+ ^:private find-compiler-path (sanitize-path "com/github/luxlang/luxc-jvm")
+ ^:private find-stdlib-path (sanitize-path "com/github/luxlang/stdlib")
)
(defn ^:private filter-deps [jar-paths]
(filter (fn [^:private path]
- (or (.contains path "org/ow2/asm/asm-all")
- (.contains path "org/clojure/core.match")
- (.contains path "org/clojure/clojure")))
+ (or (.contains path (sanitize-path "org/ow2/asm/asm-all"))
+ (.contains path (sanitize-path "org/clojure/core.match"))
+ (.contains path (sanitize-path "org/clojure/clojure"))))
jar-paths))
(defn ^:private java-command [project]
@@ -93,8 +94,8 @@
(concat deps-paths)
(list* compiler-path)
(interpose java.io.File/pathSeparator)
- (reduce str ""))
- class-path (.replace class-path "/" java.io.File/separator)]
+ (reduce str "")
+ sanitize-path)]
(str (java-command project) " -cp " class-path
" " (lux-command project <mode> source-paths))))