From d89d837de3475b75587a4293e094d755d2cd4626 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 17 Nov 2020 20:23:53 -0400 Subject: Made the syntax of ^template more consistent. --- stdlib/source/program/aedifex.lux | 48 ++++++++++++++------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) (limited to 'stdlib/source/program/aedifex.lux') diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index a9b4c9514..a05dee430 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -32,8 +32,8 @@ [world ["." file (#+ Path)]]] ["." / #_ - [action (#+ Action)] ["#" profile] + ["#." action (#+ Action)] ["#." project (#+ Project)] ["#." input] ["#." parser] @@ -43,35 +43,21 @@ ["#." repository (#+ Address)] ["#." dependency #_ ["#" resolution]] - ["#." command + ["#." command (#+ Command) ["#/." clean] ["#/." pom] ["#/." install] + ["#/." deps] ["#/." build] ["#/." test] ["#/." auto] ["#/." deploy]]]) -(def: (fetch-dependencies! profile) - (-> /.Profile (Promise Any)) - (do promise.monad - [outcome (do (try.with promise.monad) - [cache (/cache.read-all (file.async file.default) - (set.to-list (get@ #/.dependencies profile)) - /dependency.empty) - resolution (promise.future - (/dependency.resolve-all (set.to-list (get@ #/.repositories profile)) - (set.to-list (get@ #/.dependencies profile)) - cache))] - (/cache.write-all (file.async file.default) - resolution))] - (wrap (case outcome - (#try.Success _) - (log! "Successfully resolved dependencies!") - - (#try.Failure error) - (log! (format "Could not resolve dependencies:" text.new-line - error)))))) +(def: (with-dependencies command profile) + (All [a] (-> (Command a) (Command a))) + (do /action.monad + [_ (/command/deps.do! profile)] + (command profile))) (exception: (cannot-find-repository {repository Text} {options (Dictionary Text Address)}) @@ -95,10 +81,6 @@ (exec (/command/pom.do! (file.async file.default) profile) (wrap [])) - #/cli.Dependencies - (exec (..fetch-dependencies! profile) - (wrap [])) - #/cli.Install (exec (/command/install.do! (file.async file.default) profile) (wrap [])) @@ -107,7 +89,7 @@ (exec (case [(get@ #/.identity profile) (dictionary.get repository (get@ #/.deploy-repositories profile))] [(#.Some artifact) (#.Some repository)] - (/command/deploy.do! (/repository.async (/repository.default repository)) + (/command/deploy.do! (/repository.async (/repository.remote repository)) (file.async file.default) identity artifact @@ -120,17 +102,21 @@ (promise@wrap (exception.throw ..cannot-find-repository [repository (get@ #/.deploy-repositories profile)]))) (wrap [])) + #/cli.Dependencies + (exec (/command/deps.do! profile) + (wrap [])) + (#/cli.Compilation compilation) (case compilation - #/cli.Build (exec (/command/build.do! profile) + #/cli.Build (exec (..with-dependencies /command/build.do! profile) (wrap [])) - #/cli.Test (exec (/command/test.do! profile) + #/cli.Test (exec (..with-dependencies /command/test.do! profile) (wrap []))) (#/cli.Auto auto) (exec (case auto - #/cli.Build (/command/auto.do! /command/build.do! profile) - #/cli.Test (/command/auto.do! /command/test.do! profile)) + #/cli.Build (..with-dependencies (/command/auto.do! /command/build.do!) profile) + #/cli.Test (..with-dependencies (/command/auto.do! /command/test.do!) profile)) (wrap []))) (#try.Failure error) -- cgit v1.2.3