From 86df87512966e8038d70624ab654262ce14a915c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 12 Jul 2021 00:03:36 -0400 Subject: Better syntax for parallel-hierarchy imports. --- stdlib/source/program/aedifex/artifact/type.lux | 1 + stdlib/source/program/aedifex/command/build.lux | 80 ++++++++++++++----------- stdlib/source/program/aedifex/command/test.lux | 10 +++- stdlib/source/program/aedifex/runtime.lux | 3 + 4 files changed, 57 insertions(+), 37 deletions(-) (limited to 'stdlib/source/program/aedifex') 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 [ ] - [(def: - Finder - (..dependency_finder ..lux_group ))] - - [jvm_compiler ..jvm_compiler_name] - [js_compiler ..js_compiler_name] +(template [ ] + [(def: #export + Name + )] + + ["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 [ ] + [(^ (static )) + (#try.Success [(..remove_dependency dependency resolution) + ( 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 [ ] + [( dependency) + [( (..path fs home dependency)) + ]]) + ([#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 [ ] + [( artifact) + ( 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" []] ) -- cgit v1.2.3