diff options
author | Eduardo Julian | 2017-03-21 19:15:12 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-03-21 19:15:12 -0400 |
commit | ad2f9e165d2bdce646507f1aadd133b8f67ae75f (patch) | |
tree | 7d6c0e8c8f91f72665e1c20e6cfc7d163c4ce3bf | |
parent | f215258b4b1a1847c05f0339af8807f8efd20f61 (diff) |
- Can now select between JVM and JS compilation, based on command-line parameters.
-rw-r--r-- | lux-lein/src/leiningen/lux/utils.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux.clj | 8 | ||||
-rw-r--r-- | luxc/src/lux/compiler.clj | 17 |
3 files changed, 14 insertions, 13 deletions
diff --git a/lux-lein/src/leiningen/lux/utils.clj b/lux-lein/src/leiningen/lux/utils.clj index c70ec2289..a786a4d6d 100644 --- a/lux-lein/src/leiningen/lux/utils.clj +++ b/lux-lein/src/leiningen/lux/utils.clj @@ -90,7 +90,7 @@ (str (java-command project) " -cp " class-path " " (lux-command project <mode> source-paths)))) - compile-path (str "release " module) + compile-path (str "release jvm " module) repl-path "repl" ) diff --git a/luxc/src/lux.clj b/luxc/src/lux.clj index 182ddf46f..2daf0000a 100644 --- a/luxc/src/lux.clj +++ b/luxc/src/lux.clj @@ -19,11 +19,11 @@ (defn -main [& args] (|case (&/->list args) - (&/$Cons "release" (&/$Cons program-module (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil)))))) - (time (&compiler/compile-program &/$Release program-module (separate-paths resources-dirs) (separate-paths source-dirs) target-dir)) + (&/$Cons "release" (&/$Cons platform (&/$Cons program-module (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil))))))) + (time (&compiler/compile-program platform &/$Release program-module (separate-paths resources-dirs) (separate-paths source-dirs) target-dir)) - (&/$Cons "debug" (&/$Cons program-module (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil)))))) - (time (&compiler/compile-program &/$Debug program-module (separate-paths resources-dirs) (separate-paths source-dirs) target-dir)) + (&/$Cons "debug" (&/$Cons platform (&/$Cons program-module (&/$Cons resources-dirs (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil))))))) + (time (&compiler/compile-program platform &/$Debug 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 0e78fa766..bffedb69e 100644 --- a/luxc/src/lux/compiler.clj +++ b/luxc/src/lux/compiler.clj @@ -10,13 +10,14 @@ [js :as &&js] ))) -(defn init! [resources-dirs ^String target-dir] +(defn init! [platform resources-dirs ^String target-dir] (do (reset! &&core/!output-dir target-dir) (&¶llel/setup!) (&&io/init-libs!) (.mkdirs (new java.io.File target-dir)) - (&&jvm/init! resources-dirs target-dir) - ;; (&&js/init! resources-dirs target-dir) + (case platform + "jvm" (&&jvm/init! resources-dirs target-dir) + "js" (&&js/init! resources-dirs target-dir)) )) (def all-compilers @@ -28,8 +29,8 @@ (defn compile-module [source-dirs name] (&&jvm/compile-module source-dirs name)) -(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) - ;; (&&js/compile-program mode program-module resources-dir source-dirs target-dir) - ) +(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) + "js" (&&js/compile-program mode program-module resources-dir source-dirs target-dir))) |