aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2017-10-04 22:35:33 -0400
committerEduardo Julian2017-10-04 22:35:33 -0400
commitfba66385eebd43f052b3c188dbcfa0d62b8ec377 (patch)
treeb5ca2dae59a267c4e56995b9c904259297cd7238
parent29228f5c601d8d5d42aa5352566a609bf4259d11 (diff)
- Fixed a bug wherein incorrect specification of program modules or test modules would fail silently.
Diffstat (limited to '')
-rw-r--r--lux-lein/src/leiningen/lux/builder.clj31
-rw-r--r--lux-lein/src/leiningen/lux/test.clj59
2 files changed, 50 insertions, 40 deletions
diff --git a/lux-lein/src/leiningen/lux/builder.clj b/lux-lein/src/leiningen/lux/builder.clj
index 65f45b90c..a23d05a0e 100644
--- a/lux-lein/src/leiningen/lux/builder.clj
+++ b/lux-lein/src/leiningen/lux/builder.clj
@@ -3,18 +3,23 @@
(leiningen.lux [utils :as &utils]
[packager :as &packager])))
+(def missing-module-error "Please provide a program main module in [:lux :program]")
+
(defn build [project]
(if-let [program-modules (get-in project [:lux :program])]
- (do (when-let [jvm-module (get-in program-modules [:jvm])]
- (when (&utils/run-process (&utils/compile-path project "jvm" jvm-module (get project :source-paths (list)))
- nil
- "[BUILD BEGIN]"
- "[BUILD END]")
- (&packager/package project "jvm" jvm-module (get project :resource-paths (list)))))
- (when-let [js-module (get-in program-modules [:js])]
- (when (&utils/run-process (&utils/compile-path project "js" js-module (get project :source-paths (list)))
- nil
- "[BUILD BEGIN]"
- "[BUILD END]")
- (&packager/package project "js" js-module (get project :resource-paths (list))))))
- (println "Please provide a program main module in [:lux :program]")))
+ (when (not (or (when-let [jvm-module (get-in program-modules [:jvm])]
+ (when (&utils/run-process (&utils/compile-path project "jvm" jvm-module (get project :source-paths (list)))
+ nil
+ "[BUILD BEGIN]"
+ "[BUILD END]")
+ (&packager/package project "jvm" jvm-module (get project :resource-paths (list)))
+ true))
+ (when-let [js-module (get-in program-modules [:js])]
+ (when (&utils/run-process (&utils/compile-path project "js" js-module (get project :source-paths (list)))
+ nil
+ "[BUILD BEGIN]"
+ "[BUILD END]")
+ (&packager/package project "js" js-module (get project :resource-paths (list)))
+ true))))
+ (println missing-module-error))
+ (println missing-module-error)))
diff --git a/lux-lein/src/leiningen/lux/test.clj b/lux-lein/src/leiningen/lux/test.clj
index d3755c1b6..9f673eeff 100644
--- a/lux-lein/src/leiningen/lux/test.clj
+++ b/lux-lein/src/leiningen/lux/test.clj
@@ -4,32 +4,37 @@
(leiningen.lux [utils :as &utils]
[packager :as &packager])))
+(def missing-module-error "Please provide a test module in [:lux :tests]")
+
(defn test [project]
(if-let [tests-modules (get-in project [:lux :tests])]
- (do (when-let [jvm-module (get-in tests-modules [:jvm])]
- (when (&utils/run-process (&utils/compile-path project "jvm" jvm-module (concat (:test-paths project) (:source-paths project)))
- nil
- "[BUILD BEGIN]"
- "[BUILD END]")
- (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) "/"
- (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)
- nil
- "[TEST BEGIN]"
- "[TEST END]")))))
- (when-let [js-module (get-in tests-modules [:js])]
- (when (&utils/run-process (&utils/compile-path project "js" js-module (concat (:test-paths project) (:source-paths project)))
- nil
- "[BUILD BEGIN]"
- "[BUILD END]")
- (let [output-package (str (get-in project [:lux :target] &utils/default-js-output-dir) "/"
- "program.js")]
- (do (&packager/package project "js" js-module (get project :resource-paths (list)))
- (&utils/run-process (str "node " output-package)
- nil
- "[TEST BEGIN]"
- "[TEST END]"))))))
- (println "Please provide a test module in [:lux :tests]")))
+ (when (not (or (when-let [jvm-module (get-in tests-modules [:jvm])]
+ (when (&utils/run-process (&utils/compile-path project "jvm" jvm-module (concat (:test-paths project) (:source-paths project)))
+ nil
+ "[BUILD BEGIN]"
+ "[BUILD END]")
+ (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) "/"
+ (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)
+ nil
+ "[TEST BEGIN]"
+ "[TEST END]")
+ true))))
+ (when-let [js-module (get-in tests-modules [:js])]
+ (when (&utils/run-process (&utils/compile-path project "js" js-module (concat (:test-paths project) (:source-paths project)))
+ nil
+ "[BUILD BEGIN]"
+ "[BUILD END]")
+ (let [output-package (str (get-in project [:lux :target] &utils/default-js-output-dir) "/"
+ "program.js")]
+ (do (&packager/package project "js" js-module (get project :resource-paths (list)))
+ (&utils/run-process (str "node " output-package)
+ nil
+ "[TEST BEGIN]"
+ "[TEST END]")
+ true))))))
+ (println missing-module-error))
+ (println missing-module-error)))