aboutsummaryrefslogtreecommitdiff
path: root/lux-lein/src/leiningen
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lux-lein/src/leiningen/lux/builder.clj28
-rw-r--r--lux-lein/src/leiningen/lux/packager.clj15
-rw-r--r--lux-lein/src/leiningen/lux/test.clj56
-rw-r--r--lux-lein/src/leiningen/lux/utils.clj17
4 files changed, 32 insertions, 84 deletions
diff --git a/lux-lein/src/leiningen/lux/builder.clj b/lux-lein/src/leiningen/lux/builder.clj
index fe7c09750..eeb1cead7 100644
--- a/lux-lein/src/leiningen/lux/builder.clj
+++ b/lux-lein/src/leiningen/lux/builder.clj
@@ -1,27 +1,15 @@
(ns leiningen.lux.builder
- (:require [leiningen.core.classpath :as classpath]
- (leiningen.lux [utils :as &utils]
+ (:require (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
- "[JVM COMPILATION BEGAN]"
- "[JVM COMPILATION ENDED]")
- (&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
- "[JS COMPILATION BEGAN]"
- "[JS COMPILATION ENDED]")
- (&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)))
+ (if-let [program-module (get-in project [:lux :program])]
+ (when (&utils/run-process (&utils/compile-path project program-module (get project :source-paths (list)))
+ nil
+ "[COMPILATION BEGAN]"
+ "[COMPILATION ENDED]")
+ (&packager/package project program-module (get project :resource-paths (list)))
+ true)
(println missing-module-error)))
diff --git a/lux-lein/src/leiningen/lux/packager.clj b/lux-lein/src/leiningen/lux/packager.clj
index 28c4f5497..73d672b75 100644
--- a/lux-lein/src/leiningen/lux/packager.clj
+++ b/lux-lein/src/leiningen/lux/packager.clj
@@ -134,9 +134,7 @@
[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 (str (get project :target-path &utils/default-target-dir)
- java.io.File/separator
- &utils/default-jvm-output-dir))
+ output-dir (&utils/prepare-path (get project :target-path &utils/default-target-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))
@@ -172,9 +170,7 @@
(.closeEntry)))
nil))
(when (get-in project [:lux :android])
- (let [output-dir-context (new File (str (get project :target-path &utils/default-target-dir)
- java.io.File/separator
- &utils/default-jvm-output-dir))
+ (let [output-dir-context (new File (get project :target-path &utils/default-target-dir))
output-dex "classes.dex"
_ (do (.delete (new File output-dex))
(&utils/run-process (str "dx --dex --output=" output-dex " " output-package-name)
@@ -225,8 +221,5 @@
(defn package
"(-> Text Text (List Text) Null)"
- [project platform module resources-dirs]
- (time
- (case platform
- "jvm" (package-jvm project module resources-dirs)
- "js" nil)))
+ [project module resources-dirs]
+ (time (package-jvm project module resources-dirs)))
diff --git a/lux-lein/src/leiningen/lux/test.clj b/lux-lein/src/leiningen/lux/test.clj
index 4abdb8156..3ecfcbe6e 100644
--- a/lux-lein/src/leiningen/lux/test.clj
+++ b/lux-lein/src/leiningen/lux/test.clj
@@ -4,45 +4,23 @@
(leiningen.lux [utils :as &utils]
[packager :as &packager])))
-(def missing-module-error "Please provide a test module in [:lux :tests]")
+(def missing-module-error "Please provide a test module in [:lux :test]")
(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
- "[JVM COMPILATION BEGAN]"
- "[JVM COMPILATION ENDED]")
- (let [java-cmd (get project :java-cmd "java")
- jvm-opts (->> (get project :jvm-opts) (interpose " ") (reduce str ""))
- 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)))
- (&utils/run-process (str java-cmd " " jvm-opts " -jar " output-package)
- nil
- "[JVM TESTING BEGAN]"
- "[JVM TESTING ENDED]")
- 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
- "[JS COMPILATION BEGAN]"
- "[JS COMPILATION ENDED]")
- (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)))
- (&utils/run-process (str "node " output-package)
- nil
- "[JS TESTING BEGAN]"
- "[JS TESTING ENDED]")
- true))))
- (when (not (or (get-in tests-modules [:jvm])
- (get-in tests-modules [:js])))
- (println missing-module-error)))
+ (if-let [test-module (get-in project [:lux :test])]
+ (when (&utils/run-process (&utils/compile-path project test-module (concat (:test-paths project) (:source-paths project)))
+ nil
+ "[COMPILATION BEGAN]"
+ "[COMPILATION ENDED]")
+ (let [java-cmd (get project :java-cmd "java")
+ jvm-opts (->> (get project :jvm-opts) (interpose " ") (reduce str ""))
+ output-package (str (get project :target-path &utils/default-target-dir)
+ java.io.File/separator
+ (get project :jar-name &utils/output-package))]
+ (do (&packager/package project test-module (get project :resource-paths (list)))
+ (&utils/run-process (str java-cmd " " jvm-opts " -jar " output-package)
+ nil
+ "[TESTING BEGAN]"
+ "[TESTING ENDED]")
+ true)))
(println missing-module-error)))
diff --git a/lux-lein/src/leiningen/lux/utils.clj b/lux-lein/src/leiningen/lux/utils.clj
index 44ea045fc..008f6cd3b 100644
--- a/lux-lein/src/leiningen/lux/utils.clj
+++ b/lux-lein/src/leiningen/lux/utils.clj
@@ -6,8 +6,6 @@
BufferedReader)))
(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)))
@@ -64,19 +62,10 @@
(str "lux " mode
" " (->> (get project :resource-paths (list)) (interpose unit-separator) (apply str))
" " (->> source-paths (interpose unit-separator) (apply str))
- " " (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
-
- :else
- (assert false)))))
+ " " (get project :target-path default-target-dir)))
(do-template [<name> <mode>]
- (defn <name> [project platform module source-paths]
+ (defn <name> [project module source-paths]
(let [is-stdlib? (= stdlib-id [(get project :group) (get project :name)])
jar-paths (all-jars-in-classloader)
compiler-path (prepare-path (find-compiler-path jar-paths))
@@ -102,7 +91,7 @@
(str (java-command project) " -cp " class-path
" " (lux-command project <mode> source-paths))))
- compile-path (str "release " platform " " module)
+ compile-path (str "release " module)
repl-path "repl"
)