diff options
Diffstat (limited to 'stdlib/source/program')
-rw-r--r-- | stdlib/source/program/aedifex/artifact/type.lux | 1 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/build.lux | 80 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/test.lux | 10 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/runtime.lux | 3 |
4 files changed, 57 insertions, 37 deletions
diff --git a/stdlib/source/program/aedifex/artifact/type.lux b/stdlib/source/program/aedifex/artifact/type.lux index 5c9ba8bb2..cbf0a35ed 100644 --- a/stdlib/source/program/aedifex/artifact/type.lux +++ b/stdlib/source/program/aedifex/artifact/type.lux @@ -12,6 +12,7 @@ ["tar" lux_library] ["jar" jvm_library] + ["js" js_library] ["pom" pom] ["sha1" sha-1] ["md5" md5] diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index ea2637d54..2f603dbc1 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -55,21 +55,16 @@ Group "com.github.luxlang") -(def: #export jvm_compiler_name - Name - "lux-jvm") - -(def: #export js_compiler_name - Name - "lux-js") - -(template [<finder> <name>] - [(def: <finder> - Finder - (..dependency_finder ..lux_group <name>))] - - [jvm_compiler ..jvm_compiler_name] - [js_compiler ..js_compiler_name] +(template [<dependency> <definition>] + [(def: #export <definition> + Name + <dependency>)] + + ["lux-jvm" jvm_compiler_name] + ["lux-js" js_compiler_name] + ["lux-python" python_compiler_name] + ["lux-lua" lua_compiler_name] + ["lux-ruby" ruby_compiler_name] ) (exception: #export no_available_compiler) @@ -77,7 +72,10 @@ (type: #export Compiler (#JVM Dependency) - (#JS Dependency)) + (#JS Dependency) + (#Python Dependency) + (#Lua Dependency) + (#Ruby Dependency)) (def: (remove_dependency dependency) (-> Dependency (-> Resolution Resolution)) @@ -85,20 +83,27 @@ (list.filter (|>> product.left (is? dependency) not)) (dictionary.from_list ///dependency.hash))) -(def: (compiler resolution) - (-> Resolution (Try [Resolution Compiler])) - (case [(..jvm_compiler resolution) - (..js_compiler resolution)] - [(#.Some dependency) _] - (#try.Success [(..remove_dependency dependency resolution) - (#JVM dependency)]) - - [_ (#.Some dependency)] - (#try.Success [(..remove_dependency dependency resolution) - (#JS dependency)]) - - _ - (exception.throw ..no_available_compiler []))) +(def: (compiler resolution compiler_dependency) + (-> Resolution Dependency (Try [Resolution Compiler])) + (let [[[compiler_group compiler_name compiler_version] compiler_type] compiler_dependency] + (case (..dependency_finder compiler_group compiler_name resolution) + (#.Some dependency) + (case compiler_name + (^template [<tag> <name>] + [(^ (static <name>)) + (#try.Success [(..remove_dependency dependency resolution) + (<tag> dependency)])]) + ([#JVM ..jvm_compiler_name] + [#JS ..js_compiler_name] + [#Python ..python_compiler_name] + [#Lua ..lua_compiler_name] + [#Ruby ..ruby_compiler_name]) + + _ + (exception.throw ..no_available_compiler [])) + + _ + (exception.throw ..no_available_compiler [])))) (def: (path fs home dependency) (All [!] (-> (file.System !) Path Dependency Path)) @@ -177,12 +182,17 @@ #let [home (\ program home) working_directory (\ program directory)]] (do ///action.monad - [[resolution compiler] (promise\wrap (..compiler resolution)) + [[resolution compiler] (promise\wrap (..compiler resolution (get@ #///.compiler profile))) #let [[[command compiler_params] output] (case compiler - (#JVM dependency) [(///runtime.java (..path fs home dependency)) - "program.jar"] - (#JS dependency) [(///runtime.node (..path fs home dependency)) - "program.js"]) + (^template [<tag> <runtime> <program>] + [(<tag> dependency) + [(<runtime> (..path fs home dependency)) + <program>]]) + ([#JVM ///runtime.java "program.jar"] + [#JS ///runtime.node "program.js"] + [#Python ///runtime.java "program.py"] + [#Lua ///runtime.java "program.lua"] + [#Ruby ///runtime.java "program.rb"])) / (\ fs separator) cache_directory (format working_directory / target)] _ (console.write_line ..start console) diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 9ac6b9c10..0ccc0cfb2 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -40,8 +40,14 @@ (set@ #///.program (get@ #///.test profile) profile)) _ (console.write_line ..start console) #let [[compiler_command compiler_parameters] (case compiler - (#//build.JVM artifact) (///runtime.java program) - (#//build.JS artifact) (///runtime.node program))] + (^template [<tag> <runtime>] + [(<tag> artifact) + (<runtime> program)]) + ([#//build.JVM ///runtime.java] + [#//build.JS ///runtime.node] + [#//build.Python ///runtime.python] + [#//build.Lua ///runtime.lua] + [#//build.Ruby ///runtime.ruby]))] process (\ shell execute [environment working_directory compiler_command diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index 42b1c315a..e3f5a4e92 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -16,4 +16,7 @@ [java "java" ["-jar"]] [node "node" ["--stack_size=8192"]] + [python "python3" []] + [lua "lua" []] + [ruby "RUBY_THREAD_VM_STACK_SIZE=15700000 ruby" []] ) |