From f3e869d0246e956399ec31a074c6c6299ff73602 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 8 Jul 2021 23:59:00 -0400 Subject: Made sure the "phase" parameter of extensions is always usable (even across language boundaries) --- stdlib/source/program/aedifex/artifact.lux | 23 +++++++- stdlib/source/program/aedifex/command/deps.lux | 23 +++++--- stdlib/source/program/aedifex/dependency.lux | 20 ++++++- .../program/aedifex/dependency/resolution.lux | 4 +- stdlib/source/program/aedifex/metadata.lux | 4 +- .../source/program/aedifex/metadata/snapshot.lux | 29 +++++---- stdlib/source/program/aedifex/parser.lux | 68 +++++++++++----------- 7 files changed, 110 insertions(+), 61 deletions(-) (limited to 'stdlib/source/program/aedifex') diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux index 9e87988ea..e5d37f7bb 100644 --- a/stdlib/source/program/aedifex/artifact.lux +++ b/stdlib/source/program/aedifex/artifact.lux @@ -2,10 +2,11 @@ [lux (#- Name) [abstract [equivalence (#+ Equivalence)] + [order (#+ Order)] [hash (#+ Hash)]] [data ["." product] - ["." text + ["." text ("#\." order) ["%" format (#+ Format)]] [collection ["." list ("#\." monoid)]]] @@ -40,6 +41,26 @@ (Equivalence Artifact) (\ ..hash &equivalence)) +(implementation: #export order + (Order Artifact) + + (def: &equivalence + ..equivalence) + + (def: (< reference subject) + (<| (or (text\< (get@ #group reference) + (get@ #group subject))) + + (and (text\= (get@ #group reference) + (get@ #group subject))) + (or (text\< (get@ #name reference) + (get@ #name subject))) + + (and (text\= (get@ #name reference) + (get@ #name subject))) + (text\< (get@ #version reference) + (get@ #version subject))))) + (template [ ] [(def: Text diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index de4817ba8..4dcc9d6e1 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -46,13 +46,20 @@ (list\fold dictionary.remove resolution) (///dependency/deployment.all local)) _ (console.write_line (exception.report - ["Local successes" (exception.enumerate ..format local_successes)] - ["Local failures" (exception.enumerate ..format local_failures)] - ["Remote successes" (let [remote_successes (|> remote_successes - (set.from_list ///dependency.hash) - (set.difference (set.from_list ///dependency.hash local_successes)) - set.to_list)] - (exception.enumerate ..format remote_successes))] - ["Remote failures" (exception.enumerate ..format remote_failures)]) + ["Local successes" (|> local_successes + (list.sort (\ ///dependency.order <)) + (exception.enumerate ..format))] + ["Local failures" (|> local_failures + (list.sort (\ ///dependency.order <)) + (exception.enumerate ..format))] + ["Remote successes" (|> remote_successes + (set.from_list ///dependency.hash) + (set.difference (set.from_list ///dependency.hash local_successes)) + set.to_list + (list.sort (\ ///dependency.order <)) + (exception.enumerate ..format))] + ["Remote failures" (|> remote_failures + (list.sort (\ ///dependency.order <)) + (exception.enumerate ..format))]) console)] (wrap resolution)))) diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux index b7b605447..f06b00260 100644 --- a/stdlib/source/program/aedifex/dependency.lux +++ b/stdlib/source/program/aedifex/dependency.lux @@ -2,13 +2,14 @@ [lux (#- Type) [abstract [equivalence (#+ Equivalence)] + [order (#+ Order)] [hash (#+ Hash)]] [data ["." product] - ["." text + ["." text ("#\." order) ["%" format (#+ format)]]]] ["." // #_ - ["#" artifact (#+ Artifact) + ["#" artifact (#+ Artifact) ("#\." order) [type (#+ Type)]]]) (type: #export Dependency @@ -25,3 +26,18 @@ (def: #export equivalence (Equivalence Dependency) (\ hash &equivalence)) + +(implementation: #export order + (Order Dependency) + + (def: &equivalence + ..equivalence) + + (def: (< reference subject) + (<| (or (//\< (get@ #artifact reference) + (get@ #artifact subject))) + + (and (//\= (get@ #artifact reference) + (get@ #artifact subject))) + (text\< (get@ #type reference) + (get@ #type subject))))) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 326f2ac2d..63c3e930d 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -169,8 +169,8 @@ text.new_line)))] ["?" announce_fetching "Fetching" "from"] - ["Y" announce_success "Found" "at"] - ["N" announce_failure "Missed" "from"] + ["O" announce_success "Found" "at"] + ["X" announce_failure "Missed" "from"] ) (def: #export (any console repositories dependency) diff --git a/stdlib/source/program/aedifex/metadata.lux b/stdlib/source/program/aedifex/metadata.lux index 7fbe88cbc..843f2e056 100644 --- a/stdlib/source/program/aedifex/metadata.lux +++ b/stdlib/source/program/aedifex/metadata.lux @@ -17,7 +17,7 @@ (def: #export (remote_artifact_uri artifact) (-> Artifact URI) (let [/ uri.separator] - (format (get@ #//artifact.group artifact) + (format (//artifact.directory / (get@ #//artifact.group artifact)) / (get@ #//artifact.name artifact) / (get@ #//artifact.version artifact) / ..remote_file))) @@ -25,7 +25,7 @@ (def: #export (remote_project_uri artifact) (-> Artifact URI) (let [/ uri.separator] - (format (get@ #//artifact.group artifact) + (format (//artifact.directory / (get@ #//artifact.group artifact)) / (get@ #//artifact.name artifact) / ..remote_file))) diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index 6eec0c32c..518e0404a 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -41,7 +41,8 @@ ["#/." type (#+ Type)] ["#/." versioning (#+ Versioning)] ["#/." snapshot - ["#/." version]]]]]) + ["#/." version] + ["#/." stamp]]]]]) (type: #export Metadata {#artifact Artifact @@ -93,18 +94,22 @@ [group (.somewhere (..text ..)) name (.somewhere (..text ..)) version (.somewhere (..text ..)) - versioning (\ ! map - (update@ #///artifact/versioning.versions - (: (-> (List ///artifact/snapshot/version.Version) - (List ///artifact/snapshot/version.Version)) - (|>> (case> (^ (list)) - (list {#///artifact/snapshot/version.extension ///artifact/type.jvm_library - #///artifact/snapshot/version.value version - #///artifact/snapshot/version.updated ///artifact/time.epoch}) + versioning (with_expansions [ {#///artifact/snapshot/version.extension ///artifact/type.jvm_library + #///artifact/snapshot/version.value version + #///artifact/snapshot/version.updated ///artifact/time.epoch}] + (|> (.somewhere ///artifact/versioning.parser) + (\ ! map + (update@ #///artifact/versioning.versions + (: (-> (List ///artifact/snapshot/version.Version) + (List ///artifact/snapshot/version.Version)) + (|>> (case> (^ (list)) + (list ) - versions - versions)))) - (.somewhere ///artifact/versioning.parser))] + versions + versions))))) + (<>.default {#///artifact/versioning.snapshot #///artifact/snapshot.Local + #///artifact/versioning.last_updated ///artifact/time.epoch + #///artifact/versioning.versions (list )})))] (wrap {#artifact {#///artifact.group group #///artifact.name name #///artifact.version version} diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 60e491dac..835b03729 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -4,7 +4,7 @@ [monad (#+ do)]] [control ["<>" parser - ["" code (#+ Parser)]]] + ["<.>" code (#+ Parser)]]] [data ["." text] [collection @@ -37,25 +37,25 @@ (def: (singular input tag parser) (All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser a))) - (.local (..as_input (dictionary.get tag input)) - parser)) + (.local (..as_input (dictionary.get tag input)) + parser)) (def: (plural input tag parser) (All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser (List a)))) - (.local (..as_input (dictionary.get tag input)) - (.tuple (<>.some parser)))) + (.local (..as_input (dictionary.get tag input)) + (.tuple (<>.some parser)))) (def: group (Parser //artifact.Group) - .text) + .text) (def: name (Parser //artifact.Name) - .text) + .text) (def: version (Parser //artifact.Version) - .text) + .text) (def: artifact' (Parser //artifact.Artifact) @@ -63,11 +63,11 @@ (def: artifact (Parser //artifact.Artifact) - (.tuple ..artifact')) + (.tuple ..artifact')) (def: url (Parser URL) - .text) + .text) (def: scm (Parser /.SCM) @@ -75,30 +75,30 @@ (def: description (Parser Text) - .text) + .text) (def: license (Parser /.License) (do {! <>.monad} [input (\ ! map (dictionary.from_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.record (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (..singular input "name" ..name) (..singular input "url" ..url) (<>.default #/.Repo (..singular input "type" - (<>.or (.this! (' #repo)) - (.this! (' #manual)))))))) + (<>.or (.this! (' #repo)) + (.this! (' #manual)))))))) (def: organization (Parser /.Organization) (do {! <>.monad} [input (\ ! map (dictionary.from_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.record (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (..singular input "name" ..name) (..singular input "url" ..url)))) @@ -108,8 +108,8 @@ (do {! <>.monad} [input (\ ! map (dictionary.from_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.record (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (..singular input "name" ..name) (..singular input "url" ..url) @@ -125,8 +125,8 @@ (do {! <>.monad} [input (\ ! map (dictionary.from_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.record (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (<>.maybe (..singular input "url" ..url)) (<>.maybe (..singular input "scm" ..scm)) @@ -143,11 +143,11 @@ (def: type (Parser //artifact/type.Type) - .text) + .text) (def: dependency (Parser //dependency.Dependency) - (.tuple + (.tuple ($_ <>.and ..artifact' (<>.default //artifact/type.lux_library ..type) @@ -155,32 +155,32 @@ (def: source (Parser /.Source) - .text) + .text) (def: target (Parser /.Target) - .text) + .text) (def: module (Parser Module) - .text) + .text) (def: deploy_repository (Parser (List [Text //repository.Address])) - (.record (<>.some - (<>.and .text - ..repository)))) + (.record (<>.some + (<>.and .text + ..repository)))) (def: profile (Parser /.Profile) (do {! <>.monad} [input (\ ! map (dictionary.from_list text.hash) - (.record (<>.some (<>.and .local_tag - .any)))) + (.record (<>.some (<>.and .local_tag + .any)))) #let [^parents (: (Parser (List /.Name)) (<>.default (list) - (..plural input "parents" .text))) + (..plural input "parents" .text))) ^identity (: (Parser (Maybe Artifact)) (<>.maybe (..singular input "identity" ..artifact))) @@ -236,7 +236,7 @@ multi_profile (: (Parser Project) (\ <>.monad map (dictionary.from_list text.hash) - (.record (<>.many (<>.and .text - ..profile)))))] + (.record (<>.many (<>.and .text + ..profile)))))] (<>.either multi_profile default_profile))) -- cgit v1.2.3