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/cache.lux | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'stdlib/source/program/aedifex/cache.lux') diff --git a/stdlib/source/program/aedifex/cache.lux b/stdlib/source/program/aedifex/cache.lux index 2a81b2869..ef72dc988 100644 --- a/stdlib/source/program/aedifex/cache.lux +++ b/stdlib/source/program/aedifex/cache.lux @@ -11,12 +11,14 @@ ["!" capability]]] [data [binary (#+ Binary)] + ["." product] [text ["%" format (#+ format)] ["." encoding]] [collection ["." dictionary] - ["." set]] + ["." set (#+ Set)] + ["." list]] [format ["." xml]]] [world @@ -25,7 +27,7 @@ ["#" local] ["#." hash] ["#." package (#+ Package)] - ["#." artifact + ["#." artifact (#+ Artifact) ["#/." extension]] [dependency (#+ Dependency) [resolution (#+ Resolution)]]]) @@ -38,7 +40,7 @@ (!.use (:: file over-write) [content]))) (def: #export (write-one system [artifact type] package) - (-> (file.System Promise) Dependency Package (Promise (Try Any))) + (-> (file.System Promise) Dependency Package (Promise (Try Artifact))) (do (try.with promise.monad) [directory (: (Promise (Try Path)) (file.make-directories promise.monad system (//.path system artifact))) @@ -63,15 +65,17 @@ _ (..write! system (|> package (get@ #//package.pom) (:: xml.codec encode) encoding.to-utf8) (format prefix //artifact/extension.pom))] - (wrap []))) + (wrap artifact))) (def: #export (write-all system resolution) - (-> (file.System Promise) Resolution (Promise (Try Any))) + (-> (file.System Promise) Resolution (Promise (Try (Set Artifact)))) (do {! (try.with promise.monad)} - [_ (monad.map ! (function (_ [dependency package]) - (..write-one system dependency package)) - (dictionary.entries resolution))] - (wrap []))) + [] + (|> (dictionary.entries resolution) + (list.filter (|>> product.right //package.local?)) + (monad.map ! (function (_ [dependency package]) + (..write-one system dependency package))) + (:: ! map (set.from-list //artifact.hash))))) (def: (read! system path) (-> (file.System Promise) Path (Promise (Try Binary))) @@ -103,7 +107,8 @@ [pom (..decode xml.codec pom) sha-1 (..decode //hash.sha-1-codec sha-1) md5 (..decode //hash.md5-codec md5)] - (wrap {#//package.library library + (wrap {#//package.origin #//package.Local + #//package.library library #//package.pom pom #//package.sha-1 sha-1 #//package.md5 md5})))))) -- cgit v1.2.3