aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2020-10-12 20:22:31 -0400
committerEduardo Julian2020-10-12 20:22:31 -0400
commit00d5ccbc043960037f644d4ff09b6a46fd0093d0 (patch)
tree9515edc59fb511fa30e68c832d669654853ff702 /stdlib/source/program/aedifex
parent5b222d040ee361dd4022e88488a6bcef3ca40a71 (diff)
Type-checking macros via the Macro' type from the standard library.
Diffstat (limited to 'stdlib/source/program/aedifex')
-rw-r--r--stdlib/source/program/aedifex/artifact/type.lux16
-rw-r--r--stdlib/source/program/aedifex/command/build.lux7
-rw-r--r--stdlib/source/program/aedifex/command/deploy.lux10
-rw-r--r--stdlib/source/program/aedifex/dependency.lux25
-rw-r--r--stdlib/source/program/aedifex/format.lux7
-rw-r--r--stdlib/source/program/aedifex/local.lux7
-rw-r--r--stdlib/source/program/aedifex/parser.lux9
7 files changed, 45 insertions, 36 deletions
diff --git a/stdlib/source/program/aedifex/artifact/type.lux b/stdlib/source/program/aedifex/artifact/type.lux
new file mode 100644
index 000000000..e5836d13f
--- /dev/null
+++ b/stdlib/source/program/aedifex/artifact/type.lux
@@ -0,0 +1,16 @@
+(.module:
+ [lux (#- Type)])
+
+## https://maven.apache.org/ref/3.6.3/maven-core/artifact-handlers.html
+(type: #export Type
+ Text)
+
+(template [<type> <name>]
+ [(def: #export <name>
+ Type
+ <type>)]
+
+ ["tar" lux-library]
+ ["jar" jvm-library]
+ ["pom" pom]
+ )
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index eb7842e45..2c4b26aed 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -25,9 +25,10 @@
["#." action]
["#." command (#+ Command)]
["#." local]
- ["#." artifact (#+ Group Name Artifact)]
["#." dependency (#+ Dependency Resolution)]
- ["#." shell]])
+ ["#." shell]
+ ["#." artifact (#+ Group Name Artifact)
+ ["#/." type]]])
(type: Finder
(-> Resolution (Maybe Dependency)))
@@ -86,7 +87,7 @@
(def: libraries
(-> Resolution (List Path))
(|>> dictionary.keys
- (list.filter (|>> (get@ #///dependency.type) (text@= ///dependency.lux-library)))
+ (list.filter (|>> (get@ #///dependency.type) (text@= ///artifact/type.lux-library)))
(list@map (|>> (get@ #///dependency.artifact) (///local.path file.system)))))
(import: java/lang/String)
diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux
index 1081322b4..a4b076733 100644
--- a/stdlib/source/program/aedifex/command/deploy.lux
+++ b/stdlib/source/program/aedifex/command/deploy.lux
@@ -30,7 +30,9 @@
["#." command (#+ Command)]
["#." dependency]
["#." pom]
- ["#." hash]])
+ ["#." hash]
+ ["#." artifact
+ ["#/." type]]])
(exception: #export (cannot-find-repository {repository Text}
{options (Dictionary Text ///dependency.Repository)})
@@ -51,7 +53,7 @@
(promise@wrap (exception.throw ..cannot-find-repository [repository (get@ #/.deploy-repositories profile)]))
[(#.Some identity) (#.Some repository)]
- (let [deploy! (: (-> ///dependency.Type Binary (Action Any))
+ (let [deploy! (: (-> ///artifact/type.Type Binary (Action Any))
(function (_ type content)
(promise.future
(//.upload repository
@@ -65,8 +67,8 @@
(export.library (file.async file.system)
(set.to-list (get@ #/.sources profile))))
pom (promise@wrap (///pom.project profile))
- _ (deploy! ///dependency.pom (|> pom (:: xml.codec encode) encoding.to-utf8))
- _ (deploy! ///dependency.lux-library library)
+ _ (deploy! ///artifact/type.pom (|> pom (:: xml.codec encode) encoding.to-utf8))
+ _ (deploy! ///artifact/type.lux-library library)
_ (deploy! "sha1" (///hash.sha1 library))
_ (deploy! "md5" (///hash.md5 library))]
(wrap [])))))
diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux
index 2086a4d06..3128bb3f3 100644
--- a/stdlib/source/program/aedifex/dependency.lux
+++ b/stdlib/source/program/aedifex/dependency.lux
@@ -1,5 +1,5 @@
(.module:
- [lux (#- Name Type)
+ [lux (#- Name)
["." host (#+ import:)]
[abstract
[monad (#+ do)]
@@ -30,19 +30,16 @@
["." uri]]]]
["." // #_
["#." extension]
- ["#." artifact (#+ Artifact)]
- ["#." hash]])
+ ["#." hash]
+ ["#." artifact (#+ Artifact)
+ ["#/." type]]])
(type: #export Repository
URL)
-## https://maven.apache.org/ref/3.6.3/maven-core/artifact-handlers.html
-(type: #export Type
- Text)
-
(type: #export Dependency
{#artifact Artifact
- #type ..Type})
+ #type //artifact/type.Type})
(def: #export equivalence
(Equivalence Dependency)
@@ -58,16 +55,6 @@
text.hash
))
-(template [<type> <name>]
- [(def: #export <name>
- Type
- <type>)]
-
- ["tar" lux-library]
- ["jar" jvm-library]
- ["pom" pom]
- )
-
(import: java/lang/String)
(import: java/lang/AutoCloseable
@@ -200,7 +187,7 @@
#//artifact.version version}
#type (|> properties
(dictionary.get ["" "type"])
- (maybe.default ..lux-library))})))))
+ (maybe.default //artifact/type.lux-library))})))))
(def: parse-dependencies
(Parser (List Dependency))
diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux
index 1107f4d13..4ec8b8ae6 100644
--- a/stdlib/source/program/aedifex/format.lux
+++ b/stdlib/source/program/aedifex/format.lux
@@ -11,8 +11,9 @@
["." // #_
["/" profile]
["#." project (#+ Project)]
- ["#." artifact (#+ Artifact)]
- ["#." dependency (#+ Dependency)]])
+ ["#." dependency (#+ Dependency)]
+ ["#." artifact (#+ Artifact)
+ ["#/." type]]])
(type: #export (Format a)
(-> a Code))
@@ -125,7 +126,7 @@
(def: (dependency [artifact type])
(Format Dependency)
- (if (text@= //dependency.lux-library type)
+ (if (text@= //artifact/type.lux-library type)
(` [(~+ (..artifact' artifact))])
(` [(~+ (..artifact' artifact))
(~ (code.text type))])))
diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux
index 1b8a02f1a..60b5e8881 100644
--- a/stdlib/source/program/aedifex/local.lux
+++ b/stdlib/source/program/aedifex/local.lux
@@ -32,9 +32,10 @@
["/" profile (#+ Profile)]
["#." extension]
["#." pom]
- ["#." artifact (#+ Artifact)]
["#." dependency (#+ Package Resolution Dependency)]
- ["#." hash]])
+ ["#." hash]
+ ["#." artifact (#+ Artifact)
+ ["#/." type]]])
(def: (local system)
(All [a] (-> (file.System a) Path))
@@ -78,7 +79,7 @@
#let [artifact-name (format repository (:: system separator) (//artifact.identity identity))]
package (export.library system (set.to-list (get@ #/.sources profile)))
_ (..save! system (binary.run tar.writer package)
- (format artifact-name "." //dependency.lux-library))
+ (format artifact-name "." //artifact/type.lux-library))
pom (:: promise.monad wrap (//pom.project profile))]
(..save! system (|> pom (:: xml.codec encode) encoding.to-utf8)
(format artifact-name //extension.pom)))
diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux
index 1799db09e..867b3b81f 100644
--- a/stdlib/source/program/aedifex/parser.lux
+++ b/stdlib/source/program/aedifex/parser.lux
@@ -20,8 +20,9 @@
["." // #_
["/" profile]
["#." project (#+ Project)]
- ["#." artifact (#+ Artifact)]
- ["#." dependency]])
+ ["#." dependency]
+ ["#." artifact (#+ Artifact)
+ ["#/." type]]])
(def: (as-input input)
(-> (Maybe Code) (List Code))
@@ -139,7 +140,7 @@
..url)
(def: type
- (Parser //dependency.Type)
+ (Parser //artifact/type.Type)
<c>.text)
(def: dependency
@@ -147,7 +148,7 @@
(<c>.tuple
($_ <>.and
..artifact'
- (<>.default //dependency.lux-library ..type)
+ (<>.default //artifact/type.lux-library ..type)
)))
(def: source