From db3e864ae66da7f7d1034ae95967605144d5ec47 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 27 Jun 2021 20:09:48 -0400 Subject: Made obtaining env variables more granular + partial Lua support. --- stdlib/source/program/aedifex/command/build.lux | 84 ++++++++++++------------- 1 file changed, 40 insertions(+), 44 deletions(-) (limited to 'stdlib/source/program/aedifex/command/build.lux') 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)]))))))) -- cgit v1.2.3