aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-10-03 20:13:27 -0400
committerEduardo Julian2020-10-03 20:13:27 -0400
commit2d16bdfa2854d851034eff9f042863dcceb8664a (patch)
treea1c593916c6ec9d6e9c132e641fc8b34b85a07f8 /stdlib/source/program/aedifex.lux
parent618b1ce9743bb79f1ae3375b05a394a4183b21e8 (diff)
Gave Aedifex support for multiple profiles.
Diffstat (limited to 'stdlib/source/program/aedifex.lux')
-rw-r--r--stdlib/source/program/aedifex.lux107
1 files changed, 53 insertions, 54 deletions
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index bfa2377f4..e29af6e7a 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -19,7 +19,9 @@
["%" format (#+ format)]
["." encoding]]
[format
- ["." xml]]]
+ ["." xml]]
+ [collection
+ ["." set]]]
[tool
[compiler
[language
@@ -29,7 +31,8 @@
["." file (#+ Path)]]]
["." / #_
[action (#+ Action)]
- ["#" project]
+ ["#" profile]
+ ["#." project (#+ Project)]
["#." parser]
["#." pom]
["#." cli]
@@ -61,20 +64,20 @@
(#.Right [end lux-code])
(#try.Success lux-code))))
-(def: (write-pom!' path project)
- (-> Path /.Project (IO (Try Any)))
+(def: (write-pom!' path profile)
+ (-> Path /.Profile (IO (Try Any)))
(do (try.with io.monad)
- [file (!.use (:: file.system file) [path])]
- (|> project
- /pom.project
+ [file (!.use (:: file.system file) [path])
+ pom (:: io.monad wrap (/pom.project profile))]
+ (|> pom
(:: xml.codec encode)
encoding.to-utf8
(!.use (:: file over-write)))))
-(def: (write-pom! project)
- (-> /.Project (IO Any))
+(def: (write-pom! profile)
+ (-> /.Profile (IO Any))
(do io.monad
- [outcome (write-pom!' /pom.file project)]
+ [outcome (write-pom!' /pom.file profile)]
(case outcome
(#try.Success value)
(wrap (log! "Successfully wrote POM file!"))
@@ -83,10 +86,10 @@
(wrap (log! (format "Could not write POM file:" text.new-line
error))))))
-(def: (install! project)
- (-> /.Project (Promise Any))
+(def: (install! profile)
+ (-> /.Profile (Promise Any))
(do promise.monad
- [outcome (/local.install (file.async file.system) project)]
+ [outcome (/local.install (file.async file.system) profile)]
(wrap (case outcome
(#try.Success _)
(log! "Successfully installed locally!")
@@ -95,16 +98,16 @@
(log! (format "Could not install locally:" text.new-line
error))))))
-(def: (fetch-dependencies! project)
- (-> /.Project (Promise Any))
+(def: (fetch-dependencies! profile)
+ (-> /.Profile (Promise Any))
(do promise.monad
[outcome (do (try.with promise.monad)
[cache (/local.all-cached (file.async file.system)
- (get@ #/.dependencies project)
+ (set.to-list (get@ #/.dependencies profile))
/dependency.empty)
resolution (promise.future
- (/dependency.resolve-all (get@ #/.repositories project)
- (get@ #/.dependencies project)
+ (/dependency.resolve-all (set.to-list (get@ #/.repositories profile))
+ (set.to-list (get@ #/.dependencies profile))
cache))]
(/local.cache-all (file.async file.system)
resolution))]
@@ -117,52 +120,48 @@
error))))))
(def: project
- (-> Binary (Try /.Project))
+ (-> Binary (Try Project))
(|>> (do> try.monad
[encoding.from-utf8]
[..read-code]
[(list) (<c>.run /parser.project)])))
-(program: [{command /cli.command}]
+(program: [{[profile operation] /cli.command}]
(do {@ io.monad}
[data (..read-file! /.file)]
- (case data
- (#try.Success data)
- (case (..project data)
- (#try.Success project)
- (case command
- #/cli.POM
- (..write-pom! project)
-
- #/cli.Dependencies
- (exec (..fetch-dependencies! project)
- (wrap []))
+ (case (do try.monad
+ [data data
+ project (..project data)]
+ (/project.profile project profile))
+ (#try.Success profile)
+ (case operation
+ #/cli.POM
+ (..write-pom! profile)
+
+ #/cli.Dependencies
+ (exec (..fetch-dependencies! profile)
+ (wrap []))
- #/cli.Install
- (exec (..install! project)
- (wrap []))
+ #/cli.Install
+ (exec (..install! profile)
+ (wrap []))
- (#/cli.Deploy repository user password)
- (exec (/deploy.do! repository user password project)
- (wrap []))
+ (#/cli.Deploy repository user password)
+ (exec (/deploy.do! repository user password profile)
+ (wrap []))
- (#/cli.Compilation compilation)
- (case compilation
- #/cli.Build (exec (/build.do! project)
- (wrap []))
- #/cli.Test (exec (/test.do! project)
- (wrap [])))
+ (#/cli.Compilation compilation)
+ (case compilation
+ #/cli.Build (exec (/build.do! profile)
+ (wrap []))
+ #/cli.Test (exec (/test.do! profile)
+ (wrap [])))
- (#/cli.Auto auto)
- (exec (case auto
- #/cli.Build (/auto.do! /build.do! project)
- #/cli.Test (/auto.do! /test.do! project))
- (wrap [])))
-
- (#try.Failure error)
- (wrap (log! (format "Invalid format file:" text.new-line
- error))))
+ (#/cli.Auto auto)
+ (exec (case auto
+ #/cli.Build (/auto.do! /build.do! profile)
+ #/cli.Test (/auto.do! /test.do! profile))
+ (wrap [])))
(#try.Failure error)
- (wrap (log! (format "Could not read file: "
- (%.text /.file)))))))
+ (wrap (log! error)))))