diff options
author | Eduardo Julian | 2020-12-10 07:28:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-10 07:28:48 -0400 |
commit | d747aada2d6df6538d0a88d70169f3757aef50af (patch) | |
tree | c26b4350cfa8a256814bb9805525325842bd5ab3 /stdlib/source/program/aedifex/command | |
parent | 14287585025b2d8fff1991691def9e643b039ac8 (diff) |
Updated Lux license to v0.1.1.
Diffstat (limited to 'stdlib/source/program/aedifex/command')
-rw-r--r-- | stdlib/source/program/aedifex/command/auto.lux | 13 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/build.lux | 71 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/test.lux | 45 |
3 files changed, 63 insertions, 66 deletions
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index a2f2b1ff5..4b151861b 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -7,14 +7,13 @@ [concurrency ["." promise (#+ Promise)]] [security - ["!" capability]] - [parser - [environment (#+ Environment)]]] + ["!" capability]]] [data [collection ["." list] ["." set]]] [world + [program (#+ Program)] [shell (#+ Shell)] ["." console (#+ Console)] ["." file (#+ Path) @@ -50,11 +49,11 @@ (def: #export (do! watcher command) (All [a] (-> (Watcher Promise) - (-> (Console Promise) Environment (file.System Promise) (Shell Promise) Resolution (Command a)) - (-> (Console Promise) Environment (file.System Promise) (Shell Promise) Resolution (Command Any)))) - (function (_ console environment fs shell resolution) + (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command a)) + (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command Any)))) + (function (_ console program fs shell resolution) (function (_ profile) - (with-expansions [<call> ((command console environment fs shell resolution) profile)] + (with-expansions [<call> ((command console program fs shell resolution) profile)] (do {! promise.monad} [targets (|> profile (get@ #///.sources) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 78e38a6c5..8960d9c75 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -9,9 +9,7 @@ [concurrency ["." promise (#+ Promise) ("#\." monad)]] [security - ["!" capability]] - [parser - [environment (#+ Environment)]]] + ["!" capability]]] [data ["." product] ["." maybe] @@ -24,6 +22,7 @@ [number ["i" int]]] [world + [program (#+ Program)] ["." file (#+ Path)] ["." shell (#+ Shell)] ["." console (#+ Console)]]] @@ -108,10 +107,6 @@ (list.filter (|>> (get@ #///dependency.type) (text\= ///artifact/type.lux-library))) (list\map (|>> (get@ #///dependency.artifact) (///local.path fs))))) -(def: #export working-directory - (-> Environment (Try Text)) - (|>> (dictionary.get "user.dir") try.from-maybe)) - (def: (singular name) (-> Text Text (List Text)) (|>> (list name))) @@ -124,8 +119,8 @@ (def: #export success "[BUILD ENDED]") (def: #export failure "[BUILD FAILED]") -(def: #export (do! console environment fs shell resolution profile) - (-> (Console Promise) Environment (file.System Promise) (Shell Promise) Resolution (Command [Compiler Path])) +(def: #export (do! console program fs shell resolution profile) + (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command [Compiler Path])) (case [(get@ #///.program profile) (get@ #///.target profile)] [#.None _] @@ -134,31 +129,33 @@ [_ #.None] (promise\wrap (exception.throw ..no-specified-target [])) - [(#.Some program) (#.Some target)] - (do ///action.monad - [[resolution compiler] (promise\wrap (..compiler resolution)) - working-directory (promise\wrap (..working-directory environment)) - #let [[command output] (let [[compiler output] (case compiler - (#JVM artifact) [(///runtime.java (///local.path fs artifact)) - "program.jar"] - (#JS artifact) [(///runtime.node (///local.path fs artifact)) - "program.js"])] - [(format compiler " build") output]) - / (\ fs separator) - cache-directory (format working-directory / target)] - _ (console.write-line ..start console) - process (!.use (\ shell execute) - [environment - working-directory - command - (list.concat (list (..plural "--library" (..libraries fs resolution)) - (..plural "--source" (set.to-list (get@ #///.sources profile))) - (..singular "--target" cache-directory) - (..singular "--module" program)))]) - exit (!.use (\ process await) []) - _ (console.write-line (if (i.= shell.normal exit) - ..success - ..failure) - console)] - (wrap [compiler - (format cache-directory / output)])))) + [(#.Some program-module) (#.Some target)] + (do promise.monad + [environment (\ program environment []) + working-directory (\ program directory [])] + (do ///action.monad + [[resolution compiler] (promise\wrap (..compiler resolution)) + #let [[command output] (let [[compiler output] (case compiler + (#JVM artifact) [(///runtime.java (///local.path fs artifact)) + "program.jar"] + (#JS artifact) [(///runtime.node (///local.path fs artifact)) + "program.js"])] + [(format compiler " build") output]) + / (\ fs separator) + cache-directory (format working-directory / target)] + _ (console.write-line ..start console) + process (!.use (\ shell execute) + [environment + working-directory + command + (list.concat (list (..plural "--library" (..libraries fs resolution)) + (..plural "--source" (set.to-list (get@ #///.sources profile))) + (..singular "--target" cache-directory) + (..singular "--module" program-module)))]) + exit (!.use (\ process await) []) + _ (console.write-line (if (i.= shell.normal exit) + ..success + ..failure) + console)] + (wrap [compiler + (format cache-directory / output)]))))) diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 3b5afaabf..089417b94 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -6,15 +6,14 @@ [concurrency ["." promise (#+ Promise) ("#\." monad)]] [security - ["!" capability]] - [parser - [environment (#+ Environment)]]] + ["!" capability]]] [data [text ["%" format (#+ format)]] [number ["i" int]]] [world + [program (#+ Program)] ["." file] ["." shell (#+ Shell)] ["." console (#+ Console)]]] @@ -31,22 +30,24 @@ (def: #export success "[TEST ENDED]") (def: #export failure "[TEST FAILED]") -(def: #export (do! console environment fs shell resolution profile) - (-> (Console Promise) Environment (file.System Promise) (Shell Promise) Resolution (Command Any)) - (do ///action.monad - [[compiler program] (//build.do! console environment fs shell resolution profile) - working-directory (promise\wrap (//build.working-directory environment)) - _ (console.write-line ..start console) - process (!.use (\ shell execute) - [environment - working-directory - (case compiler - (#//build.JVM artifact) (///runtime.java program) - (#//build.JS artifact) (///runtime.node program)) - (list)]) - exit (!.use (\ process await) []) - _ (console.write-line (if (i.= shell.normal exit) - ..success - ..failure) - console)] - (wrap []))) +(def: #export (do! console program fs shell resolution profile) + (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command Any)) + (do promise.monad + [environment (\ program environment []) + working-directory (\ program directory [])] + (do ///action.monad + [[compiler program] (//build.do! console program fs shell resolution profile) + _ (console.write-line ..start console) + process (!.use (\ shell execute) + [environment + working-directory + (case compiler + (#//build.JVM artifact) (///runtime.java program) + (#//build.JS artifact) (///runtime.node program)) + (list)]) + exit (!.use (\ process await) []) + _ (console.write-line (if (i.= shell.normal exit) + ..success + ..failure) + console)] + (wrap [])))) |