diff options
author | Eduardo Julian | 2021-06-27 20:09:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-06-27 20:09:48 -0400 |
commit | db3e864ae66da7f7d1034ae95967605144d5ec47 (patch) | |
tree | 29c51002455a2c8f7d4aa25ab13c688cfa8d60e3 /stdlib/source/program/aedifex/command/build.lux | |
parent | b80f79ae6b2e240949ebd709a253e21f7caf7ed3 (diff) |
Made obtaining env variables more granular + partial Lua support.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/command/build.lux | 84 |
1 files changed, 40 insertions, 44 deletions
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index e2d6f78b8..6d61475d0 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -23,7 +23,7 @@ [number ["i" int]]] [world - [program (#+ Program)] + ["." program (#+ Program)] ["." file (#+ Path)] ["." shell (#+ Process Shell)] ["." console (#+ Console)] @@ -76,7 +76,6 @@ (exception: #export no_available_compiler) (exception: #export no_specified_program) -(exception: #export no_specified_target) (type: #export Compiler (#JVM Dependency) @@ -169,45 +168,42 @@ (def: #export (do! console program fs shell resolution) (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Compiler Path])) (function (_ profile) - (case [(get@ #///.program profile) - (get@ #///.target profile)] - [#.None _] - (promise\wrap (exception.throw ..no_specified_program [])) - - [_ #.None] - (promise\wrap (exception.throw ..no_specified_target [])) - - [(#.Some program_module) (#.Some target)] - (do promise.monad - [environment (\ program environment []) - home (\ program home []) - working_directory (\ program directory [])] - (do ///action.monad - [[resolution compiler] (promise\wrap (..compiler resolution)) - #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"]) - / (\ fs separator) - cache_directory (format working_directory / target)] - _ (console.write_line ..start console) - process (!.use (\ shell execute) - [environment - working_directory - command - (list.concat (list compiler_params - (list "build") - (..plural "--library" (..libraries fs home resolution)) - (..plural "--source" (set.to_list (get@ #///.sources profile))) - (..singular "--target" cache_directory) - (..singular "--module" program_module)))]) - _ (..log_output! console process) - _ (..log_error! console process) - exit (!.use (\ process await) []) - _ (console.write_line (if (i.= shell.normal exit) - ..success - ..failure) - console)] - (wrap [compiler - (format cache_directory / output)])))))) + (let [target (get@ #///.target profile)] + (case (get@ #///.program profile) + #.None + (promise\wrap (exception.throw ..no_specified_program [])) + + (#.Some program_module) + (do promise.monad + [environment (program.environment promise.monad program) + home (\ program home []) + working_directory (\ program directory [])] + (do ///action.monad + [[resolution compiler] (promise\wrap (..compiler resolution)) + #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"]) + / (\ fs separator) + cache_directory (format working_directory / target)] + _ (console.write_line ..start console) + process (!.use (\ shell execute) + [environment + working_directory + command + (list.concat (list compiler_params + (list "build") + (..plural "--library" (..libraries fs home resolution)) + (..plural "--source" (set.to_list (get@ #///.sources profile))) + (..singular "--target" cache_directory) + (..singular "--module" program_module)))]) + _ (..log_output! console process) + _ (..log_error! console process) + exit (!.use (\ process await) []) + _ (console.write_line (if (i.= shell.normal exit) + ..success + ..failure) + console)] + (wrap [compiler + (format cache_directory / output)]))))))) |