aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command
diff options
context:
space:
mode:
authorEduardo Julian2020-12-03 02:09:57 -0400
committerEduardo Julian2020-12-03 02:09:57 -0400
commit0205e5146b50ab066d152fccda0fc8cef4eef852 (patch)
treeda2d89132da8f09344e26db78d0e43ca1095ee7f /stdlib/source/program/aedifex/command
parent28c724857d76afdc40b5b036f415cc151eb66263 (diff)
Detect duplicate files coming from dependencies.
Diffstat (limited to 'stdlib/source/program/aedifex/command')
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux9
-rw-r--r--stdlib/source/program/aedifex/command/build.lux20
-rw-r--r--stdlib/source/program/aedifex/command/clean.lux19
-rw-r--r--stdlib/source/program/aedifex/command/deploy.lux32
-rw-r--r--stdlib/source/program/aedifex/command/deps.lux29
-rw-r--r--stdlib/source/program/aedifex/command/install.lux35
-rw-r--r--stdlib/source/program/aedifex/command/pom.lux19
-rw-r--r--stdlib/source/program/aedifex/command/test.lux22
-rw-r--r--stdlib/source/program/aedifex/command/version.lux20
9 files changed, 120 insertions, 85 deletions
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index c2df31df5..33115c2e4 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -15,6 +15,7 @@
[world
[environment (#+ Environment)]
[shell (#+ Shell)]
+ ["." console (#+ Console)]
["." file (#+ Path)
["." watch (#+ Watcher)]]]]
["." // #_
@@ -48,11 +49,11 @@
(def: #export (do! watcher command)
(All [a]
(-> (Watcher Promise)
- (-> Environment (file.System Promise) (Shell Promise) Resolution (Command a))
- (-> Environment (file.System Promise) (Shell Promise) Resolution (Command Any))))
- (function (_ environment fs shell resolution)
+ (-> (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)
(function (_ profile)
- (with-expansions [<call> ((command environment fs shell resolution) profile)]
+ (with-expansions [<call> ((command console environment 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 85210fd36..be20d2e29 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -24,7 +24,8 @@
[world
[environment (#+ Environment)]
["." file (#+ Path)]
- ["." shell (#+ Shell)]]]
+ ["." shell (#+ Shell)]
+ ["." console (#+ Console)]]]
["." /// #_
["#" profile]
["#." action]
@@ -118,8 +119,12 @@
(-> Text (List Text) (List Text))
(|>> (list\map (|>> (list name))) list.concat))
-(def: #export (do! environment fs shell resolution profile)
- (-> Environment (file.System Promise) (Shell Promise) Resolution (Command [Compiler Path]))
+(def: #export start "[BUILD STARTED]")
+(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]))
(case [(get@ #///.program profile)
(get@ #///.target profile)]
[#.None _]
@@ -140,7 +145,7 @@
[(format compiler " build") output])
/ (\ fs separator)
cache-directory (format working-directory / target)]
- #let [_ (log! "[BUILD STARTED]")]
+ _ (console.write-line ..start console)
process (!.use (\ shell execute)
[environment
working-directory
@@ -150,8 +155,9 @@
(..singular "--target" cache-directory)
(..singular "--module" program)))])
exit (!.use (\ process await) [])
- #let [_ (log! (if (i.= shell.normal exit)
- "[BUILD ENDED]"
- "[BUILD FAILED]"))]]
+ _ (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/clean.lux b/stdlib/source/program/aedifex/command/clean.lux
index 618125a89..7f942fc00 100644
--- a/stdlib/source/program/aedifex/command/clean.lux
+++ b/stdlib/source/program/aedifex/command/clean.lux
@@ -9,7 +9,8 @@
[concurrency
["." promise (#+ Promise)]]]
[world
- ["." file (#+ Path File Directory)]]]
+ ["." file (#+ Path File Directory)]
+ ["." console (#+ Console)]]]
["." /// #_
[command (#+ Command)]
["#" profile]
@@ -25,8 +26,14 @@
nodes)]
(wrap [])))
-(def: #export (do! fs profile)
- (-> (file.System Promise) (Command Any))
+(def: #export success
+ "Success")
+
+(def: #export failure
+ "Failure: No 'target' defined for clean-up.")
+
+(def: #export (do! console fs profile)
+ (-> (Console Promise) (file.System Promise) (Command Any))
(case (get@ #///.target profile)
(#.Some target)
(do {! ///action.monad}
@@ -39,9 +46,7 @@
(!.use (\ root directories) []))
_ (monad.map ! recur subs)]
(!.use (\ root discard) [])))]
- (exec (log! "No 'target' defined for clean-up.")
- (wrap [])))
+ (console.write-line ..success console))
#.None
- (exec (log! "No 'target' defined for clean-up.")
- (\ ///action.monad wrap []))))
+ (console.write-line ..failure console)))
diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux
index 1f5ccc441..dbe4a88cb 100644
--- a/stdlib/source/program/aedifex/command/deploy.lux
+++ b/stdlib/source/program/aedifex/command/deploy.lux
@@ -16,22 +16,25 @@
["." tar]
["." xml]]]
[world
- ["." file]]]
+ ["." file]
+ ["." console (#+ Console)]]]
[program
[compositor
["." export]]]
- ["." /// #_
- [repository (#+ Identity Repository)]
- [command (#+ Command)]
- ["/" profile]
- ["#." action (#+ Action)]
- ["#." pom]
- ["#." hash]
- ["#." artifact (#+ Artifact)
- ["#/." extension (#+ Extension)]]])
+ ["." // #_
+ ["#." clean]
+ ["/#" // #_
+ [repository (#+ Identity Repository)]
+ [command (#+ Command)]
+ ["/" profile]
+ ["#." action (#+ Action)]
+ ["#." pom]
+ ["#." hash]
+ ["#." artifact (#+ Artifact)
+ ["#/." extension (#+ Extension)]]]])
-(def: #export (do! repository fs identity artifact profile)
- (-> (Repository Promise) (file.System Promise) Identity Artifact (Command Any))
+(def: #export (do! console repository fs identity artifact profile)
+ (-> (Console Promise) (Repository Promise) (file.System Promise) Identity Artifact (Command Any))
(let [deploy! (: (-> Extension Binary (Action Any))
(\ repository upload identity artifact))]
(do {! ///action.monad}
@@ -44,6 +47,5 @@
_ (deploy! ///artifact/extension.pom (|> pom (\ xml.codec encode) encoding.to-utf8))
_ (deploy! ///artifact/extension.lux-library library)
_ (deploy! ///artifact/extension.sha-1 (///hash.data (///hash.sha-1 library)))
- _ (deploy! ///artifact/extension.md5 (///hash.data (///hash.md5 library)))
- #let [_ (log! "Successfully deployed!")]]
- (wrap []))))
+ _ (deploy! ///artifact/extension.md5 (///hash.data (///hash.md5 library)))]
+ (console.write-line //clean.success console))))
diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux
index dfe58d707..67dc19e47 100644
--- a/stdlib/source/program/aedifex/command/deps.lux
+++ b/stdlib/source/program/aedifex/command/deps.lux
@@ -9,23 +9,26 @@
[collection
["." set (#+ Set)]]]
[world
- ["." file]]]
- ["." /// #_
- [command (#+ Command)]
- [artifact (#+ Artifact)]
- [repository (#+ Repository)]
- ["#" profile]
- ["#." action (#+ Action)]
- ["#." cache]
- ["#." dependency #_
- ["#/." resolution (#+ Resolution)]]])
+ ["." file]
+ ["." console (#+ Console)]]]
+ ["." // #_
+ ["#." clean]
+ ["/#" // #_
+ [command (#+ Command)]
+ [artifact (#+ Artifact)]
+ [repository (#+ Repository)]
+ ["#" profile]
+ ["#." action (#+ Action)]
+ ["#." cache]
+ ["#." dependency #_
+ ["#/." resolution (#+ Resolution)]]]])
-(def: #export (do! fs repositories profile)
- (-> (file.System Promise) (List (Repository Promise)) (Command Resolution))
+(def: #export (do! console fs repositories profile)
+ (-> (Console Promise) (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!")]]
+ _ (console.write-line //clean.success console)]
(wrap resolution)))
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index b152bc66c..327a0c119 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -21,18 +21,21 @@
["." tar]
["." xml]]]
[world
- ["." file (#+ Path File)]]]
+ ["." file (#+ Path File)]
+ ["." console (#+ Console)]]]
[program
[compositor
["." export]]]
- ["." /// #_
- ["/" profile (#+ Profile)]
- ["#." action (#+ Action)]
- ["#." command (#+ Command)]
- ["#." local]
- ["#." pom]
- ["#." artifact (#+ Artifact)
- ["#/." extension]]])
+ ["." // #_
+ ["#." clean]
+ ["/#" // #_
+ ["/" profile (#+ Profile)]
+ ["#." action (#+ Action)]
+ ["#." command (#+ Command)]
+ ["#." local]
+ ["#." pom]
+ ["#." artifact (#+ Artifact)
+ ["#/." extension]]]])
(def: (save! system content file)
(-> (file.System Promise) Binary Path (Promise (Try Any)))
@@ -41,8 +44,11 @@
(file.get-file promise.monad system file))]
(!.use (\ file over-write) [content])))
-(def: #export (do! system profile)
- (-> (file.System Promise) (Command Any))
+(def: #export failure
+ "Failure: No 'identity' defined for the project.")
+
+(def: #export (do! console system profile)
+ (-> (Console Promise) (file.System Promise) (Command Any))
(case (get@ #/.identity profile)
(#.Some identity)
(do ///action.monad
@@ -54,9 +60,8 @@
(format artifact-name ///artifact/extension.lux-library))
pom (\ promise.monad wrap (///pom.write profile))
_ (..save! system (|> pom (\ xml.codec encode) encoding.to-utf8)
- (format artifact-name ///artifact/extension.pom))
- #let [_ (log! "Successfully installed locally!")]]
- (wrap []))
+ (format artifact-name ///artifact/extension.pom))]
+ (console.write-line //clean.success console))
_
- (\ promise.monad wrap (exception.throw /.no-identity []))))
+ (console.write-line ..failure console)))
diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux
index 28bd23921..cf07ad0e0 100644
--- a/stdlib/source/program/aedifex/command/pom.lux
+++ b/stdlib/source/program/aedifex/command/pom.lux
@@ -15,14 +15,17 @@
[format
["." xml]]]
[world
- ["." file (#+ Path File)]]]
- ["." /// #_
- [command (#+ Command)]
- ["#." action (#+ Action)]
- ["#." pom]])
+ ["." file (#+ Path File)]
+ ["." console (#+ Console)]]]
+ ["." // #_
+ ["#." clean]
+ ["/#" // #_
+ [command (#+ Command)]
+ ["#." action (#+ Action)]
+ ["#." pom]]])
-(def: #export (do! fs profile)
- (-> (file.System Promise) (Command Path))
+(def: #export (do! console fs profile)
+ (-> (Console Promise) (file.System Promise) (Command Path))
(do ///action.monad
[pom (promise\wrap (///pom.write profile))
file (: (Promise (Try (File Promise)))
@@ -31,5 +34,5 @@
(\ xml.codec encode)
encoding.to-utf8
(!.use (\ file over-write)))
- #let [_ (log! "Successfully wrote POM file!")]]
+ _ (console.write-line //clean.success console)]
(wrap ///pom.file)))
diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux
index 5c205b7b8..93c705be1 100644
--- a/stdlib/source/program/aedifex/command/test.lux
+++ b/stdlib/source/program/aedifex/command/test.lux
@@ -15,7 +15,8 @@
[world
[environment (#+ Environment)]
["." file]
- ["." shell (#+ Shell)]]]
+ ["." shell (#+ Shell)]
+ ["." console (#+ Console)]]]
["." // #_
["#." build]
["/#" // #_
@@ -25,12 +26,16 @@
[dependency
[resolution (#+ Resolution)]]]])
-(def: #export (do! environment fs shell resolution profile)
- (-> Environment (file.System Promise) (Shell Promise) Resolution (Command Any))
+(def: #export start "[TEST STARTED]")
+(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! environment fs shell resolution profile)
+ [[compiler program] (//build.do! console environment fs shell resolution profile)
working-directory (promise\wrap (//build.working-directory environment))
- #let [_ (log! "[TEST STARTED]")]
+ _ (console.write-line ..start console)
process (!.use (\ shell execute)
[environment
working-directory
@@ -39,7 +44,8 @@
(#//build.JS artifact) (///runtime.node program))
(list)])
exit (!.use (\ process await) [])
- #let [_ (log! (if (i.= shell.normal exit)
- "[TEST ENDED]"
- "[TEST FAILED]"))]]
+ _ (console.write-line (if (i.= shell.normal exit)
+ ..success
+ ..failure)
+ console)]
(wrap [])))
diff --git a/stdlib/source/program/aedifex/command/version.lux b/stdlib/source/program/aedifex/command/version.lux
index 8f26a7fb7..076d2a71d 100644
--- a/stdlib/source/program/aedifex/command/version.lux
+++ b/stdlib/source/program/aedifex/command/version.lux
@@ -1,16 +1,20 @@
(.module:
[lux #*
+ [control
+ [concurrency
+ ["." promise (#+ Promise)]]]
[tool
[compiler
["." version]
["." language #_
["#/." lux #_
- ["#" version]]]]]]
- ["." /// #_
- [command (#+ Command)]
- ["#." action]])
+ ["#" version]]]]]
+ [world
+ ["." console (#+ Console)]]]
+ [///
+ [command (#+ Command)]])
-(def: #export (do! profile)
- (Command Any)
- (\ ///action.monad wrap
- (log! (version.format language/lux.version))))
+(def: #export (do! console profile)
+ (-> (Console Promise) (Command Any))
+ (console.write-line (version.format language/lux.version)
+ console))