diff options
Diffstat (limited to 'stdlib/source/program/aedifex')
22 files changed, 102 insertions, 94 deletions
diff --git a/stdlib/source/program/aedifex/artifact/snapshot/time.lux b/stdlib/source/program/aedifex/artifact/snapshot/time.lux index b4fb82186..9d9492965 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/time.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/time.lux @@ -17,7 +17,7 @@ [time ["[0]" instant (.only Instant)]]]]] ["[0]" /// - ["[1][0]" time + ["[1][0]" time (.only) ["[1]/[0]" date] ["[1]/[0]" time]]]) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux index 3ab65cab4..7bf1b9e3e 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux @@ -8,7 +8,7 @@ ["<>" parser]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["<[1]>" \\parser]] [format ["[0]" xml (.only XML) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux index 534283b7f..54d190c44 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux @@ -5,7 +5,7 @@ [equivalence (.only Equivalence)]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["%" \\format]]]]] ["[0]" /// (.only Snapshot) ["[1][0]" time] diff --git a/stdlib/source/program/aedifex/artifact/time/time.lux b/stdlib/source/program/aedifex/artifact/time/time.lux index 01e2c85cb..f093c7577 100644 --- a/stdlib/source/program/aedifex/artifact/time/time.lux +++ b/stdlib/source/program/aedifex/artifact/time/time.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except) - ["[0]" time] [abstract [monad (.only do)]] [control @@ -12,7 +11,9 @@ ["<[1]>" \\parser (.only Parser)]]] [math [number - ["n" nat]]]]] + ["n" nat]]] + [world + ["[0]" time]]]] ["[0]" // ["[1]" date]]) diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index 26a1fd325..8e74893a2 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -5,12 +5,13 @@ [equivalence (.only Equivalence)] [monad (.only do)]] [control - ["<>" parser - ["[0]" cli (.only Parser)]]] + ["<>" parser]] [data ["[0]" sum] ["[0]" product] - ["[0]" text]]]] + ["[0]" text]] + [program + ["cli" \\parser (.only Parser)]]]] [// [repository [identity (.only Identity)]] 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]) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 7cabf5b88..ae075b5b0 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -6,17 +6,18 @@ [abstract [codec (.only Codec)] [equivalence (.only Equivalence)] - [monad (.only do)] - ["[0]" predicate (.only Predicate)]] + [monad (.only do)]] [control ["[0]" maybe] ["[0]" try (.only Try) (.use "[1]#[0]" functor)] ["[0]" exception (.only Exception exception)] + [function + ["[0]" predicate (.only Predicate)]] [concurrency ["[0]" async (.only Async)]]] [data ["[0]" binary (.only Binary)] - ["[0]" textnone + ["[0]" text (.only) ["%" \\format (.only format)] [encoding ["[0]" utf8]]] @@ -49,7 +50,7 @@ ["[1][0]" artifact (.only Version Artifact) ["[1]/[0]" extension (.only Extension)] ["[1]/[0]" versioning] - ["[0]" snapshotnone + ["[0]" snapshot (.only) [version ["[0]" value]]]] ["[1][0]" repository (.only Repository) @@ -222,12 +223,13 @@ tail resolution) _ (do [! async.monad] - [?package (case (dictionary.value head resolution) - {.#Some package} - (in {try.#Success package}) + [?package (is (Async (Try Package)) + (case (dictionary.value head resolution) + {.#Some package} + (in {try.#Success package}) - {.#None} - (..any console repositories head))] + {.#None} + (..any console repositories head)))] (case ?package {try.#Success package} (do ! diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 06dfa2988..5eb32d757 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -8,8 +8,8 @@ ["[0]" list (.use "[1]#[0]" monad)] ["[0]" set (.only Set)]]] [meta + ["[0]" code] [macro - ["[0]" code] ["[0]" template]] [compiler [meta @@ -171,8 +171,8 @@ (..on_list "compilers" (the /.#compilers value) ..compiler) (..on_set "sources" (the /.#sources value) code.text) (dictionary.has "target" (code.text (the /.#target value))) - (..on_maybe "program" (the /.#program value) code.text) - (..on_maybe "test" (the /.#test value) code.text) + (..on_maybe "program" (the /.#program value) code.symbol) + (..on_maybe "test" (the /.#test value) code.symbol) (..on_dictionary "deploy_repositories" (the /.#deploy_repositories value) code.text code.text) (,, (with_template [<tag>] [(dictionary.has (template.text [<tag>]) (..runtime (the <tag> value)))] diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index b292f004b..4506720a1 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -11,7 +11,7 @@ ["[0]" exception (.only exception)]] [data ["[0]" binary (.only Binary)] - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only Format format)] ["[0]" encoding]]] [math diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index a29cb49a7..509d8e16f 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -9,7 +9,7 @@ ["[0]" try (.only Try)]] [data [binary (.only Binary)] - ["[0]" text + ["[0]" text (.only) [encoding ["[0]" utf8]]] [collection diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 95197c4d9..0327a4cd9 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -1,6 +1,6 @@ (.require [library - [lux (.except Module) + [lux (.except type) [abstract [monad (.only do)]] [control @@ -19,10 +19,7 @@ [compiler [meta [cli - [compiler (.only Compiler)]] - [archive - [module - [descriptor (.only Module)]]]]]] + [compiler (.only Compiler)]]]]] [world [net (.only URL)]]]] ["[0]" // @@ -171,9 +168,13 @@ (Parser /.Target) <code>.text) -(def module - (Parser Module) - <code>.text) +(def module_or_program + (Parser Symbol) + <code>.symbol) + +(def program + (Parser Symbol) + <code>.global) (def deploy_repository (Parser [Text //repository.Address]) @@ -234,12 +235,12 @@ (|> ..target (..singular input "target") (<>.else /.default_target))) - ^program (is (Parser (Maybe Module)) + ^program (is (Parser (Maybe Symbol)) (<>.maybe - (..singular input "program" ..module))) - ^test (is (Parser (Maybe Module)) + (..singular input "program" ..module_or_program))) + ^test (is (Parser (Maybe Symbol)) (<>.maybe - (..singular input "test" ..module))) + (..singular input "test" ..program))) ^deploy_repositories (is (Parser (Dictionary Text //repository.Address)) (<| (at ! each (dictionary.of_list text.hash)) (<>.else (list)) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 579c21b41..627073d79 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -175,8 +175,8 @@ #compilers (List Compiler) #sources (Set Source) #target Target - #program (Maybe Module) - #test (Maybe Module) + #program (Maybe Symbol) + #test (Maybe Symbol) #deploy_repositories (Dictionary Text Address) #configuration (property.List Text) #java Runtime @@ -207,9 +207,9 @@ ... #target text.equivalence ... #program - (maybe.equivalence text.equivalence) + (maybe.equivalence symbol.equivalence) ... #test - (maybe.equivalence text.equivalence) + (maybe.equivalence symbol.equivalence) ... #deploy_repositories (dictionary.equivalence text.equivalence) ... #configuration diff --git a/stdlib/source/program/aedifex/repository/identity.lux b/stdlib/source/program/aedifex/repository/identity.lux index 348a3fc46..eaca93cdb 100644 --- a/stdlib/source/program/aedifex/repository/identity.lux +++ b/stdlib/source/program/aedifex/repository/identity.lux @@ -6,7 +6,7 @@ [equivalence (.only Equivalence)]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only format)] [encoding ["[0]" utf8]]]]]]) diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index 39a5c8396..af9b502aa 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -11,7 +11,7 @@ ["[0]" text (.only) ["%" \\format (.only format)]]] [world - [program (.only Program)] + [environment (.only Environment)] ["[0]" file] [net ["[0]" uri (.only URI)]]]]] @@ -20,37 +20,37 @@ ["[1][0]" local] ["[1][0]" metadata]]]) -(def .public (root program fs) - (-> (Program Async) (file.System Async) file.Path) +(def .public (root environment fs) + (-> (Environment Async) (file.System Async) file.Path) (let [/ (at fs separator)] (|> ///local.repository (text.replaced uri.separator /) - (format (at program home) /)))) + (format (at environment home) /)))) (def (path /) (-> Text (-> URI file.Path)) (text.replaced uri.separator /)) -(def (absolute_path program fs) - (-> (Program Async) (file.System Async) (-> URI file.Path)) +(def (absolute_path environment fs) + (-> (Environment Async) (file.System Async) (-> URI file.Path)) (let [/ (at fs separator)] (|>> ///metadata.local_uri (..path /) - (format (..root program fs) /)))) + (format (..root environment fs) /)))) -(def .public (repository program fs) - (-> (Program Async) (file.System Async) (//.Repository Async)) +(def .public (repository environment fs) + (-> (Environment Async) (file.System Async) (//.Repository Async)) (implementation (def description - (..root program fs)) + (..root environment fs)) (def download - (|>> (..absolute_path program fs) + (|>> (..absolute_path environment fs) (at fs read))) (def (upload uri content) (do [! async.monad] - [.let [absolute_path (..absolute_path program fs uri)] + [.let [absolute_path (..absolute_path environment fs uri)] ? (at fs file? absolute_path) _ (is (Async (Try Any)) (if ? diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index 20d270008..db9e662df 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -5,7 +5,7 @@ [equivalence (.only Equivalence)]] [data ["[0]" product] - ["[0]" text + ["[0]" text (.only) ["%" \\format (.only format)]] [collection ["[0]" list (.use "[1]#[0]" monoid)] |