From 9af671a34728b35c48bff2ba163c371dc5084946 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 10 Dec 2020 22:29:32 -0400 Subject: Render XML to text in an indented form for human readability. --- stdlib/source/program/aedifex/command/build.lux | 13 +++++----- stdlib/source/program/aedifex/command/deps.lux | 9 +++---- stdlib/source/program/aedifex/command/install.lux | 29 +++++++++++++---------- 3 files changed, 28 insertions(+), 23 deletions(-) (limited to 'stdlib/source/program/aedifex/command') diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 8960d9c75..de8ceb991 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -101,11 +101,11 @@ _ (exception.throw ..no-available-compiler []))) -(def: (libraries fs) - (All [!] (-> (file.System !) Resolution (List Path))) +(def: (libraries fs home) + (All [!] (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys (list.filter (|>> (get@ #///dependency.type) (text\= ///artifact/type.lux-library))) - (list\map (|>> (get@ #///dependency.artifact) (///local.path fs))))) + (list\map (|>> (get@ #///dependency.artifact) (///local.path fs home))))) (def: (singular name) (-> Text Text (List Text)) @@ -132,13 +132,14 @@ [(#.Some program-module) (#.Some target)] (do promise.monad [environment (\ program environment []) + home (\ program home []) working-directory (\ program directory [])] (do ///action.monad [[resolution compiler] (promise\wrap (..compiler resolution)) #let [[command output] (let [[compiler output] (case compiler - (#JVM artifact) [(///runtime.java (///local.path fs artifact)) + (#JVM artifact) [(///runtime.java (///local.path fs home artifact)) "program.jar"] - (#JS artifact) [(///runtime.node (///local.path fs artifact)) + (#JS artifact) [(///runtime.node (///local.path fs home artifact)) "program.js"])] [(format compiler " build") output]) / (\ fs separator) @@ -148,7 +149,7 @@ [environment working-directory command - (list.concat (list (..plural "--library" (..libraries fs resolution)) + (list.concat (list (..plural "--library" (..libraries fs home resolution)) (..plural "--source" (set.to-list (get@ #///.sources profile))) (..singular "--target" cache-directory) (..singular "--module" program-module)))]) diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index 67dc19e47..dbb277948 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -9,6 +9,7 @@ [collection ["." set (#+ Set)]]] [world + [program (#+ Program)] ["." file] ["." console (#+ Console)]]] ["." // #_ @@ -23,12 +24,12 @@ ["#." dependency #_ ["#/." resolution (#+ Resolution)]]]]) -(def: #export (do! console fs repositories profile) - (-> (Console Promise) (file.System Promise) (List (Repository Promise)) (Command Resolution)) +(def: #export (do! program console fs repositories profile) + (-> (Program Promise) (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) + cache (///cache.read-all program fs dependencies ///dependency/resolution.empty) resolution (///dependency/resolution.all repositories dependencies cache) - cached (///cache.write-all fs resolution) + cached (///cache.write-all program fs resolution) _ (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 327a0c119..d11d96a0c 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -21,6 +21,7 @@ ["." tar] ["." xml]]] [world + [program (#+ Program)] ["." file (#+ Path File)] ["." console (#+ Console)]]] [program @@ -47,21 +48,23 @@ (def: #export failure "Failure: No 'identity' defined for the project.") -(def: #export (do! console system profile) - (-> (Console Promise) (file.System Promise) (Command Any)) +(def: #export (do! program console system profile) + (-> (Program Promise) (Console Promise) (file.System Promise) (Command Any)) (case (get@ #/.identity profile) (#.Some identity) - (do ///action.monad - [package (export.library system (set.to-list (get@ #/.sources profile))) - repository (: (Promise (Try Path)) - (file.make-directories promise.monad system (///local.path system identity))) - #let [artifact-name (format repository (\ system separator) (///artifact.identity identity))] - _ (..save! system (binary.run tar.writer package) - (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))] - (console.write-line //clean.success console)) + (do promise.monad + [home (\ program home [])] + (do ///action.monad + [package (export.library system (set.to-list (get@ #/.sources profile))) + repository (: (Promise (Try Path)) + (file.make-directories promise.monad system (///local.path system home identity))) + #let [artifact-name (format repository (\ system separator) (///artifact.identity identity))] + _ (..save! system (binary.run tar.writer package) + (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))] + (console.write-line //clean.success console))) _ (console.write-line ..failure console))) -- cgit v1.2.3