aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/local.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-11-02 17:31:39 -0400
committerEduardo Julian2020-11-02 17:31:39 -0400
commit03b1085924b225d34d3b11f1a442b0b5d926c417 (patch)
treee50b2d0947bf7aa53d2ea8321693e4c0a21836ac /stdlib/source/program/aedifex/local.lux
parent3e67e244ad1f58a7bab0094967a86be72aae2482 (diff)
Allow defining anonymous actors.
Diffstat (limited to 'stdlib/source/program/aedifex/local.lux')
-rw-r--r--stdlib/source/program/aedifex/local.lux139
1 files changed, 3 insertions, 136 deletions
diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux
index dc769bcc1..17ddeb4cf 100644
--- a/stdlib/source/program/aedifex/local.lux
+++ b/stdlib/source/program/aedifex/local.lux
@@ -1,45 +1,12 @@
(.module:
[lux #*
- [abstract
- ["." monad (#+ do)]]
- [control
- ["." io (#+ IO)]
- ["." try (#+ Try)]
- ["." exception]
- [concurrency
- ["." promise (#+ Promise)]]
- [security
- ["!" capability]]
- ["<>" parser
- ["<.>" xml]]]
[data
- [binary (#+ Binary)]
[text
- ["%" format (#+ format)]
- ["." encoding]]
- [collection
- ["." list ("#@." monoid)]
- ["." dictionary]
- ["." set]]
- [format
- ["." binary]
- ["." tar]
- ["." xml]]]
+ ["%" format (#+ format)]]]
[world
- ["." file (#+ Path File Directory)]]]
- [program
- [compositor
- ["." export]]]
+ ["." file (#+ Path)]]]
["." // #_
- ["/" profile (#+ Profile)]
- ["#." pom]
- ["#." hash]
- ["#." package (#+ Package)]
- ["#." artifact (#+ Artifact)
- ["#/." type]
- ["#/." extension]]
- ["#." dependency (#+ Dependency)
- ["#/." resolution (#+ Resolution)]]])
+ ["#." artifact (#+ Artifact)]])
(def: #export (repository system)
(All [a] (-> (file.System a) Path))
@@ -51,103 +18,3 @@
(format (..repository system)
(:: system separator)
(//artifact.path system artifact)))
-
-(def: (save! system content file)
- (-> (file.System Promise) Binary Path (Promise (Try Any)))
- (do (try.with promise.monad)
- [file (: (Promise (Try (File Promise)))
- (file.get-file promise.monad system file))]
- (!.use (:: file over-write) [content])))
-
-(def: #export (cache system [artifact type] package)
- (-> (file.System Promise) Dependency Package (Promise (Try Any)))
- (do (try.with promise.monad)
- [directory (: (Promise (Try Path))
- (file.make-directories promise.monad system (..path system artifact)))
- #let [prefix (format directory (:: system separator) (//artifact.identity artifact))]
- directory (: (Promise (Try (Directory Promise)))
- (file.get-directory promise.monad system directory))
- _ (..save! system
- (get@ #//package.library package)
- (format prefix (//artifact/extension.extension type)))
- _ (..save! system
- (|> package
- (get@ #//package.sha-1)
- (:: //hash.sha-1-codec encode)
- encoding.to-utf8)
- (format prefix //artifact/extension.sha-1))
- _ (..save! system
- (|> package
- (get@ #//package.md5)
- (:: //hash.md5-codec encode)
- encoding.to-utf8)
- (format prefix //artifact/extension.md5))
- _ (..save! system
- (|> package (get@ #//package.pom) (:: xml.codec encode) encoding.to-utf8)
- (format prefix //artifact/extension.pom))]
- (wrap [])))
-
-(def: #export (cache-all system resolution)
- (-> (file.System Promise) Resolution (Promise (Try Any)))
- (do {! (try.with promise.monad)}
- [_ (monad.map ! (function (_ [dependency package])
- (..cache system dependency package))
- (dictionary.entries resolution))]
- (wrap [])))
-
-(def: (read! system path)
- (-> (file.System Promise) Path (Promise (Try Binary)))
- (do (try.with promise.monad)
- [file (: (Promise (Try (File Promise)))
- (!.use (:: system file) path))]
- (!.use (:: file content) [])))
-
-(def: #export (cached system [artifact type])
- (-> (file.System Promise) Dependency (Promise (Try Package)))
- (do (try.with promise.monad)
- [directory (: (Promise (Try Path))
- (file.make-directories promise.monad system (..path system artifact)))
- #let [prefix (format directory (:: system separator) (//artifact.identity artifact))]
- pom (..read! system (format prefix //artifact/extension.pom))
- library (..read! system (format prefix (//artifact/extension.extension type)))
- sha-1 (..read! system (format prefix //artifact/extension.sha-1))
- md5 (..read! system (format prefix //artifact/extension.md5))]
- (:: promise.monad wrap
- (do try.monad
- [pom (encoding.from-utf8 pom)
- pom (:: xml.codec decode pom)
- sha-1 (//hash.as-sha-1 sha-1)
- md5 (//hash.as-md5 md5)]
- (wrap {#//package.library library
- #//package.pom pom
- #//package.sha-1 sha-1
- #//package.md5 md5})))))
-
-(def: #export (all-cached system dependencies resolution)
- (-> (file.System Promise) (List Dependency) Resolution (Promise (Try Resolution)))
- (case dependencies
- #.Nil
- (:: (try.with promise.monad) wrap resolution)
-
- (#.Cons head tail)
- (do promise.monad
- [package (case (dictionary.get head resolution)
- (#.Some package)
- (wrap (#try.Success package))
-
- #.None
- (..cached system head))]
- (with-expansions [<next> (as-is (all-cached system tail resolution))]
- (case package
- (#try.Success package)
- (do (try.with promise.monad)
- [sub-dependencies (|> package
- //package.dependencies
- (:: promise.monad wrap))
- resolution (|> resolution
- (dictionary.put head package)
- (all-cached system (set.to-list sub-dependencies)))]
- <next>)
-
- (#try.Failure error)
- <next>)))))