aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program
diff options
context:
space:
mode:
authorEduardo Julian2022-04-07 14:57:35 -0400
committerEduardo Julian2022-04-07 14:57:35 -0400
commitc85697eee8ce3dac5480a3ba2b31cc4943e1d8e6 (patch)
tree50db3f6547b0ad765e6b47e65546f30ad8861c0b /stdlib/source/program
parent9224e54bf175ebe13c3fae42f04b649413c737e7 (diff)
Better snapshot deployments for Aedifex.
Diffstat (limited to 'stdlib/source/program')
-rw-r--r--stdlib/source/program/aedifex.lux129
-rw-r--r--stdlib/source/program/aedifex/command/build.lux6
-rw-r--r--stdlib/source/program/aedifex/command/deploy.lux77
-rw-r--r--stdlib/source/program/aedifex/command/deploy/snapshot.lux61
-rw-r--r--stdlib/source/program/aedifex/command/install.lux4
-rw-r--r--stdlib/source/program/aedifex/command/test.lux2
-rw-r--r--stdlib/source/program/aedifex/parser.lux2
-rw-r--r--stdlib/source/program/aedifex/profile.lux6
-rw-r--r--stdlib/source/program/aedifex/runtime.lux2
9 files changed, 151 insertions, 138 deletions
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index a86e634a2..0c04ff7bb 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux "*"
+ [lux {"-" local}
[program {"+" program:}]
["[0]" debug]
[abstract
@@ -146,6 +146,10 @@
(maybe.trusted (text.clip 0 (-- (text.size it)) it))
it)))))
+(def: program (program.async program.default))
+(def: fs (file.async file.default))
+(def: local (/repository/local.repository ..program ..fs))
+
(program: [[profiles operation] /cli.command]
(do [! io.monad]
[console (# ! each (|>> (try.else ..write_only) console.async)
@@ -163,68 +167,67 @@
(..fail! error)
{try.#Success profile}
- (let [program (program.async program.default)]
- (case operation
- {/cli.#Version}
- (in [])
-
- {/cli.#Clean}
- (..command
- (/command/clean.do! console (file.async file.default) profile))
-
- {/cli.#POM}
- (..command
- (/command/pom.do! console (file.async file.default) profile))
-
- {/cli.#Install}
- (..command
- (let [fs (file.async file.default)]
- (/command/install.do! console fs (/repository/local.repository program fs) profile)))
-
- {/cli.#Deploy repository identity}
- (..command
- (case (the /.#identity profile)
- {.#Some artifact}
- (case (dictionary.value repository (the /.#deploy_repositories profile))
- {.#Some repository}
- (/command/deploy.do! console
- (/repository.async (/repository/remote.repository http.default {.#Some identity} repository))
- (file.async file.default)
- artifact
- profile)
-
- {.#None}
- (async#in (exception.except ..cannot_find_repository [repository (the /.#deploy_repositories profile)])))
+ (case operation
+ {/cli.#Version}
+ (in [])
+
+ {/cli.#Clean}
+ (..command
+ (/command/clean.do! console (file.async file.default) profile))
+
+ {/cli.#POM}
+ (..command
+ (/command/pom.do! console (file.async file.default) profile))
+
+ {/cli.#Install}
+ (..command
+ (/command/install.do! console ..fs ..local profile))
+
+ {/cli.#Deploy repository identity}
+ (..command
+ (case (the /.#identity profile)
+ {.#Some artifact}
+ (case (dictionary.value repository (the /.#deploy_repositories profile))
+ {.#Some remote}
+ (/command/deploy.do! console
+ ..local
+ (/repository.async (/repository/remote.repository http.default {.#Some identity} remote))
+ (file.async file.default)
+ artifact
+ profile)
{.#None}
- (async#in (exception.except /.no_identity []))))
-
- {/cli.#Dependencies}
- (..command
- (/command/deps.do! console
- (/repository/local.repository program (file.async file.default))
- (..repositories profile)
- (|>> (/repository/remote.repository http.default {.#None})
- /repository.async)
- profile))
-
- {/cli.#Compilation compilation}
- (case compilation
- {/cli.#Build} (..command
- (..with_dependencies program console /command/build.do! profile))
- {/cli.#Test} (..command
- (..with_dependencies program console /command/test.do! profile)))
-
- {/cli.#Auto auto}
- (do !
- [?watcher watch.default]
- (case ?watcher
- {try.#Failure error}
- (..fail! error)
-
- {try.#Success watcher}
- (..command
- (case auto
- {/cli.#Build} (..with_dependencies program console (/command/auto.do! /command/auto.delay watcher /command/build.do!) profile)
- {/cli.#Test} (..with_dependencies program console (/command/auto.do! /command/auto.delay watcher /command/test.do!) profile)))))))
+ (async#in (exception.except ..cannot_find_repository [repository (the /.#deploy_repositories profile)])))
+
+ {.#None}
+ (async#in (exception.except /.no_identity []))))
+
+ {/cli.#Dependencies}
+ (..command
+ (/command/deps.do! console
+ (/repository/local.repository ..program (file.async file.default))
+ (..repositories profile)
+ (|>> (/repository/remote.repository http.default {.#None})
+ /repository.async)
+ profile))
+
+ {/cli.#Compilation compilation}
+ (case compilation
+ {/cli.#Build} (..command
+ (..with_dependencies ..program console /command/build.do! profile))
+ {/cli.#Test} (..command
+ (..with_dependencies ..program console /command/test.do! profile)))
+
+ {/cli.#Auto auto}
+ (do !
+ [?watcher watch.default]
+ (case ?watcher
+ {try.#Failure error}
+ (..fail! error)
+
+ {try.#Success watcher}
+ (..command
+ (case auto
+ {/cli.#Build} (..with_dependencies ..program console (/command/auto.do! /command/auto.delay watcher /command/build.do!) profile)
+ {/cli.#Test} (..with_dependencies ..program console (/command/auto.do! /command/auto.delay watcher /command/test.do!) profile))))))
)))))
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index 4ff240f96..8f3fa2496 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -271,9 +271,7 @@
_
(revised ///runtime.#parameters
- (|>> (partial_list "-cp" (..jvm_class_path host_dependencies)
- "--add-opens" "java.base/java.lang=ALL-UNNAMED"
- "-Xss16m"))
+ (|>> (partial_list "-cp" (..jvm_class_path host_dependencies)))
runtime)))
(def: .public (do! console program fs shell resolution)
@@ -323,7 +321,7 @@
(..singular "--target" cache_directory)
(..singular "--module" program_module)
(..singular "--configuration" (configuration.format (the ///.#configuration profile)))))]
- process (# shell execute [(dictionary.composite command_environment environment)
+ process (# shell execute [(dictionary.composite environment command_environment)
working_directory
command
full_parameters])
diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux
index 6fcd84e21..4ff3b9011 100644
--- a/stdlib/source/program/aedifex/command/deploy.lux
+++ b/stdlib/source/program/aedifex/command/deploy.lux
@@ -4,78 +4,29 @@
[abstract
[monad {"+" do}]]
[control
- ["[0]" try {"+" Try}]
+ [try {"+" Try}]
[concurrency
- ["[0]" async {"+" Async} ("[1]#[0]" monad)]]
- ["<>" parser
- ["<[0]>" xml]]]
- [data
- [binary {"+" Binary}]
- [text
- ["%" format {"+" format}]
- [encoding
- ["[0]" utf8]]]
- [collection
- ["[0]" set]]
- [format
- ["[0]" binary]
- ["[0]" tar]
- ["[0]" xml]]]
- [time
- ["[0]" instant {"+" Instant}]]
- [tool
- [compiler
- [meta
- ["[0]" export]]]]
+ [async {"+" Async}]]]
[world
["[0]" file]
["[0]" console {"+" Console}]]]]
- ["[0]" // "_"
- ["[1][0]" clean]
+ ["[0]" / "_"
+ ["[1][0]" snapshot]
["/[1]" // "_"
- [command {"+" Command}]
- ["/" profile]
- ["[1][0]" action {"+" Action}]
- ["[1][0]" pom]
- ["[1][0]" hash]
- ["[1][0]" package]
- ["[1][0]" dependency
- ["[1]/[0]" deployment]
- ["[1]/[0]" status {"+" Status}]]
- ["[1][0]" repository {"+" Repository}
- [identity {"+" Identity}]
- ["[1]/[0]" remote]
- ["[1]/[0]" origin]]
- ["[1][0]" metadata
- ["[1]/[0]" artifact]
- ["[1]/[0]" snapshot]]
- ["[1][0]" artifact {"+" Artifact}
- ["[1]/[0]" extension {"+" Extension}]
- ["[1]/[0]" type]]]])
+ ["[1][0]" install]
+ ["/[1]" // "_"
+ [command {"+" Command}]
+ [repository {"+" Repository}]
+ [artifact {"+" Artifact}]
+ ["[1][0]" action]]]])
(def: .public success
"Successfully deployed the project.")
-(def: .public (do! console repository fs artifact profile)
- (-> (Console Async) (Repository Async) (file.System Async) Artifact (Command Any))
+(def: .public (do! console local remote fs artifact profile)
+ (-> (Console Async) (Repository Async) (Repository Async) (file.System Async) Artifact (Command Any))
(do [! ///action.monad]
- [library (|> profile
- (the /.#sources)
- set.list
- (export.library fs)
- (# ! each (binary.result tar.writer)))
- pom (# async.monad in (///pom.write profile))
- _ (///dependency/deployment.one
- repository
- [artifact ///artifact/type.lux_library]
- (let [pom_data (|> pom
- (# xml.codec encoded)
- (# utf8.codec encoded))]
- [///package.#origin {///repository/origin.#Remote ""}
- ///package.#library [library
- (///dependency/status.verified library)]
- ///package.#pom [pom
- pom_data
- (///dependency/status.verified pom_data)]]))]
+ [_ (//install.do! console fs local profile)
+ _ (/snapshot.do! console remote fs artifact profile)]
(is (Async (Try Any))
(console.write_line ..success console))))
diff --git a/stdlib/source/program/aedifex/command/deploy/snapshot.lux b/stdlib/source/program/aedifex/command/deploy/snapshot.lux
new file mode 100644
index 000000000..9770965d9
--- /dev/null
+++ b/stdlib/source/program/aedifex/command/deploy/snapshot.lux
@@ -0,0 +1,61 @@
+(.using
+ [library
+ [lux "*"
+ [abstract
+ [monad {"+" do}]]
+ [control
+ [concurrency
+ ["[0]" async {"+" Async}]]]
+ [data
+ [text
+ [encoding
+ ["[0]" utf8]]]
+ [collection
+ ["[0]" set]]
+ [format
+ ["[0]" binary]
+ ["[0]" tar]
+ ["[0]" xml]]]
+ [tool
+ [compiler
+ [meta
+ ["[0]" export]]]]
+ [world
+ [console {"+" Console}]
+ ["[0]" file]]]]
+ ["[0]" //// "_"
+ [command {"+" Command}]
+ ["/" profile]
+ ["[1][0]" action]
+ ["[1][0]" pom]
+ ["[1][0]" package]
+ ["[1][0]" dependency "_"
+ ["[1]/[0]" deployment]
+ ["[1]/[0]" status]]
+ ["[1][0]" repository {"+" Repository}
+ ["[1]/[0]" origin]]
+ ["[1][0]" artifact {"+" Artifact}
+ ["[1]/[0]" type]]])
+
+(def: .public (do! console remote fs artifact profile)
+ (-> (Console Async) (Repository Async) (file.System Async) Artifact (Command Any))
+ (do [! ////action.monad]
+ [library (|> profile
+ (the /.#sources)
+ set.list
+ (export.library fs)
+ (# ! each (binary.result tar.writer)))
+ pom (# async.monad in (////pom.write profile))
+ _ (////dependency/deployment.one
+ remote
+ [artifact ////artifact/type.lux_library]
+ (let [pom_data (|> pom
+ (# xml.codec encoded)
+ (# utf8.codec encoded))]
+ [////package.#origin {////repository/origin.#Remote ""}
+ ////package.#library [library
+ (////dependency/status.verified library)]
+ ////package.#pom [pom
+ pom_data
+ (////dependency/status.verified pom_data)]]))]
+ (in [])))
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index 41338674d..aced7165c 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -50,7 +50,7 @@
(def: .public failure
"Failure: No 'identity' defined for the project.")
-(def: .public (do! console fs repository profile)
+(def: .public (do! console fs local profile)
(-> (Console Async) (file.System Async) (Repository Async) (Command Any))
(case (the /.#identity profile)
{.#Some identity}
@@ -62,7 +62,7 @@
pom (|> profile
///pom.write
(# async.monad in))
- _ (///dependency/deployment.one repository
+ _ (///dependency/deployment.one local
[identity ///artifact/type.lux_library]
(let [pom_data (|> pom
(# xml.codec encoded)
diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux
index e6d36bfd8..1d4da3262 100644
--- a/stdlib/source/program/aedifex/command/test.lux
+++ b/stdlib/source/program/aedifex/command/test.lux
@@ -62,7 +62,7 @@
[//build.#Python ///.#python]
[//build.#Lua ///.#lua]
[//build.#Ruby ///.#ruby]))]
- process (# shell execute [(dictionary.composite command_environment environment)
+ process (# shell execute [(dictionary.composite environment command_environment)
working_directory
test_command
test_parameters])
diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux
index 094f60507..280c518e7 100644
--- a/stdlib/source/program/aedifex/parser.lux
+++ b/stdlib/source/program/aedifex/parser.lux
@@ -219,7 +219,7 @@
(<>.else (set.empty //dependency.hash))))
^lux (|> ..dependency
(..singular input //format.lux_compiler_label)
- (<>.else /.default_compiler))
+ (<>.else /.default_lux))
^compilers (|> ..compiler
(..plural input "compilers")
(<>.else (list)))
diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux
index 94baee351..8fca5dffa 100644
--- a/stdlib/source/program/aedifex/profile.lux
+++ b/stdlib/source/program/aedifex/profile.lux
@@ -39,7 +39,7 @@
[repository
[remote {"+" Address}]]])
-(def: .public default_compiler
+(def: .public default_lux
Dependency
[dependency.#artifact ["com.github.luxlang" "lux-jvm" "0.6.5"]
dependency.#type type.jvm_library])
@@ -232,7 +232,7 @@
#info {.#None}
#repositories (set.empty text.hash)
#dependencies (set.empty dependency.hash)
- #lux default_compiler
+ #lux ..default_lux
#compilers (list)
#sources (set.empty text.hash)
#target ..default_target
@@ -256,7 +256,7 @@
#info (maybe#composite (the #info override) (the #info baseline))
#repositories (set.union (the #repositories baseline) (the #repositories override))
#dependencies (set.union (the #dependencies baseline) (the #dependencies override))
- #lux (if (dependency#= ..default_compiler (the #lux override))
+ #lux (if (dependency#= ..default_lux (the #lux override))
(the #lux baseline)
(the #lux override))
#compilers (list#composite (the #compilers baseline) (the #compilers override))
diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux
index 7ba73519d..f03c80ba1 100644
--- a/stdlib/source/program/aedifex/runtime.lux
+++ b/stdlib/source/program/aedifex/runtime.lux
@@ -36,7 +36,7 @@
#program <command>
#parameters (`` (list (~~ (template.spliced <parameters>))))])]
- [default_java "java" [] ["--add-opens" "java.base/java.lang=ALL-UNNAMED" "-jar"]]
+ [default_java "java" [] ["-Xss32m" "--add-opens" "java.base/java.lang=ALL-UNNAMED" "-jar"]]
[default_js "node" [] ["--stack_size=8192"]]
[default_python "python3" [] []]
[default_lua "lua" [] []]