diff options
author | Eduardo Julian | 2020-08-17 21:34:07 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-08-17 21:34:07 -0400 |
commit | c9e452617dc14dfe9955dc556640bc07f319224a (patch) | |
tree | af413cad2aa2ea793b72dab971ed91ff8079b068 /stdlib/source/program/compositor | |
parent | bea5913a915a0bfd795f9e12b40f1d32716a6cf8 (diff) |
Add local repo installation to Aedifex.
Diffstat (limited to 'stdlib/source/program/compositor')
-rw-r--r-- | stdlib/source/program/compositor/cli.lux | 11 | ||||
-rw-r--r-- | stdlib/source/program/compositor/export.lux | 56 |
2 files changed, 40 insertions, 27 deletions
diff --git a/stdlib/source/program/compositor/cli.lux b/stdlib/source/program/compositor/cli.lux index 03235bbad..4c4384636 100644 --- a/stdlib/source/program/compositor/cli.lux +++ b/stdlib/source/program/compositor/cli.lux @@ -12,9 +12,14 @@ [world [file (#+ Path)]]]) -(type: #export Source Path) -(type: #export Library Path) -(type: #export Target Path) +(type: #export Source + Path) + +(type: #export Library + Path) + +(type: #export Target + Path) (type: #export Compilation [(List Source) (List Library) Target Module]) diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux index f6a78ed78..468b1ef9d 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -1,5 +1,5 @@ (.module: - [lux #* + [lux (#- Source) [abstract ["." monad (#+ do)]] [control @@ -27,7 +27,10 @@ [world ["." file]]] [// - [cli (#+ Export)]]) + [cli (#+ Source Export)]]) + +(def: file + "library.tar") (def: no-ownership tar.Ownership @@ -37,26 +40,31 @@ {#tar.user commons #tar.group commons})) -(def: #export (export system extension [sources target]) - (-> (file.System Promise) Extension Export (Promise (Try Any))) - (let [package (format target (:: system separator) "library.tar")] +(def: #export (library system sources) + (-> (file.System Promise) (List Source) (Promise (Try tar.Tar))) + (do (try.with promise.monad) + [files (io.enumerate system sources)] + (|> (dictionary.entries files) + (monad.map try.monad + (function (_ [path source-code]) + (do try.monad + [path (|> path + (text.replace-all (:: system separator) .module-separator) + tar.path) + source-code (tar.content source-code)] + (wrap (#tar.Normal [path + (instant.from-millis +0) + tar.none + ..no-ownership + source-code]))))) + (:: try.monad map row.from-list) + (:: promise.monad wrap)))) + +(def: #export (export system [sources target]) + (-> (file.System Promise) Export (Promise (Try Any))) + (let [package (format target (:: system separator) ..file)] (do (try.with promise.monad) - [package (: (Promise (Try (file.File Promise))) - (file.get-file promise.monad system package)) - files (io.enumerate system extension sources) - tar (|> (dictionary.entries files) - (monad.map try.monad - (function (_ [path source-code]) - (do try.monad - [path (|> path - (text.replace-all (:: system separator) .module-separator) - tar.path) - source-code (tar.content source-code)] - (wrap (#tar.Normal [path - (instant.from-millis +0) - tar.none - ..no-ownership - source-code]))))) - (:: try.monad map (|>> row.from-list (binary.run tar.writer))) - promise@wrap)] - (!.use (:: package over-write) tar)))) + [tar (..library system sources) + package (: (Promise (Try (file.File Promise))) + (file.get-file promise.monad system package))] + (!.use (:: package over-write) (binary.run tar.writer tar))))) |