aboutsummaryrefslogtreecommitdiff
path: root/lux-lein
diff options
context:
space:
mode:
authorEduardo Julian2019-01-01 19:51:01 -0400
committerEduardo Julian2019-01-01 19:51:01 -0400
commit81eb1c4c0047af78449ac5cc202fc7755f4944da (patch)
tree16d3d28bb55f5dd29d41cb9b01cbd0c0193e1ec3 /lux-lein
parent64dc34f43f8e4dcc4ef9fed679b2f05fb51554b2 (diff)
Updated lux-lein to properly handle Leiningen profiles.
Diffstat (limited to 'lux-lein')
-rw-r--r--lux-lein/src/leiningen/lux/packager.clj24
-rw-r--r--lux-lein/src/leiningen/lux/test.clj8
-rw-r--r--lux-lein/src/leiningen/lux/utils.clj19
3 files changed, 32 insertions, 19 deletions
diff --git a/lux-lein/src/leiningen/lux/packager.clj b/lux-lein/src/leiningen/lux/packager.clj
index 42d32fe95..52db5e5a0 100644
--- a/lux-lein/src/leiningen/lux/packager.clj
+++ b/lux-lein/src/leiningen/lux/packager.clj
@@ -131,19 +131,23 @@
[project module resources-dirs]
(do (println "[JVM PACKAGING BEGAN]")
(let [output-package-name (get project :jar-name &utils/output-package)
- output-dir (&utils/prepare-path (get-in project [:lux :target] &utils/default-jvm-output-dir))
+ output-dir (&utils/prepare-path (str (get project :target-path &utils/default-target-dir)
+ java.io.File/separator
+ &utils/default-jvm-output-dir))
output-package (str output-dir java.io.File/separator output-package-name)
!all-jar-files (atom {})
includes-android? (boolean (some #(-> % first (= 'com.google.android/android))
(get project :dependencies)))
project* (-> project
- (update-in [:dependencies] (fn [_deps]
- ;; Skip the last two,
- ;; because they are:
- ;; tools.nrepl-0.2.12.jar and
- ;; clojure-complete-0.2.4.jar
- ;; and they belong to Leiningen.
- (take (- (count _deps) 2) _deps))))
+ (update :dependencies
+ (fn [dependencies]
+ ;; tools.nrepl-0.2.12.jar and
+ ;; clojure-complete-0.2.4.jar
+ ;; belong to Leiningen.
+ (filter (fn [[dep-name dep-version & dep-extra]]
+ (not (or (= 'org.clojure/tools.nrepl dep-name)
+ (= 'clojure-complete/clojure-complete dep-name))))
+ dependencies))))
deps (->> project*
(classpath/resolve-managed-dependencies :dependencies :managed-dependencies)
(map #(.getAbsolutePath ^File %)))]
@@ -165,7 +169,9 @@
(.closeEntry)))
nil))
(when (get-in project [:lux :android])
- (let [output-dir-context (new File (get-in project [:lux :target] &utils/default-jvm-output-dir))
+ (let [output-dir-context (new File (str (get project :target-path &utils/default-target-dir)
+ java.io.File/separator
+ &utils/default-jvm-output-dir))
output-dex "classes.dex"
_ (do (.delete (new File output-dex))
(&utils/run-process (str "dx --dex --output=" output-dex " " output-package-name)
diff --git a/lux-lein/src/leiningen/lux/test.clj b/lux-lein/src/leiningen/lux/test.clj
index 49e30a7f2..4abdb8156 100644
--- a/lux-lein/src/leiningen/lux/test.clj
+++ b/lux-lein/src/leiningen/lux/test.clj
@@ -15,7 +15,9 @@
"[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 project :target-path &utils/default-target-dir)
+ java.io.File/separator
+ &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)))
@@ -29,7 +31,9 @@
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 project :target-path &utils/default-target-dir)
+ java.io.File/separator
+ &utils/default-js-output-dir
java.io.File/separator
"program.js")]
(do (&packager/package project "js" js-module (get project :resource-paths (list)))
diff --git a/lux-lein/src/leiningen/lux/utils.clj b/lux-lein/src/leiningen/lux/utils.clj
index ae5cc1b96..44ea045fc 100644
--- a/lux-lein/src/leiningen/lux/utils.clj
+++ b/lux-lein/src/leiningen/lux/utils.clj
@@ -5,8 +5,9 @@
InputStreamReader
BufferedReader)))
-(def ^:const ^String default-jvm-output-dir (str "target" java.io.File/separator "jvm"))
-(def ^:const ^String default-js-output-dir (str "target" java.io.File/separator "js"))
+(def ^:const ^String default-target-dir "target")
+(def ^:const ^String default-jvm-output-dir "jvm")
+(def ^:const ^String default-js-output-dir "js")
(def ^:const ^String output-package "program.jar")
(def ^:private unit-separator (str (char 31)))
@@ -63,14 +64,16 @@
(str "lux " mode
" " (->> (get project :resource-paths (list)) (interpose unit-separator) (apply str))
" " (->> source-paths (interpose unit-separator) (apply str))
- " " (get-in project [:lux :target] (cond (.contains mode "jvm")
- default-jvm-output-dir
+ " " (str (get project :target-path default-target-dir)
+ java.io.File/separator
+ (cond (.contains mode "jvm")
+ default-jvm-output-dir
- (.contains mode "js")
- default-js-output-dir
+ (.contains mode "js")
+ default-js-output-dir
- :else
- (assert false)))))
+ :else
+ (assert false)))))
(do-template [<name> <mode>]
(defn <name> [project platform module source-paths]