From ece2c0ba374fdc05976e3f164517a11fb75b427f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 4 Oct 2017 23:41:51 -0400 Subject: - Fixed a bug when showing the error message for missing modules during build/test. --- lux-lein/src/leiningen/lux/builder.clj | 32 +++++++++--------- lux-lein/src/leiningen/lux/test.clj | 60 ++++++++++++++++++---------------- 2 files changed, 48 insertions(+), 44 deletions(-) (limited to 'lux-lein') diff --git a/lux-lein/src/leiningen/lux/builder.clj b/lux-lein/src/leiningen/lux/builder.clj index a23d05a0e..3600ffda7 100644 --- a/lux-lein/src/leiningen/lux/builder.clj +++ b/lux-lein/src/leiningen/lux/builder.clj @@ -7,19 +7,21 @@ (defn build [project] (if-let [program-modules (get-in project [: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)) + (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))) + 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)) + (when (not (or (get-in program-modules [:jvm]) + (get-in program-modules [:js]))) + (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 9f673eeff..2164db5d8 100644 --- a/lux-lein/src/leiningen/lux/test.clj +++ b/lux-lein/src/leiningen/lux/test.clj @@ -8,33 +8,35 @@ (defn test [project] (if-let [tests-modules (get-in project [: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)) + (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]") + 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)))) + (when (not (or (get-in tests-modules [:jvm]) + (get-in tests-modules [:js]))) + (println missing-module-error))) (println missing-module-error))) -- cgit v1.2.3