aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program
diff options
context:
space:
mode:
authorEduardo Julian2021-07-11 01:51:04 -0400
committerEduardo Julian2021-07-11 01:51:04 -0400
commitabe24425ced15fd784ef6c62d6f186af72b491db (patch)
tree42b6e3cbd179c83fae8941fa4b128b13afc766f5 /stdlib/source/program
parent4610968193df10af12c91f699fec39aeb3ef703a (diff)
Re-named ":coerce" to ":as" since it technically doesn't do coercions.
Diffstat (limited to 'stdlib/source/program')
-rw-r--r--stdlib/source/program/aedifex/command/build.lux4
-rw-r--r--stdlib/source/program/aedifex/command/deps.lux4
-rw-r--r--stdlib/source/program/aedifex/command/install.lux1
-rw-r--r--stdlib/source/program/aedifex/command/test.lux2
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux4
-rw-r--r--stdlib/source/program/aedifex/format.lux1
-rw-r--r--stdlib/source/program/aedifex/parser.lux4
-rw-r--r--stdlib/source/program/aedifex/profile.lux19
-rw-r--r--stdlib/source/program/aedifex/repository/local.lux21
-rw-r--r--stdlib/source/program/scriptum.lux2
10 files changed, 42 insertions, 20 deletions
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index 572ebf0f0..ea2637d54 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -174,8 +174,8 @@
(#.Some program_module)
(do promise.monad
[environment (program.environment promise.monad program)
- home (\ program home [])
- working_directory (\ program directory [])]
+ #let [home (\ program home)
+ working_directory (\ program directory)]]
(do ///action.monad
[[resolution compiler] (promise\wrap (..compiler resolution))
#let [[[command compiler_params] output] (case compiler
diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux
index e4881986b..416544e01 100644
--- a/stdlib/source/program/aedifex/command/deps.lux
+++ b/stdlib/source/program/aedifex/command/deps.lux
@@ -39,7 +39,9 @@
(def: #export (do! console local remotes new_repository profile)
(-> (Console Promise) (Repository Promise) (List (Repository Promise)) (-> URL (Repository Promise)) (Command Resolution))
(do promise.monad
- [#let [dependencies (set.to_list (get@ #///.dependencies profile))]
+ [#let [dependencies (|> (get@ #///.dependencies profile)
+ set.to_list
+ (#.Cons (get@ #///.compiler profile)))]
[local_successes local_failures cache] (///dependency/resolution.all console
(list local)
new_repository
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index 64830c4d2..39bdea8b2 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -10,7 +10,6 @@
[data
[binary (#+ Binary)]
[text
- ["%" format (#+ format)]
[encoding
["." utf8]]]
[collection
diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux
index e8b5a2a23..9ac6b9c10 100644
--- a/stdlib/source/program/aedifex/command/test.lux
+++ b/stdlib/source/program/aedifex/command/test.lux
@@ -34,7 +34,7 @@
(-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command Any))
(do promise.monad
[environment (program.environment promise.monad program)
- working_directory (\ program directory [])]
+ #let [working_directory (\ program directory)]]
(do ///action.monad
[[compiler program] (//build.do! console program fs shell resolution
(set@ #///.program (get@ #///.test profile) profile))
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index 2cbb469ab..698678f41 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -82,9 +82,9 @@
(case ?actual
(#try.Success actual)
(wrap (do {! try.monad}
- [output (\ ! map (|>> (:coerce java/lang/String)
+ [output (\ ! map (|>> (:as java/lang/String)
java/lang/String::trim
- (:coerce Text))
+ (:as Text))
(\ utf8.codec decode actual))
actual (|> output
(text.split_all_with " ")
diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux
index 7778e7641..9b44eced5 100644
--- a/stdlib/source/program/aedifex/format.lux
+++ b/stdlib/source/program/aedifex/format.lux
@@ -139,6 +139,7 @@
(..on_maybe "info" (get@ #/.info value) ..info)
(..on_set "repositories" (get@ #/.repositories value) code.text)
(..on_set "dependencies" (get@ #/.dependencies value) ..dependency)
+ (dictionary.put "compiler" (..dependency (get@ #/.compiler value)))
(..on_set "sources" (get@ #/.sources value) code.text)
(dictionary.put "target" (code.text (get@ #/.target value)))
(..on_maybe "program" (get@ #/.program value) code.text)
diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux
index 835b03729..8d0fcdf73 100644
--- a/stdlib/source/program/aedifex/parser.lux
+++ b/stdlib/source/program/aedifex/parser.lux
@@ -196,6 +196,9 @@
(|> (..plural input "dependencies" ..dependency)
(\ ! map (set.from_list //dependency.hash))
(<>.default (set.new //dependency.hash))))
+ ^compiler (|> ..dependency
+ (..singular input "compiler")
+ (<>.default /.default_compiler))
^sources (: (Parser (Set /.Source))
(|> (..plural input "sources" ..source)
(\ ! map (set.from_list text.hash))
@@ -220,6 +223,7 @@
^info
^repositories
^dependencies
+ ^compiler
^sources
^target
^program
diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux
index eb686cc15..d31d0aca9 100644
--- a/stdlib/source/program/aedifex/profile.lux
+++ b/stdlib/source/program/aedifex/profile.lux
@@ -22,11 +22,17 @@
[archive
[descriptor (#+ Module)]]]]]]
[//
- ["." artifact (#+ Artifact)]
- ["." dependency]
+ ["." dependency (#+ Dependency) ("#\." equivalence)]
+ ["." artifact (#+ Artifact)
+ ["." type]]
[repository
[remote (#+ Address)]]])
+(def: #export default_compiler
+ Dependency
+ {#dependency.artifact ["com.github.luxlang" "lux-jvm" "0.6.0-SNAPSHOT"]
+ #dependency.type type.jvm_library})
+
(type: #export Distribution
#Repo
#Manual)
@@ -148,7 +154,8 @@
#identity (Maybe Artifact)
#info (Maybe Info)
#repositories (Set Address)
- #dependencies (Set dependency.Dependency)
+ #dependencies (Set Dependency)
+ #compiler Dependency
#sources (Set Source)
#target Target
#program (Maybe Module)
@@ -168,6 +175,8 @@
set.equivalence
## #dependencies
set.equivalence
+ ## #compiler
+ dependency.equivalence
## #sources
set.equivalence
## #target
@@ -188,6 +197,7 @@
#info #.None
#repositories (set.new text.hash)
#dependencies (set.new dependency.hash)
+ #compiler default_compiler
#sources (set.new text.hash)
#target ..default_target
#program #.None
@@ -200,6 +210,9 @@
#info (maybe\compose (get@ #info override) (get@ #info baseline))
#repositories (set.union (get@ #repositories baseline) (get@ #repositories override))
#dependencies (set.union (get@ #dependencies baseline) (get@ #dependencies override))
+ #compiler (if (dependency\= ..default_compiler (get@ #compiler override))
+ (get@ #compiler baseline)
+ (get@ #compiler override))
#sources (set.union (get@ #sources baseline) (get@ #sources override))
#target (if (text\= ..default_target (get@ #target baseline))
(get@ #target override)
diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux
index b4ba0e22c..b68425609 100644
--- a/stdlib/source/program/aedifex/repository/local.lux
+++ b/stdlib/source/program/aedifex/repository/local.lux
@@ -19,32 +19,35 @@
["#." local]
["#." metadata]]])
-(def: (root /)
- (-> Text file.Path)
- (text.replace_all uri.separator / ///local.repository))
+(def: (root program /)
+ (-> (Program Promise) Text file.Path)
+ (|> ///local.repository
+ (text.replace_all uri.separator /)
+ (format (\ program home) /)))
(def: (path /)
(-> Text (-> URI file.Path))
(text.replace_all uri.separator /))
-(def: (absolute_path /)
- (-> Text (-> URI file.Path))
+(def: (absolute_path program /)
+ (-> (Program Promise) Text (-> URI file.Path))
(|>> ///metadata.local_uri
(..path /)
- (format (..root /) /)))
+ (format (..root program /) /)))
(implementation: #export (repository program fs)
(-> (Program Promise) (file.System Promise) (//.Repository Promise))
(def: description
- (..root (\ fs separator)))
+ (..root program (\ fs separator)))
+
(def: download
- (|>> (..absolute_path (\ fs separator))
+ (|>> (..absolute_path program (\ fs separator))
(\ fs read)))
(def: (upload uri content)
(do {! promise.monad}
- [#let [absolute_path (..absolute_path (\ fs separator) uri)]
+ [#let [absolute_path (..absolute_path program (\ fs separator) uri)]
? (\ fs file? absolute_path)
_ (if ?
(wrap [])
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index a32a14f8f..0d86b0f1c 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -280,7 +280,7 @@
(cond (type\= .Type def-type)
(update@ #types
(: (Mutation (List Value))
- (|>> (#.Cons [name def-annotations (:coerce Type def-value)])))
+ (|>> (#.Cons [name def-annotations (:as Type def-value)])))
organization)
(type\= .Macro def-type)