diff options
author | Eduardo Julian | 2022-07-09 14:35:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-07-09 14:35:38 -0400 |
commit | 7db42ab1b9d3c764772ca63c74bf44bb2b8b8325 (patch) | |
tree | bd1c865dea0902790f3e462cec4f9bc8d8ae428f /stdlib/source/program/aedifex/command | |
parent | fc2737b5226eda69c12bc593e83e22ed54e4d3af (diff) |
First-class programs instead of having a "lux program" extension.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/command/auto.lux | 10 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/build.lux | 21 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/deploy.lux | 8 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/deploy/release.lux | 23 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/deploy/snapshot.lux | 7 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/deps.lux | 1 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/install.lux | 1 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/test.lux | 16 |
8 files changed, 45 insertions, 42 deletions
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index 15d78527b..4e4871f52 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -12,7 +12,7 @@ ["[0]" list] ["[0]" set]]] [world - [program (.only Program)] + [environment (.only Environment)] [shell (.only Exit Shell)] [console (.only Console)] ["[0]" file (.only) @@ -46,11 +46,11 @@ (def .public (do! delay watcher command) (All (_ a) (-> Nat (Watcher Async) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])))) - (function (_ console program fs shell resolution) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit a])) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])))) + (function (_ console environment fs shell resolution) (function (_ profile) - (with_expansions [<call> ((command console program fs shell resolution) profile)] + (with_expansions [<call> ((command console environment fs shell resolution) profile)] (do [! async.monad] [targets (|> profile (the ///.#sources) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 9eae7660d..190ec3802 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -16,7 +16,7 @@ ["[0]" text (.use "[1]#[0]" order) ["%" \\format (.only format)]] [collection - ["[0]" list (.use "[1]#[0]" functor mix)] + ["[0]" list (.use "[1]#[0]" functor mix monoid)] ["[0]" dictionary (.only Dictionary)] ["[0]" set]]] [math @@ -34,7 +34,7 @@ ["[0]" packager (.only) ["[0]_[1]" ruby]]]]] [world - ["[0]" program (.only Program)] + ["[0]" environment (.only Environment)] ["[0]" file (.only Path)] ["[0]" shell (.only Exit Process Shell)] ["[0]" console (.only Console)] @@ -275,19 +275,19 @@ "--add-opens" "java.base/java.lang=ALL-UNNAMED")) runtime))) -(def .public (do! console program fs shell resolution) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Lux Path])) +(def .public (do! console environment fs shell resolution) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Lux Path])) (function (_ profile) (let [target (the ///.#target profile)] (case (the ///.#program profile) {.#None} (async#in (exception.except ..no_specified_program [])) - {.#Some program_module} + {.#Some [program_module program_definition]} (do async.monad - [environment (program.environment async.monad program) - .let [home (at program home) - working_directory (at program directory)]] + [.let [home (at environment home) + working_directory (at environment directory)] + environment (environment.environment async.monad environment)] (do ///action.monad [[resolution lux] (async#in (..lux resolution (the ///.#lux profile))) .let [host_dependencies (..host_dependencies fs home resolution) @@ -320,7 +320,10 @@ (..plural "--compiler" (list#each compiler.format (the ///.#compilers profile))) (..plural "--source" (set.list (the ///.#sources profile))) (..singular "--target" cache_directory) - (..singular "--module" program_module) + (case program_module + "" (..singular "--module" program_definition) + _ (list#composite (..singular "--module" program_module) + (..singular "--program" program_definition))) (..singular "--configuration" (configuration.format (the ///.#configuration profile)))))] process (at shell execute [(dictionary.composite environment command_environment) working_directory diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index c579f165a..c4dfe7c7d 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -8,7 +8,7 @@ [concurrency [async (.only Async)]]] [world - [program (.only Program)] + [environment (.only Environment)] [shell (.only Shell)] ["[0]" file] ["[0]" console (.only Console)]]]] @@ -26,11 +26,11 @@ (def .public success "Successfully deployed the project.") -(def .public (do! program shell console local remote fs artifact profile) - (-> (Program Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) +(def .public (do! environment shell console local remote fs artifact profile) + (-> (Environment Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) (do [! ///action.monad] [_ (if (/snapshot.snapshot? artifact) (/snapshot.do! console remote fs artifact profile) - (/release.do! program shell console local remote fs artifact profile))] + (/release.do! environment shell console local remote fs artifact profile))] (is (Async (Try Any)) (console.write_line ..success console)))) diff --git a/stdlib/source/program/aedifex/command/deploy/release.lux b/stdlib/source/program/aedifex/command/deploy/release.lux index e30c115d2..d7394d7a3 100644 --- a/stdlib/source/program/aedifex/command/deploy/release.lux +++ b/stdlib/source/program/aedifex/command/deploy/release.lux @@ -3,7 +3,6 @@ [lux (.except) ["[0]" ffi (.only import)] [abstract - [predicate (.only Predicate)] ["[0]" monad (.only do)]] [control ["[0]" pipe] @@ -11,8 +10,8 @@ ["[0]" io (.only IO)] [concurrency ["[0]" async (.only Async)]] - [parser - ["[0]" environment]]] + [function + [predicate (.only Predicate)]]] [data [binary (.only Binary)] ["[0]" text (.only) @@ -34,7 +33,9 @@ ["[0]" packager ["[1]" jvm]]]]] [world - [program (.only Program)] + ["[0]" environment + [/ (.only Environment)] + ["[1]" \\parser]] [console (.only Console)] ["[0]" shell (.only Shell)] ["[0]" file]]]] @@ -112,8 +113,8 @@ (Predicate Artifact) (|>> //snapshot.snapshot? not)) -(def (install_dummies! program local fs artifact) - (-> (Program Async) (Repository Async) (file.System Async) Artifact (Async (Try Any))) +(def (install_dummies! environment local fs artifact) + (-> (Environment Async) (Repository Async) (file.System Async) Artifact (Async (Try Any))) (do (try.with async.monad) [.let [$artifact (////artifact.uri (the ////artifact.#version artifact) artifact)] _ (at local upload (..jar $artifact) ..dummy_jar) @@ -144,13 +145,13 @@ _ (..release_unsigned_artifact! local remote signature)] (in []))) -(def .public (do! program shell console local remote fs artifact profile) - (-> (Program Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) +(def .public (do! environment shell console local remote fs artifact profile) + (-> (Environment Async) (Shell Async) (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any)) (do [! ////action.monad] [_ (///install.do! console fs local profile) - _ (install_dummies! program local fs artifact) - .let [working_directory (at program directory) - @root (////repository/local.root program fs) + _ (install_dummies! environment local fs artifact) + .let [working_directory (at environment directory) + @root (////repository/local.root environment fs) $bundle (////artifact.bundle (the ////artifact.#version artifact) artifact) / (at fs separator) @local (%.format @root / $bundle)] diff --git a/stdlib/source/program/aedifex/command/deploy/snapshot.lux b/stdlib/source/program/aedifex/command/deploy/snapshot.lux index eec503275..bd253bfcd 100644 --- a/stdlib/source/program/aedifex/command/deploy/snapshot.lux +++ b/stdlib/source/program/aedifex/command/deploy/snapshot.lux @@ -2,15 +2,16 @@ [library [lux (.except) [abstract - [monad (.only do)] - [predicate (.only Predicate)]] + [monad (.only do)]] [control + [function + [predicate (.only Predicate)]] [concurrency ["[0]" async (.only Async)]]] [data ["[0]" binary ["[1]" \\format]] - ["[0]" text + ["[0]" text (.only) [encoding ["[0]" utf8]]] [collection diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index 4ffc6e641..4ec5693f0 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -16,7 +16,6 @@ ["%" \\format]]] [world [net (.only URL)] - [program (.only Program)] ["[0]" file] ["[0]" console (.only Console)]]]] ["[0]" // diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index 2bd647a44..67739203a 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -25,7 +25,6 @@ [meta ["[0]" export]]]] [world - [program (.only Program)] ["[0]" file] ["[0]" console (.only Console)]]]] ["[0]" // diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 7acc3e8c9..16a2694d4 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -17,7 +17,7 @@ [macro ["^" pattern]]] [world - ["[0]" program (.only Program)] + ["[0]" environment (.only Environment)] ["[0]" file] ["[0]" shell (.only Exit Shell)] ["[0]" console (.only Console)]]]] @@ -35,14 +35,14 @@ (def .public success "[TEST ENDED]") (def .public failure "[TEST FAILED]") -(def .public (do! console program fs shell resolution profile) - (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])) +(def .public (do! console environment fs shell resolution profile) + (-> (Console Async) (Environment Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])) (do async.monad - [environment (program.environment async.monad program) - .let [working_directory (at program directory)]] + [.let [home (at environment home) + working_directory (at environment directory)] + environment_vars (environment.environment async.monad environment)] (do [! ///action.monad] - [.let [home (at program home)] - [build_exit compiler program] (//build.do! console program fs shell resolution + [[build_exit compiler program] (//build.do! console environment fs shell resolution (has ///.#program (the ///.#test profile) profile))] (if (i.= shell.normal build_exit) (do ! @@ -63,7 +63,7 @@ [//build.#Python ///.#python] [//build.#Lua ///.#lua] [//build.#Ruby ///.#ruby]))] - process (at shell execute [(dictionary.composite environment command_environment) + process (at shell execute [(dictionary.composite environment_vars command_environment) working_directory test_command test_parameters]) |