aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program
diff options
context:
space:
mode:
authorEduardo Julian2020-10-14 21:48:00 -0400
committerEduardo Julian2020-10-14 21:48:00 -0400
commit440608bc32916329c9f3c0f2bd9a8d1152ed5da8 (patch)
treee27ae0f41a437c24275293b151b23e63bf938392 /stdlib/source/program
parent00d5ccbc043960037f644d4ff09b6a46fd0093d0 (diff)
Gave the Location type its own module.
Diffstat (limited to 'stdlib/source/program')
-rw-r--r--stdlib/source/program/aedifex/artifact/extension.lux37
-rw-r--r--stdlib/source/program/aedifex/dependency.lux12
-rw-r--r--stdlib/source/program/aedifex/extension.lux11
-rw-r--r--stdlib/source/program/aedifex/local.lux24
4 files changed, 55 insertions, 29 deletions
diff --git a/stdlib/source/program/aedifex/artifact/extension.lux b/stdlib/source/program/aedifex/artifact/extension.lux
new file mode 100644
index 000000000..04d40fec4
--- /dev/null
+++ b/stdlib/source/program/aedifex/artifact/extension.lux
@@ -0,0 +1,37 @@
+(.module:
+ [lux #*
+ [data
+ [text
+ ["%" format (#+ format)]]]]
+ ["." // #_
+ ["#" type]])
+
+(type: #export Extension
+ Text)
+
+(def: separator
+ ".")
+
+(def: #export extension
+ (-> //.Type Extension)
+ (|>> (format ..separator)))
+
+(def: #export lux-library
+ Extension
+ (..extension //.lux-library))
+
+(def: #export jvm-library
+ Extension
+ (..extension //.jvm-library))
+
+(def: #export pom
+ Extension
+ (..extension //.pom))
+
+(def: #export sha1
+ Extension
+ (format ..separator "sha1"))
+
+(def: #export md5
+ Extension
+ (format ..separator "md5"))
diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux
index 3128bb3f3..52a1f00c5 100644
--- a/stdlib/source/program/aedifex/dependency.lux
+++ b/stdlib/source/program/aedifex/dependency.lux
@@ -29,10 +29,10 @@
[net (#+ URL)
["." uri]]]]
["." // #_
- ["#." extension]
["#." hash]
["#." artifact (#+ Artifact)
- ["#/." type]]])
+ ["#/." type]
+ ["#/." extension]]])
(type: #export Repository
URL)
@@ -219,10 +219,10 @@
(let [[artifact type] dependency
prefix (format repository uri.separator (//artifact.path artifact))]
(do (try.with io.monad)
- [library (..download (format prefix "." type))
- sha1 (..verified-hash dependency library (format prefix //extension.sha1) //hash.sha1 ..sha1 ..sha1-does-not-match)
- md5 (..verified-hash dependency library (format prefix //extension.md5) //hash.md5 ..md5 ..md5-does-not-match)
- pom (..download (format prefix //extension.pom))]
+ [library (..download (format prefix (//artifact/extension.extension type)))
+ sha1 (..verified-hash dependency library (format prefix //artifact/extension.sha1) //hash.sha1 ..sha1 ..sha1-does-not-match)
+ md5 (..verified-hash dependency library (format prefix //artifact/extension.md5) //hash.md5 ..md5 ..md5-does-not-match)
+ pom (..download (format prefix //artifact/extension.pom))]
(:: io.monad wrap
(do try.monad
[pom (encoding.from-utf8 pom)
diff --git a/stdlib/source/program/aedifex/extension.lux b/stdlib/source/program/aedifex/extension.lux
deleted file mode 100644
index 6caa343aa..000000000
--- a/stdlib/source/program/aedifex/extension.lux
+++ /dev/null
@@ -1,11 +0,0 @@
-(.module:
- [lux #*])
-
-(def: #export sha1
- ".sha1")
-
-(def: #export md5
- ".md5")
-
-(def: #export pom
- ".pom")
diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux
index 60b5e8881..affbb659e 100644
--- a/stdlib/source/program/aedifex/local.lux
+++ b/stdlib/source/program/aedifex/local.lux
@@ -30,12 +30,12 @@
["." export]]]
["." // #_
["/" profile (#+ Profile)]
- ["#." extension]
["#." pom]
["#." dependency (#+ Package Resolution Dependency)]
["#." hash]
["#." artifact (#+ Artifact)
- ["#/." type]]])
+ ["#/." type]
+ ["#/." extension]]])
(def: (local system)
(All [a] (-> (file.System a) Path))
@@ -79,10 +79,10 @@
#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 "." //artifact/type.lux-library))
+ (format artifact-name //artifact/extension.lux-library))
pom (:: promise.monad wrap (//pom.project profile))]
(..save! system (|> pom (:: xml.codec encode) encoding.to-utf8)
- (format artifact-name //extension.pom)))
+ (format artifact-name //artifact/extension.pom)))
_
(:: promise.monad wrap (exception.throw /.no-identity []))))
@@ -96,16 +96,16 @@
(file.get-directory promise.monad system directory))
_ (..save! system
(get@ #//dependency.library package)
- (format prefix "." type))
+ (format prefix (//artifact/extension.extension type)))
_ (..save! system
(encoding.to-utf8 (get@ #//dependency.sha1 package))
- (format prefix //extension.sha1))
+ (format prefix //artifact/extension.sha1))
_ (..save! system
(encoding.to-utf8 (get@ #//dependency.md5 package))
- (format prefix //extension.md5))
+ (format prefix //artifact/extension.md5))
_ (..save! system
(|> package (get@ #//dependency.pom) (:: xml.codec encode) encoding.to-utf8)
- (format prefix //extension.pom))]
+ (format prefix //artifact/extension.pom))]
(wrap [])))
(def: #export (cache-all system resolution)
@@ -128,16 +128,16 @@
(do (try.with promise.monad)
[directory (..guarantee-repository! system artifact)
#let [prefix (format directory (:: system separator) (//artifact.identity artifact))]
- pom (..read! system (format prefix //extension.pom))
+ pom (..read! system (format prefix //artifact/extension.pom))
[pom dependencies] (:: promise.monad wrap
(do try.monad
[pom (encoding.from-utf8 pom)
pom (:: xml.codec decode pom)
dependencies (//dependency.from-pom pom)]
(wrap [pom dependencies])))
- library (..read! system (format prefix "." type))
- sha1 (..read! system (format prefix //extension.sha1))
- md5 (..read! system (format prefix //extension.md5))]
+ library (..read! system (format prefix (//artifact/extension.extension type)))
+ sha1 (..read! system (format prefix //artifact/extension.sha1))
+ md5 (..read! system (format prefix //artifact/extension.md5))]
(wrap {#//dependency.library library
#//dependency.pom pom
#//dependency.dependencies dependencies