diff options
-rw-r--r-- | lux-js/project.clj | 2 | ||||
-rw-r--r-- | lux-lein/src/leiningen/lux/builder.clj | 28 | ||||
-rw-r--r-- | lux-lein/src/leiningen/lux/packager.clj | 15 | ||||
-rw-r--r-- | lux-lein/src/leiningen/lux/test.clj | 56 | ||||
-rw-r--r-- | lux-lein/src/leiningen/lux/utils.clj | 17 | ||||
-rw-r--r-- | luxc/src/lux.clj | 6 | ||||
-rw-r--r-- | luxc/src/lux/compiler.clj | 12 | ||||
-rw-r--r-- | new-luxc/project.clj | 4 | ||||
-rw-r--r-- | stdlib/project.clj | 8 |
9 files changed, 47 insertions, 101 deletions
diff --git a/lux-js/project.clj b/lux-js/project.clj index 08fedd516..d9b07cf43 100644 --- a/lux-js/project.clj +++ b/lux-js/project.clj @@ -24,5 +24,5 @@ [com.github.luxlang/stdlib ~version]] :source-paths ["source"] - :lux {:program {:jvm "program"}} + :lux {:program "program"} ) 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" ) diff --git a/luxc/src/lux.clj b/luxc/src/lux.clj index fc39b7b3b..3dbc819a1 100644 --- a/luxc/src/lux.clj +++ b/luxc/src/lux.clj @@ -9,7 +9,7 @@ (def unit-separator (str (char 31))) -(defn ^:private separate-paths +(defn- separate-paths "(-> Text (List Text))" [resources-dirs] (-> resources-dirs @@ -19,8 +19,8 @@ (defn -main [& args] (|case (&/->list args) - (&/$Cons "release" (&/$Cons platform (&/$Cons program-module (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil))))))) - (time (&compiler/compile-program platform &/$Build program-module (separate-paths resources-dirs) (separate-paths source-dirs) target-dir)) + (&/$Cons "release" (&/$Cons program-module (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil)))))) + (time (&compiler/compile-program &/$Build program-module (separate-paths resources-dirs) (separate-paths source-dirs) target-dir)) (&/$Cons "repl" (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil))))) (&repl/repl (separate-paths resources-dirs) diff --git a/luxc/src/lux/compiler.clj b/luxc/src/lux/compiler.clj index 55b801745..5fc77ce6c 100644 --- a/luxc/src/lux/compiler.clj +++ b/luxc/src/lux/compiler.clj @@ -8,13 +8,12 @@ [parallel :as &¶llel] [jvm :as &&jvm]))) -(defn init! [platform resources-dirs ^String target-dir] +(defn init! [resources-dirs ^String target-dir] (do (reset! &&core/!output-dir target-dir) (&¶llel/setup!) (&&io/init-libs!) (.mkdirs (new java.io.File target-dir)) - (case platform - "jvm" (&&jvm/init! resources-dirs target-dir)))) + (&&jvm/init! resources-dirs target-dir))) (def all-compilers &&jvm/all-compilers) @@ -25,7 +24,6 @@ (defn compile-module [source-dirs name] (&&jvm/compile-module source-dirs name)) -(defn compile-program [platform mode program-module resources-dir source-dirs target-dir] - (init! platform resources-dir target-dir) - (case platform - "jvm" (&&jvm/compile-program mode program-module resources-dir source-dirs target-dir))) +(defn compile-program [mode program-module resources-dir source-dirs target-dir] + (init! resources-dir target-dir) + (&&jvm/compile-program mode program-module resources-dir source-dirs target-dir)) diff --git a/new-luxc/project.clj b/new-luxc/project.clj index a6f3510f2..182673452 100644 --- a/new-luxc/project.clj +++ b/new-luxc/project.clj @@ -42,6 +42,6 @@ :source-paths ["source"] :test-paths ["test"] - :lux {:program {:jvm "program"} - :tests {:jvm "tests"}} + :lux {:program "program" + :test "tests"} ) diff --git a/stdlib/project.clj b/stdlib/project.clj index 97d1e2901..531076743 100644 --- a/stdlib/project.clj +++ b/stdlib/project.clj @@ -21,12 +21,12 @@ :source-paths ["source"] :profiles {:bibliotheca {:description "Standard library for the Lux programming language." :dependencies [] - :lux {:tests {:jvm "test/lux"}}} + :lux {:test "test/lux"}} :scriptum {:description "A documentation generator for Lux code." :dependencies [] - :lux {:program {:jvm "program/scriptum"}}} + :lux {:program "program/scriptum"}} :licentia {:description "A program for producing free/open-source/reciprocal licenses." :dependencies [] - :lux {:program {:jvm "program/licentia"} - :tests {:jvm "test/licentia"}}}} + :lux {:program "program/licentia" + :test "test/licentia"}}} ) |