aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command
diff options
context:
space:
mode:
authorEduardo Julian2020-11-27 00:07:51 -0400
committerEduardo Julian2020-11-27 00:07:51 -0400
commit889139602b77e4387a6e8bfbedacc2a08703e976 (patch)
tree3a113e298037122e81b5529475bd1e59286f733f /stdlib/source/program/aedifex/command
parentdbb658bd7976c073a2bf314f194b36b30c45784b (diff)
Re-named lux/data/format/context to lux/control/parser/environment.
Diffstat (limited to 'stdlib/source/program/aedifex/command')
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux23
-rw-r--r--stdlib/source/program/aedifex/command/build.lux40
-rw-r--r--stdlib/source/program/aedifex/command/deps.lux6
-rw-r--r--stdlib/source/program/aedifex/command/test.lux21
4 files changed, 45 insertions, 45 deletions
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 0fc223376..80ff8ac8c 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -7,19 +7,21 @@
["." try (#+ Try)]
["." io (#+ IO)]
[concurrency
- ["." promise]]]
+ ["." promise (#+ Promise)]]]
[data
[collection
["." array]
["." list]
["." set]]]
[world
- [file (#+ Path)]]]
+ ["." file (#+ Path)]]]
["." // #_
["/#" // #_
["#" profile]
["#." action (#+ Action)]
- ["#." command (#+ Command)]]])
+ ["#." command (#+ Command)]
+ [dependency
+ [resolution (#+ Resolution)]]]])
(import: java/nio/file/WatchKey
["#::."
@@ -124,18 +126,21 @@
#.None
(wrap []))))
-(def: #export (do! command profile)
- (All [a] (-> (Command a) (Command Any)))
+(def: #export (do! command fs resolution profile)
+ (All [a]
+ (-> (-> (file.System Promise) Resolution (Command a))
+ (-> (file.System Promise) Resolution (Command Any))))
(do {! ///action.monad}
- [#let [fs (java/nio/file/FileSystems::getDefault)]
- watcher (promise.future (java/nio/file/FileSystem::newWatchService fs))
+ [watcher (promise.future
+ (java/nio/file/FileSystem::newWatchService
+ (java/nio/file/FileSystems::getDefault)))
targets (|> profile
(get@ #///.sources)
set.to-list
(monad.map ! ..targets)
(:: ! map list.concat))
_ (monad.map ! (..watch! watcher) targets)
- _ (command profile)]
+ _ (command fs resolution profile)]
(loop [_ []]
(do !
[?key (..poll! watcher)
@@ -143,7 +148,7 @@
(#.Some key)
(do !
[_ (promise.future (..drain! watcher))
- _ (command profile)]
+ _ (command fs resolution profile)]
(wrap []))
#.None
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index b3a096ea8..72f96b25e 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -8,7 +8,7 @@
["." exception (#+ exception:)]
["." io (#+ IO)]
[concurrency
- ["." promise ("#@." monad)]]]
+ ["." promise (#+ Promise) ("#@." monad)]]]
[data
["." product]
["." maybe]
@@ -27,9 +27,10 @@
["#." local]
["#." cache]
["#." repository]
+ ["#." shell]
+ ["#." runtime]
["#." dependency (#+ Dependency)
["#/." resolution (#+ Resolution)]]
- ["#." shell]
["#." artifact (#+ Group Name Artifact)
["#/." type]]])
@@ -87,11 +88,11 @@
_
(exception.throw ..no-available-compiler [])))
-(def: libraries
- (-> Resolution (List Path))
+(def: (libraries fs)
+ (All [!] (-> (file.System !) Resolution (List Path)))
(|>> dictionary.keys
(list.filter (|>> (get@ #///dependency.type) (text@= ///artifact/type.lux-library)))
- (list@map (|>> (get@ #///dependency.artifact) (///local.path file.default)))))
+ (list@map (|>> (get@ #///dependency.artifact) (///local.path fs)))))
(import: java/lang/String)
@@ -114,9 +115,8 @@
(-> Text (List Text) Text)
(|> values (list@map (|>> (format name " "))) (text.join-with " ")))
-(def: #export (do! profile)
- (Command [Compiler
- Path])
+(def: #export (do! fs resolution profile)
+ (-> (file.System Promise) Resolution (Command [Compiler Path]))
(case [(get@ #///.program profile)
(get@ #///.target profile)]
[#.None _]
@@ -127,26 +127,16 @@
[(#.Some program) (#.Some target)]
(do ///action.monad
- [cache (///cache.read-all (file.async file.default)
- (set.to-list (get@ #///.dependencies profile))
- ///dependency/resolution.empty)
- resolution (///dependency/resolution.all (list@map (|>> ///repository.remote ///repository.async)
- (set.to-list (get@ #///.repositories profile)))
- (set.to-list (get@ #///.dependencies profile))
- cache)
- _ (///cache.write-all (file.async file.default)
- resolution)
- [resolution compiler] (promise@wrap (..compiler resolution))
+ [[resolution compiler] (promise@wrap (..compiler resolution))
working-directory (promise.future ..working-directory)
- #let [libraries (..libraries resolution)
- [prefix output] (case compiler
- (#JVM artifact) [(format "java -jar " (///local.path file.default artifact))
+ #let [[prefix output] (case compiler
+ (#JVM artifact) [(///runtime.java (///local.path fs artifact))
"program.jar"]
- (#JS artifact) [(format "node --stack_size=8192 " (///local.path file.default artifact))
+ (#JS artifact) [(///runtime.node (///local.path fs artifact))
"program.js"])
- cache-directory (format working-directory (:: file.default separator) target)
+ cache-directory (format working-directory (:: fs separator) target)
command (format prefix " build"
- " " (..plural-parameter "--library" libraries)
+ " " (..plural-parameter "--library" (..libraries fs resolution))
" " (..plural-parameter "--source" (set.to-list (get@ #///.sources profile)))
" " (..singular-parameter "--target" cache-directory)
" " (..singular-parameter "--module" program))]
@@ -154,5 +144,5 @@
outcome (///shell.execute command working-directory)
#let [_ (log! "[BUILD ENDED]")]]
(wrap [compiler
- (format cache-directory (:: file.default separator) output)]))
+ (format cache-directory (:: fs separator) output)]))
))
diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux
index bc4d88f6c..dfe58d707 100644
--- a/stdlib/source/program/aedifex/command/deps.lux
+++ b/stdlib/source/program/aedifex/command/deps.lux
@@ -18,14 +18,14 @@
["#." action (#+ Action)]
["#." cache]
["#." dependency #_
- ["#/." resolution]]])
+ ["#/." resolution (#+ Resolution)]]])
(def: #export (do! fs repositories profile)
- (-> (file.System Promise) (List (Repository Promise)) (Command (Set Artifact)))
+ (-> (file.System Promise) (List (Repository Promise)) (Command Resolution))
(do ///action.monad
[#let [dependencies (set.to-list (get@ #///.dependencies profile))]
cache (///cache.read-all fs dependencies ///dependency/resolution.empty)
resolution (///dependency/resolution.all repositories dependencies cache)
cached (///cache.write-all fs resolution)
#let [_ (log! "Successfully resolved dependencies!")]]
- (wrap cached)))
+ (wrap resolution)))
diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux
index a27c07f10..d4519b2d0 100644
--- a/stdlib/source/program/aedifex/command/test.lux
+++ b/stdlib/source/program/aedifex/command/test.lux
@@ -4,25 +4,30 @@
[monad (#+ do)]]
[control
[concurrency
- ["." promise]]]
+ ["." promise (#+ Promise)]]]
[data
[text
- ["%" format (#+ format)]]]]
+ ["%" format (#+ format)]]]
+ [world
+ ["." file]]]
["." // #_
["#." build]
["/#" // #_
["#." action]
["#." command (#+ Command)]
- ["#." shell]]])
+ ["#." shell]
+ ["#." runtime]
+ [dependency
+ [resolution (#+ Resolution)]]]])
-(def: #export (do! project)
- (Command Any)
+(def: #export (do! fs resolution profile)
+ (-> (file.System Promise) Resolution (Command Any))
(do ///action.monad
- [[compiler program] (//build.do! project)
+ [[compiler program] (//build.do! fs resolution profile)
working-directory (promise.future //build.working-directory)
#let [command (case compiler
- (#//build.JVM artifact) (format "java -jar " program)
- (#//build.JS artifact) (format "node --stack_size=8192 " program))]
+ (#//build.JVM artifact) (///runtime.java program)
+ (#//build.JS artifact) (///runtime.node program))]
#let [_ (log! "[TEST STARTED]")]
outcome (///shell.execute command working-directory)
#let [_ (log! "[TEST ENDED]")]]