aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
authorEduardo Julian2017-03-21 19:15:12 -0400
committerEduardo Julian2017-03-21 19:15:12 -0400
commitad2f9e165d2bdce646507f1aadd133b8f67ae75f (patch)
tree7d6c0e8c8f91f72665e1c20e6cfc7d163c4ce3bf /luxc
parentf215258b4b1a1847c05f0339af8807f8efd20f61 (diff)
- Can now select between JVM and JS compilation, based on command-line parameters.
Diffstat (limited to 'luxc')
-rw-r--r--luxc/src/lux.clj8
-rw-r--r--luxc/src/lux/compiler.clj17
2 files changed, 13 insertions, 12 deletions
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)
(&&parallel/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)))