aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--lux-bootstrapper/src/lux/base.clj9
-rw-r--r--stdlib/source/library/lux.lux16
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/plist.lux37
-rw-r--r--stdlib/source/library/lux/meta.lux16
-rw-r--r--stdlib/source/library/lux/meta/configuration.lux103
-rw-r--r--stdlib/source/library/lux/meta/version.lux47
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/init.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux13
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux.lux7
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux5
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/version.lux9
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cli.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux3
-rw-r--r--stdlib/source/program/aedifex/command/build.lux15
-rw-r--r--stdlib/source/program/aedifex/command/deploy.lux107
-rw-r--r--stdlib/source/program/aedifex/command/install.lux87
-rw-r--r--stdlib/source/program/aedifex/command/version.lux31
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux5
-rw-r--r--stdlib/source/program/aedifex/format.lux3
-rw-r--r--stdlib/source/program/aedifex/hash.lux44
-rw-r--r--stdlib/source/program/aedifex/parser.lux26
-rw-r--r--stdlib/source/program/aedifex/profile.lux15
-rw-r--r--stdlib/source/program/aedifex/repository/identity.lux23
-rw-r--r--stdlib/source/program/aedifex/repository/remote.lux61
-rw-r--r--stdlib/source/program/compositor.lux4
-rw-r--r--stdlib/source/test/lux/macro.lux5
-rw-r--r--stdlib/source/test/lux/macro/syntax/definition.lux5
-rw-r--r--stdlib/source/test/lux/meta.lux51
-rw-r--r--stdlib/source/test/lux/meta/configuration.lux90
-rw-r--r--stdlib/source/test/lux/meta/version.lux55
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux20
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux7
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux11
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux11
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux8
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux7
-rw-r--r--stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux8
-rw-r--r--stdlib/source/test/lux/tool/compiler/meta/cli.lux16
42 files changed, 719 insertions, 326 deletions
diff --git a/changelog.md b/changelog.md
index 74d4372dc..688793326 100644
--- a/changelog.md
+++ b/changelog.md
@@ -3,6 +3,9 @@
## [Un-released]
### Added
* Inline functions.
+* Can pass configuration parameters from the build description to the compiler.
+* Can select code based on configuration parameters.
+* Can select code based on compiler version.
### Changed
### Removed
### Fixed
diff --git a/lux-bootstrapper/src/lux/base.clj b/lux-bootstrapper/src/lux/base.clj
index 42172b836..1cc169c28 100644
--- a/lux-bootstrapper/src/lux/base.clj
+++ b/lux-bootstrapper/src/lux/base.clj
@@ -140,7 +140,8 @@
(deftuple
["target"
"version"
- "mode"])
+ "mode"
+ "configuration"])
;; Hosts
(defvariant
@@ -229,7 +230,7 @@
(def ^:const module-class-name "_")
(def ^:const +name-separator+ ".")
-(def ^:const ^String version "0.6.0")
+(def ^:const ^String version "00.07.00")
;; Constructors
(def empty-location (T ["" -1 -1]))
@@ -832,7 +833,9 @@
;; version
version
;; mode
- mode]
+ mode
+ ;; configuration
+ $End]
))
(defn init-state [name mode host-data]
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 69f555fee..20122f66c 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -566,9 +566,10 @@
... (type: .public Info
... (Record
-... [#target Text
-... #version Text
-... #mode Mode]))
+... [#target Text
+... #version Text
+... #mode Mode
+... #configuration (List [Text Text])]))
("lux def type tagged" Info
{#Named [..prelude_module "Info"]
{#Product
@@ -577,9 +578,12 @@
{#Product
... version
Text
- ... mode
- Mode}}}
- ["#target" "#version" "#mode"]
+ {#Product
+ ... mode
+ Mode
+ ... configuration
+ {#Apply {#Product Text Text} List}}}}}
+ ["#target" "#version" "#mode" "#configuration"]
.public)
... (type: .public Lux
diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
index d646287c8..7eb2f4001 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
@@ -1,16 +1,17 @@
(.using
- [library
- [lux "*"
- [abstract
- [equivalence {"+" Equivalence}]]
- [data
- ["[0]" product]
- ["[0]" text ("[1]#[0]" equivalence)]
- [collection
- ["[0]" list ("[1]#[0]" functor)]]]
- [math
- [number
- ["n" nat]]]]])
+ [library
+ [lux "*"
+ [abstract
+ [equivalence {"+" Equivalence}]
+ [monoid {"+" Monoid}]]
+ [data
+ ["[0]" product]
+ ["[0]" text ("[1]#[0]" equivalence)]
+ [collection
+ ["[0]" list ("[1]#[0]" functor mix)]]]
+ [math
+ [number
+ ["n" nat]]]]])
... https://en.wikipedia.org/wiki/Property_list
(type: .public (PList a)
@@ -97,3 +98,15 @@
(All (_ a) (-> (Equivalence a) (Equivalence (PList a))))
(|>> (product.equivalence text.equivalence)
list.equivalence))
+
+(implementation: .public monoid
+ (All (_ a) (Monoid (PList a)))
+
+ (def: identity
+ ..empty)
+
+ (def: (composite left right)
+ (list#mix (function (_ [key val] it)
+ (..has key val it))
+ right
+ left)))
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index d16ca46b9..8bf80bce5 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -665,8 +665,14 @@
{try.#Failure error}
{try.#Success [lux {try.#Failure error}]})))
-(def: .public target
- (Meta Text)
- (function (_ lux)
- {try.#Success [lux
- (value@ [.#info .#target] lux)]}))
+(template [<type> <name> <slot>]
+ [(def: .public <name>
+ (Meta <type>)
+ (function (_ lux)
+ {try.#Success [lux
+ (value@ [.#info <slot>] lux)]}))]
+
+ [Text target .#target]
+ [Text version .#version]
+ [(List [Text Text]) configuration .#configuration]
+ )
diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux
new file mode 100644
index 000000000..057466051
--- /dev/null
+++ b/stdlib/source/library/lux/meta/configuration.lux
@@ -0,0 +1,103 @@
+(.using
+ [library
+ [lux {"-" for}
+ ["[0]" meta]
+ [abstract
+ [equivalence {"+" Equivalence}]
+ [monoid {"+" Monoid}]
+ [monad {"+" do}]]
+ [control
+ ["[0]" maybe ("[1]#[0]" functor)]
+ ["[0]" exception {"+" exception:}]
+ ["<>" parser
+ ["<[0]>" text {"+" Parser}]
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text ("[1]#[0]" equivalence)
+ ["%" format]]
+ [collection
+ ["[0]" list ("[1]#[0]" functor mix)]
+ [dictionary
+ ["/" plist]]]]
+ [macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [math
+ [number {"+" hex}]]]])
+
+(type: .public Configuration
+ (/.PList Text))
+
+(def: .public equivalence
+ (Equivalence Configuration)
+ (/.equivalence text.equivalence))
+
+(def: .public monoid
+ (Monoid Configuration)
+ /.monoid)
+
+(def: .public empty
+ Configuration
+ /.empty)
+
+(template [<ascii> <name>]
+ [(def: <name>
+ Text
+ (text.of_char (hex <ascii>)))]
+
+ ["02" start]
+ ["03" end]
+ )
+
+(def: format'
+ (-> Text Text)
+ (text.enclosed [..start ..end]))
+
+(def: .public format
+ (%.Format Configuration)
+ (|>> (list#each (function (_ [feature value])
+ (%.format (..format' feature) (..format' value))))
+ text.together))
+
+(def: .public parser
+ (Parser Configuration)
+ (let [parser' (: (Parser Text)
+ (<| (<>.after (<text>.this ..start))
+ (<>.before (<text>.this ..end))
+ (<text>.slice (<text>.some! (<text>.none_of! ..end)))))]
+ (<>.some (<>.and parser' parser'))))
+
+(exception: .public invalid)
+
+(def: configuration
+ (<code>.Parser Configuration)
+ (<code>.tuple (<>.some (<>.and <code>.text <code>.text))))
+
+(def: (subsumes? actual expected)
+ (-> Configuration Configuration Bit)
+ (case expected
+ {.#End}
+ true
+
+ {.#Item [feature value] tail}
+ (and (|> actual
+ (/.value feature)
+ (maybe#each (text#= value))
+ (maybe.else false))
+ (subsumes? expected tail))))
+
+(syntax: .public (for [specializations (<code>.tuple (<>.some (<>.and ..configuration <code>.any)))
+ default (<>.maybe <code>.any)])
+ (do meta.monad
+ [actual meta.configuration]
+ (case (list#mix (function (_ [expected then] choice)
+ (if (subsumes? actual expected)
+ {.#Some then}
+ choice))
+ default
+ specializations)
+ {.#Some it}
+ (in (list it))
+
+ {.#None}
+ (meta.failure (exception.error ..invalid [])))))
diff --git a/stdlib/source/library/lux/meta/version.lux b/stdlib/source/library/lux/meta/version.lux
new file mode 100644
index 000000000..66bf8e6f5
--- /dev/null
+++ b/stdlib/source/library/lux/meta/version.lux
@@ -0,0 +1,47 @@
+(.using
+ [library
+ [lux {"-" for}
+ ["[0]" meta]
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" exception {"+" exception:}]
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text ("[1]#[0]" equivalence)]
+ [collection
+ ["[0]" list ("[1]#[0]" mix)]]]
+ [macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [tool
+ [compiler
+ [version {"+" Version}]]]]])
+
+(def: .public latest
+ Version
+ 00,06,06)
+
+(syntax: .public (current [])
+ (do meta.monad
+ [it meta.version]
+ (in (list (code.text it)))))
+
+(exception: .public invalid)
+
+(syntax: .public (for [specializations (<code>.tuple (<>.some (<>.and <code>.text <code>.any)))
+ default (<>.maybe <code>.any)])
+ (do meta.monad
+ [current meta.version]
+ (case (list#mix (function (_ [when then] choice)
+ (if (text#= when current)
+ {.#Some then}
+ choice))
+ default
+ specializations)
+ {.#Some it}
+ (in (list it))
+
+ {.#None}
+ (meta.failure (exception.error ..invalid [])))))
diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux
index fc7e1b637..7f815abf9 100644
--- a/stdlib/source/library/lux/tool/compiler/default/init.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/init.lux
@@ -18,6 +18,9 @@
["[0]" dictionary]
["[0]" set]
["[0]" sequence ("[1]#[0]" functor)]]]
+ [meta
+ ["[0]" configuration {"+" Configuration}]
+ ["[0]" version]]
[world
["[0]" file]]]]
["[0]" // "_"
@@ -26,7 +29,6 @@
[language
[lux
[program {"+" Program}]
- ["[1][0]" version]
["[1][0]" syntax {"+" Aliases}]
["[1][0]" synthesis]
["[1][0]" directive {"+" Requirements}]
@@ -51,10 +53,11 @@
["[0]" descriptor]
["[0]" document]]]]]])
-(def: .public (state target module expander host_analysis host generate generation_bundle)
+(def: .public (state target module configuration expander host_analysis host generate generation_bundle)
(All (_ anchor expression directive)
(-> Target
descriptor.Module
+ Configuration
Expander
///analysis.Bundle
(///generation.Host expression directive)
@@ -65,7 +68,7 @@
generation_state [generation_bundle (///generation.state host module)]
eval (///analysis/evaluation.evaluator expander synthesis_state generation_state generate)
analysis_state [(analysisE.bundle eval host_analysis)
- (///analysis.state (///analysis.info ///version.version target))]]
+ (///analysis.state (///analysis.info version.latest target configuration))]]
[extension.empty
[///directive.#analysis [///directive.#state analysis_state
///directive.#phase (analysisP.phase expander)]
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 2ddc8a689..f489c1fb8 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -3,7 +3,6 @@
[lux "*"
["@" target]
["[0]" debug]
- ["[0]" meta]
[abstract
["[0]" monad {"+" Monad do}]]
[control
@@ -27,6 +26,8 @@
["[0]" list ("[1]#[0]" monoid functor mix)]]
[format
["_" binary {"+" Writer}]]]
+ ["[0]" meta
+ ["[0]" configuration {"+" Configuration}]]
[type {"+" :sharing}
["[0]" check]]
[world
@@ -40,7 +41,6 @@
[lux
[program {"+" Program}]
["$" /]
- ["[1][0]" version]
["[0]" syntax]
["[1][0]" synthesis]
["[1][0]" generation {"+" Buffer}]
@@ -240,7 +240,7 @@
(dictionary.merged directives (host_directive_bundle phase_wrapper))])
(def: .public (initialize context module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender
- import compilation_sources)
+ import compilation_sources compilation_configuration)
(All (_ <type_vars>)
(-> Context
descriptor.Module
@@ -251,18 +251,19 @@
(-> ///phase.Wrapper (///directive.Bundle <type_vars>))
(Program expression directive)
[Type Type Type] (-> ///phase.Wrapper Extender)
- Import (List _io.Context)
+ Import (List _io.Context) Configuration
(Async (Try [<State+> Archive ///phase.Wrapper]))))
(do [! (try.with async.monad)]
[.let [state (//init.state (value@ context.#host context)
module
+ compilation_configuration
expander
host_analysis
(value@ #host platform)
(value@ #phase platform)
generation_bundle)]
_ (cache.enable! (value@ #&file_system platform) context)
- [archive analysis_state bundles] (ioW.thaw (value@ #host platform) (value@ #&file_system platform) context import compilation_sources)
+ [archive analysis_state bundles] (ioW.thaw compilation_configuration (value@ #host platform) (value@ #&file_system platform) context import compilation_sources)
.let [with_missing_extensions
(: (All (_ <type_vars>)
(-> <Platform> (Program expression directive) <State+>
@@ -753,7 +754,7 @@
(def: .public (compile phase_wrapper import file_context expander platform compilation context)
(All (_ <type_vars>)
(-> ///phase.Wrapper Import Context Expander <Platform> Compilation <Context> <Return>))
- (let [[host_dependencies libraries compilers sources target module] compilation
+ (let [[host_dependencies libraries compilers sources target module configuration] compilation
importer (|> (..compiler phase_wrapper expander platform)
(serial_compiler import file_context platform sources)
(..parallel context))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux
index 566a7afa9..faf7f3b90 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux
@@ -6,9 +6,10 @@
["<b>" binary {"+" Parser}]]]
[data
[format
- ["_" binary {"+" Writer}]]]]]
+ ["_" binary {"+" Writer}]]]
+ [meta
+ ["[0]" version]]]]
["[0]" / "_"
- ["[1][0]" version]
[analysis
["[0]" module]]
[///
@@ -86,5 +87,5 @@
(def: .public key
(Key .Module)
(key.key [signature.#name (symbol ..compiler)
- signature.#version /version.version]
+ signature.#version version.latest]
(module.empty 0)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index 5ac2fda49..650842124 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -28,7 +28,8 @@
["r" rev]
["f" frac]]]
[meta
- ["[0]" location]]]]
+ ["[0]" location]
+ ["[0]" configuration {"+" Configuration}]]]]
["[0]" / "_"
["[1][0]" simple {"+" Simple}]
["[1][0]" complex {"+" Tuple Variant Complex}]
@@ -356,11 +357,12 @@
.#var_counter 0
.#var_bindings (list)])
-(def: .public (info version host)
- (-> Version Text Info)
+(def: .public (info version host configuration)
+ (-> Version Text Configuration Info)
[.#target host
.#version (version.format version)
- .#mode {.#Build}])
+ .#mode {.#Build}
+ .#configuration configuration])
(def: .public (state info)
(-> Info Lux)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
index c9ad8c0eb..d4c947953 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux
@@ -38,9 +38,6 @@
["[0]" descriptor]]]]
[tool
[compiler
- [language
- [lux
- [version {"+" version}]]]
[meta
[io {"+" lux_context}]
[archive
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
index fc96c025f..6031ed1db 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -21,6 +21,8 @@
["n" nat]
["[0]" i32]
["[0]" i64]]]
+ [meta
+ ["[0]" version]]
[target
["[0]" jvm "_"
["_" bytecode {"+" Label Bytecode}]
@@ -48,7 +50,6 @@
["[1]/[0]" count]]]]
["//[1]" /// "_"
[//
- ["[0]" version]
["[0]" synthesis]
["[0]" generation]
[///
@@ -92,7 +93,7 @@
(def: .public (class_name [module id])
(-> unit.ID Text)
(format lux_context
- "." (%.nat version.version)
+ "." (%.nat version.latest)
"." (%.nat module)
"." (%.nat id)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/version.lux b/stdlib/source/library/lux/tool/compiler/language/lux/version.lux
deleted file mode 100644
index cc044938c..000000000
--- a/stdlib/source/library/lux/tool/compiler/language/lux/version.lux
+++ /dev/null
@@ -1,9 +0,0 @@
-(.using
- [library
- [lux "*"]]
- [////
- [version {"+" Version}]])
-
-(def: .public version
- Version
- 00,06,06)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
index 056652661..f13f1596c 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux
@@ -18,7 +18,8 @@
[math
[number {"+" hex}]]
[meta
- ["[0]" symbol]]
+ ["[0]" symbol]
+ ["[0]" configuration {"+" Configuration}]]
[tool
[compiler
[meta
@@ -52,7 +53,8 @@
#compilers (List Compiler)
#sources (List Source)
#target Target
- #module Module]))
+ #module Module
+ #configuration Configuration]))
(type: .public Interpretation
..Compilation)
@@ -77,6 +79,7 @@
[source_parser "--source" Source <cli>.any]
[target_parser "--target" Target <cli>.any]
[module_parser "--module" Module <cli>.any]
+ [configuration_parser "--configuration" Configuration (<text>.then configuration.parser <cli>.any)]
)
(def: .public service
@@ -88,7 +91,8 @@
(<>.some ..compiler_parser)
(<>.some ..source_parser)
..target_parser
- ..module_parser))]
+ ..module_parser
+ ..configuration_parser))]
($_ <>.or
(<>.after (<cli>.this "build")
compiler)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
index 4693a7d2f..13e848153 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -26,6 +26,9 @@
[math
[number
["n" nat]]]
+ [meta
+ ["[0]" configuration {"+" Configuration}]
+ ["[0]" version]]
[world
["[0]" file]]]]
["[0]" //
@@ -46,7 +49,6 @@
["/[1]" // {"+" Input}
[language
["$" lux
- ["[0]" version]
["[0]" analysis]
["[0]" synthesis]
["[0]" generation]
@@ -145,12 +147,12 @@
..module_parser
registry.parser))
-(def: (fresh_analysis_state host)
- (-> Target .Lux)
- (analysis.state (analysis.info version.version host)))
+(def: (fresh_analysis_state host configuration)
+ (-> Target Configuration .Lux)
+ (analysis.state (analysis.info version.latest host configuration)))
-(def: (analysis_state host archive)
- (-> Target Archive (Try .Lux))
+(def: (analysis_state host configuration archive)
+ (-> Target Configuration Archive (Try .Lux))
(do [! try.monad]
[modules (: (Try (List [descriptor.Module .Module]))
(monad.each ! (function (_ module)
@@ -161,7 +163,7 @@
(document.content $.key))]
(in [module content])))
(archive.archived archive)))]
- (in (with@ .#modules modules (fresh_analysis_state host)))))
+ (in (with@ .#modules modules (fresh_analysis_state host configuration)))))
(def: (cached_artifacts fs context module_id)
(-> (file.System Async) Context module.ID (Async (Try (Dictionary Text Binary))))
@@ -463,9 +465,9 @@
bundles])))))]
(in it)))
-(def: (load_every_reserved_module host_environment fs context import contexts archive)
+(def: (load_every_reserved_module configuration host_environment fs context import contexts archive)
(All (_ expression directive)
- (-> (generation.Host expression directive) (file.System Async) Context Import (List //.Context) Archive
+ (-> Configuration (generation.Host expression directive) (file.System Async) Context Import (List //.Context) Archive
(Async (Try [Archive .Lux Bundles]))))
(do [! (try.with async.monad)]
[pre_loaded_caches (..pre_loaded_caches fs context import contexts archive)
@@ -482,7 +484,7 @@
(archive.has module entry archive))
archive
loaded_caches)
- analysis_state (..analysis_state (value@ context.#host context) archive)]
+ analysis_state (..analysis_state (value@ context.#host context) configuration archive)]
(in [archive
analysis_state
(list#mix (function (_ [_ [+analysers +synthesizers +generators +directives]]
@@ -494,9 +496,9 @@
..empty_bundles
loaded_caches)])))))
-(def: .public (thaw host_environment fs context import contexts)
+(def: .public (thaw configuration host_environment fs context import contexts)
(All (_ expression directive)
- (-> (generation.Host expression directive) (file.System Async) Context Import (List //.Context)
+ (-> Configuration (generation.Host expression directive) (file.System Async) Context Import (List //.Context)
(Async (Try [Archive .Lux Bundles]))))
(do async.monad
[binary (# fs read (..general_descriptor fs context))]
@@ -504,9 +506,9 @@
{try.#Success binary}
(do (try.with async.monad)
[archive (async#in (archive.import ///.version binary))]
- (..load_every_reserved_module host_environment fs context import contexts archive))
+ (..load_every_reserved_module configuration host_environment fs context import contexts archive))
{try.#Failure error}
(in {try.#Success [archive.empty
- (fresh_analysis_state (value@ context.#host context))
+ (fresh_analysis_state (value@ context.#host context) configuration)
..empty_bundles]}))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux
index 1bfd062fe..fb4d43410 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux
@@ -25,9 +25,6 @@
["_" ruby]]
[world
["[0]" file]]]]
- [program
- [compositor
- ["[0]" static {"+" Static}]]]
["[0]" // {"+" Packager}
[//
["[0]" archive {"+" Output}
diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux
index 8570207be..599887fe4 100644
--- a/stdlib/source/program/aedifex/command/build.lux
+++ b/stdlib/source/program/aedifex/command/build.lux
@@ -6,7 +6,7 @@
[order {"+" Order}]
[monad {"+" do}]]
[control
- ["[0]" try {"+" Try}]
+ ["[0]" try {"+" Try} ("[1]#[0]" functor)]
["[0]" exception {"+" exception:}]
["[0]" io {"+" IO}]
[concurrency
@@ -23,10 +23,13 @@
[number {"+" hex}
["n" nat]
["i" int]]]
+ [meta
+ ["[0]" configuration]]
[tool
[compiler
[meta
- ["[0]" cli]
+ [cli
+ ["[0]" compiler]]
["[0]" packager
["[0]_[1]" ruby]]]]]
[world
@@ -238,8 +241,9 @@
(def: windows?
Bit
- (|> (java/lang/System::getProperty "os.name")
+ (|> (java/lang/System::getProperty (ffi.as_string "os.name"))
io.run!
+ (try#each (|>> ffi.of_string))
(try.else "")
text.lower_cased
(text.starts_with? "windows")))
@@ -306,10 +310,11 @@
(list "build")
(..plural "--library" (..libraries fs home resolution))
(..plural "--host_dependency" host_dependencies)
- (..plural "--compiler" (list#each cli.compiler_format (value@ ///.#compilers profile)))
+ (..plural "--compiler" (list#each compiler.format (value@ ///.#compilers profile)))
(..plural "--source" (set.list (value@ ///.#sources profile)))
(..singular "--target" cache_directory)
- (..singular "--module" program_module)))]
+ (..singular "--module" program_module)
+ (..singular "--configuration" (configuration.format (value@ ///.#configuration profile)))))]
process (# shell execute [environment
working_directory
command
diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux
index f80ed0275..3ceefa7c1 100644
--- a/stdlib/source/program/aedifex/command/deploy.lux
+++ b/stdlib/source/program/aedifex/command/deploy.lux
@@ -1,57 +1,58 @@
(.using
- [library
- [lux "*"
- [abstract
- [monad {"+" do}]]
- [control
- [pipe {"+" do>}]
- ["[0]" try {"+" Try}]
- [concurrency
- ["[0]" async {"+" Async} ("[1]#[0]" monad)]]
- ["<>" parser
- ["<[0]>" xml]]]
- [data
- [binary {"+" Binary}]
- [text
- ["%" format {"+" format}]
- [encoding
- ["[0]" utf8]]]
- [collection
- ["[0]" set]]
- [format
- ["[0]" binary]
- ["[0]" tar]
- ["[0]" xml]]]
- [time
- ["[0]" instant {"+" Instant}]]
- [world
- ["[0]" file]
- ["[0]" console {"+" Console}]]]]
- [program
- [compositor
- ["[0]" export]]]
- ["[0]" // "_"
- ["[1][0]" clean]
- ["/[1]" // "_"
- [command {"+" Command}]
- ["/" profile]
- ["[1][0]" action {"+" Action}]
- ["[1][0]" pom]
- ["[1][0]" hash]
- ["[1][0]" package]
- ["[1][0]" dependency
- ["[1]/[0]" deployment]
- ["[1]/[0]" status {"+" Status}]]
- ["[1][0]" repository {"+" Repository}
- [identity {"+" Identity}]
- ["[1]/[0]" remote]
- ["[1]/[0]" origin]]
- ["[1][0]" metadata
- ["[1]/[0]" artifact]
- ["[1]/[0]" snapshot]]
- ["[1][0]" artifact {"+" Artifact}
- ["[1]/[0]" extension {"+" Extension}]
- ["[1]/[0]" type]]]])
+ [library
+ [lux "*"
+ [abstract
+ [monad {"+" do}]]
+ [control
+ [pipe {"+" do>}]
+ ["[0]" try {"+" Try}]
+ [concurrency
+ ["[0]" async {"+" Async} ("[1]#[0]" monad)]]
+ ["<>" parser
+ ["<[0]>" xml]]]
+ [data
+ [binary {"+" Binary}]
+ [text
+ ["%" format {"+" format}]
+ [encoding
+ ["[0]" utf8]]]
+ [collection
+ ["[0]" set]]
+ [format
+ ["[0]" binary]
+ ["[0]" tar]
+ ["[0]" xml]]]
+ [time
+ ["[0]" instant {"+" Instant}]]
+ [tool
+ [compiler
+ [meta
+ ["[0]" export]]]]
+ [world
+ ["[0]" file]
+ ["[0]" console {"+" Console}]]]]
+ ["[0]" // "_"
+ ["[1][0]" clean]
+ ["/[1]" // "_"
+ [command {"+" Command}]
+ ["/" profile]
+ ["[1][0]" action {"+" Action}]
+ ["[1][0]" pom]
+ ["[1][0]" hash]
+ ["[1][0]" package]
+ ["[1][0]" dependency
+ ["[1]/[0]" deployment]
+ ["[1]/[0]" status {"+" Status}]]
+ ["[1][0]" repository {"+" Repository}
+ [identity {"+" Identity}]
+ ["[1]/[0]" remote]
+ ["[1]/[0]" origin]]
+ ["[1][0]" metadata
+ ["[1]/[0]" artifact]
+ ["[1]/[0]" snapshot]]
+ ["[1][0]" artifact {"+" Artifact}
+ ["[1]/[0]" extension {"+" Extension}]
+ ["[1]/[0]" type]]]])
(def: .public success
"Successfully deployed the project.")
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
index 06f3197f8..a1553e4bd 100644
--- a/stdlib/source/program/aedifex/command/install.lux
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -1,47 +1,48 @@
(.using
- [library
- [lux "*"
- [abstract
- [monad {"+" do}]]
- [control
- ["[0]" try {"+" Try}]
- ["[0]" exception]
- [concurrency
- ["[0]" async {"+" Async}]]]
- [data
- [binary {"+" Binary}]
- [text
- [encoding
- ["[0]" utf8]]]
- [collection
- ["[0]" set]]
- [format
- ["[0]" binary]
- ["[0]" tar]
- ["[0]" xml]]]
- [world
- [program {"+" Program}]
- ["[0]" file]
- ["[0]" console {"+" Console}]]]]
- [program
- [compositor
- ["[0]" export]]]
- ["[0]" // "_"
- ["[1][0]" clean]
- ["/[1]" // "_"
- ["/" profile {"+" Profile}]
- ["[1][0]" action {"+" Action}]
- ["[1][0]" command {"+" Command}]
- ["[1][0]" local]
- ["[1][0]" pom]
- ["[1][0]" package]
- [repository {"+" Repository}
- ["[1][0]" origin]]
- ["[1][0]" dependency "_"
- ["[1]/[0]" deployment]
- ["[1]/[0]" status]]
- ["[1][0]" artifact {"+" Artifact}
- ["[1]/[0]" type]]]])
+ [library
+ [lux "*"
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" try {"+" Try}]
+ ["[0]" exception]
+ [concurrency
+ ["[0]" async {"+" Async}]]]
+ [data
+ [binary {"+" Binary}]
+ [text
+ [encoding
+ ["[0]" utf8]]]
+ [collection
+ ["[0]" set]]
+ [format
+ ["[0]" binary]
+ ["[0]" tar]
+ ["[0]" xml]]]
+ [tool
+ [compiler
+ [meta
+ ["[0]" export]]]]
+ [world
+ [program {"+" Program}]
+ ["[0]" file]
+ ["[0]" console {"+" Console}]]]]
+ ["[0]" // "_"
+ ["[1][0]" clean]
+ ["/[1]" // "_"
+ ["/" profile {"+" Profile}]
+ ["[1][0]" action {"+" Action}]
+ ["[1][0]" command {"+" Command}]
+ ["[1][0]" local]
+ ["[1][0]" pom]
+ ["[1][0]" package]
+ [repository {"+" Repository}
+ ["[1][0]" origin]]
+ ["[1][0]" dependency "_"
+ ["[1]/[0]" deployment]
+ ["[1]/[0]" status]]
+ ["[1][0]" artifact {"+" Artifact}
+ ["[1]/[0]" type]]]])
(def: .public success
"Successfully installed the project locally.")
diff --git a/stdlib/source/program/aedifex/command/version.lux b/stdlib/source/program/aedifex/command/version.lux
index 2a9072c39..c61e796df 100644
--- a/stdlib/source/program/aedifex/command/version.lux
+++ b/stdlib/source/program/aedifex/command/version.lux
@@ -1,21 +1,20 @@
(.using
- [library
- [lux "*"
- [control
- [concurrency
- ["[0]" async {"+" Async}]]]
- [tool
- [compiler
- ["[0]" version]
- ["[0]" language "_"
- ["[1]/[0]" lux "_"
- ["[1]" version]]]]]
- [world
- ["[0]" console {"+" Console}]]]]
- [///
- [command {"+" Command}]])
+ [library
+ [lux "*"
+ [control
+ [concurrency
+ ["[0]" async {"+" Async}]]]
+ ["[0]" meta "_"
+ ["[1]/[0]" version]]
+ [tool
+ [compiler
+ ["[0]" version]]]
+ [world
+ ["[0]" console {"+" Console}]]]]
+ [///
+ [command {"+" Command}]])
(def: .public (do! console profile)
(-> (Console Async) (Command Any))
- (console.write_line (version.format language/lux.version)
+ (console.write_line (version.format meta/version.latest)
console))
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index ffea5d458..627a3e6ef 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -86,10 +86,7 @@
(case ?actual
{try.#Success actual}
(in (do [! try.monad]
- [output (# ! each (for [@.old (|>> (:as java/lang/String)
- java/lang/String::trim
- (:as Text))
- @.jvm (|>> java/lang/String::trim)])
+ [output (# ! each (|>> ffi.as_string java/lang/String::trim ffi.of_string)
(# utf8.codec decoded actual))
actual (|> output
(text.all_split_by " ")
diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux
index 54e1ed57f..d0628f160 100644
--- a/stdlib/source/program/aedifex/format.lux
+++ b/stdlib/source/program/aedifex/format.lux
@@ -13,7 +13,8 @@
[tool
[compiler
[meta
- [cli {"+" Compiler}]]]]]]
+ [cli
+ [compiler {"+" Compiler}]]]]]]]
["[0]" // "_"
["/" profile]
["[1][0]" runtime {"+" Runtime}]
diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux
index 093f5fbe4..30b0cdcee 100644
--- a/stdlib/source/program/aedifex/hash.lux
+++ b/stdlib/source/program/aedifex/hash.lux
@@ -1,25 +1,25 @@
(.using
- [library
- [lux "*"
- ["[0]" ffi {"+" import:}]
- [abstract
- [codec {"+" Codec}]
- [equivalence {"+" Equivalence}]
- [monad {"+" do}]]
- [control
- ["[0]" try {"+" Try}]
- ["[0]" exception {"+" exception:}]]
- [data
- ["[0]" binary {"+" Binary}]
- ["[0]" text
- ["%" format {"+" Format format}]
- ["[0]" encoding]]]
- [math
- [number
- ["n" nat]
- ["[0]" i64]]]
- [type
- abstract]]])
+ [library
+ [lux "*"
+ ["[0]" ffi {"+" import:}]
+ [abstract
+ [codec {"+" Codec}]
+ [equivalence {"+" Equivalence}]
+ [monad {"+" do}]]
+ [control
+ ["[0]" try {"+" Try}]
+ ["[0]" exception {"+" exception:}]]
+ [data
+ ["[0]" binary {"+" Binary}]
+ ["[0]" text
+ ["%" format {"+" Format format}]
+ ["[0]" encoding]]]
+ [math
+ [number
+ ["n" nat]
+ ["[0]" i64]]]
+ [type
+ abstract]]])
... TODO: Replace with pure-Lux implementations of these algorithms
... https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode
@@ -44,7 +44,7 @@
(template [<name> <kind> <algorithm>]
[(def: .public (<name> value)
(-> Binary (Hash <kind>))
- (|> (java/security/MessageDigest::getInstance [<algorithm>])
+ (|> (java/security/MessageDigest::getInstance [(ffi.as_string <algorithm>)])
(java/security/MessageDigest::digest [value])
:abstraction))]
diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux
index 52a9a292c..097373529 100644
--- a/stdlib/source/program/aedifex/parser.lux
+++ b/stdlib/source/program/aedifex/parser.lux
@@ -9,12 +9,14 @@
[data
["[0]" text]
[collection
- ["[0]" dictionary {"+" Dictionary}]
- ["[0]" set {"+" Set}]]]
+ ["[0]" set {"+" Set}]
+ ["[0]" dictionary {"+" Dictionary}
+ ["[0]" plist {"+" PList}]]]]
[tool
[compiler
[meta
- [cli {"+" Compiler}]
+ [cli
+ [compiler {"+" Compiler}]]
[archive
[module
[descriptor {"+" Module}]]]]]]
@@ -179,10 +181,14 @@
<code>.text)
(def: deploy_repository
- (Parser (List [Text //repository.Address]))
- (<code>.tuple (<>.some
- (<>.and <code>.text
- ..repository))))
+ (Parser [Text //repository.Address])
+ (<>.and <code>.text
+ ..repository))
+
+(def: configuration/1
+ (Parser [Text Text])
+ (<>.and <code>.text
+ <code>.text))
(def: runtime
(Parser Runtime)
@@ -237,7 +243,10 @@
^deploy_repositories (: (Parser (Dictionary Text //repository.Address))
(<| (# ! each (dictionary.of_list text.hash))
(<>.else (list))
- (..singular input "deploy_repositories" ..deploy_repository)))
+ (..plural input "deploy_repositories" ..deploy_repository)))
+ ^configuration (: (Parser (PList Text))
+ (<| (<>.else (list))
+ (..plural input "configuration" ..configuration/1)))
^java (|> ..runtime
(..singular input "java")
(<>.else //runtime.default_java))
@@ -266,6 +275,7 @@
^program
^test
^deploy_repositories
+ ^configuration
^java
^js
^python
diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux
index eeabf5f82..43887caa4 100644
--- a/stdlib/source/program/aedifex/profile.lux
+++ b/stdlib/source/program/aedifex/profile.lux
@@ -11,9 +11,10 @@
["[0]" product]
["[0]" text ("[1]#[0]" equivalence)]
[collection
- ["[0]" dictionary {"+" Dictionary}]
["[0]" list ("[1]#[0]" monoid)]
- ["[0]" set {"+" Set}]]]
+ ["[0]" set {"+" Set}]
+ ["[0]" dictionary {"+" Dictionary}
+ ["[0]" plist {"+" PList} ("[1]#[0]" monoid)]]]]
[macro
["[0]" template]]
[meta
@@ -24,7 +25,8 @@
[tool
[compiler
[meta
- ["[0]" cli {"+" Compiler}]
+ ["[0]" cli
+ ["[0]" compiler {"+" Compiler}]]
[archive
[module
[descriptor {"+" Module}]]]]]]]]
@@ -173,6 +175,7 @@
#program (Maybe Module)
#test (Maybe Module)
#deploy_repositories (Dictionary Text Address)
+ #configuration (PList Text)
#java Runtime
#js Runtime
#python Runtime
@@ -195,7 +198,7 @@
... #lux
dependency.equivalence
... #compilers
- (list.equivalence cli.compiler_equivalence)
+ (list.equivalence compiler.equivalence)
... #sources
set.equivalence
... #target
@@ -206,6 +209,8 @@
(maybe.equivalence text.equivalence)
... #deploy_repositories
(dictionary.equivalence text.equivalence)
+ ... #configuration
+ (plist.equivalence text.equivalence)
... #java
runtime.equivalence
... #js
@@ -233,6 +238,7 @@
#program {.#None}
#test {.#None}
#deploy_repositories (dictionary.empty text.hash)
+ #configuration plist.empty
#java runtime.default_java
#js runtime.default_js
#python runtime.default_python
@@ -260,6 +266,7 @@
#program (maybe#composite (value@ #program override) (value@ #program baseline))
#test (maybe#composite (value@ #test override) (value@ #test baseline))
#deploy_repositories (dictionary.merged (value@ #deploy_repositories override) (value@ #deploy_repositories baseline))
+ #configuration (plist#composite (value@ #configuration override) (value@ #configuration baseline))
#java (!runtime #java runtime.default_java)
#js (!runtime #js runtime.default_js)
#python (!runtime #python runtime.default_python)
diff --git a/stdlib/source/program/aedifex/repository/identity.lux b/stdlib/source/program/aedifex/repository/identity.lux
index 6e058850d..8288f2d74 100644
--- a/stdlib/source/program/aedifex/repository/identity.lux
+++ b/stdlib/source/program/aedifex/repository/identity.lux
@@ -1,15 +1,15 @@
(.using
- [library
- [lux "*"
- ["[0]" ffi {"+" import:}]
- [abstract
- [equivalence {"+" Equivalence}]]
- [data
- ["[0]" product]
- ["[0]" text
- ["%" format {"+" format}]
- [encoding
- ["[0]" utf8]]]]]])
+ [library
+ [lux "*"
+ ["[0]" ffi {"+" import:}]
+ [abstract
+ [equivalence {"+" Equivalence}]]
+ [data
+ ["[0]" product]
+ ["[0]" text
+ ["%" format {"+" format}]
+ [encoding
+ ["[0]" utf8]]]]]])
(type: .public User
Text)
@@ -42,4 +42,5 @@
(let [credentials (# utf8.codec encoded (format user ":" password))]
(|> (java/util/Base64::getEncoder)
(java/util/Base64$Encoder::encodeToString credentials)
+ ffi.of_string
(format "Basic "))))
diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux
index 9e50e71a6..7f1a735b8 100644
--- a/stdlib/source/program/aedifex/repository/remote.lux
+++ b/stdlib/source/program/aedifex/repository/remote.lux
@@ -1,34 +1,33 @@
(.using
- [library
- [lux "*"
- [abstract
- [monad {"+" do}]]
- [control
- ["[0]" io {"+" IO}]
- ["[0]" try {"+" Try}]
- ["[0]" exception {"+" exception:}]]
- [data
- ["[0]" product]
- [text
- ["%" format {"+" format}]]]
- [tool
- [compiler
- ["[0]" version]
- ["[0]" language "_"
- ["[1]/[0]" lux "_"
- ["[1]" version]]]]]
- [world
- [net {"+" URL}
- [uri {"+" URI}]
- ["[0]" http "_"
- ["[1]" client]
- ["[1]/[0]" status]
- ["@[1]" /]]]]]]
- ["[0]" //
- ["[1][0]" identity {"+" Identity}]
- ["/[1]" // "_"
- ["[1][0]" artifact {"+" Version Artifact}
- [extension {"+" Extension}]]]])
+ [library
+ [lux "*"
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" io {"+" IO}]
+ ["[0]" try {"+" Try}]
+ ["[0]" exception {"+" exception:}]]
+ [data
+ ["[0]" product]
+ [text
+ ["%" format {"+" format}]]]
+ ["[0]" meta "_"
+ ["[1]/[0]" version]]
+ [tool
+ [compiler
+ ["[0]" version]]]
+ [world
+ [net {"+" URL}
+ [uri {"+" URI}]
+ ["[0]" http "_"
+ ["[1]" client]
+ ["[1]/[0]" status]
+ ["@[1]" /]]]]]]
+ ["[0]" //
+ ["[1][0]" identity {"+" Identity}]
+ ["/[1]" // "_"
+ ["[1][0]" artifact {"+" Version Artifact}
+ [extension {"+" Extension}]]]])
(type: .public Address
URL)
@@ -49,7 +48,7 @@
(format (///artifact.uri version_template artifact) extension))
(def: .public user_agent
- (format "LuxAedifex/" (version.format language/lux.version)))
+ (format "LuxAedifex/" (version.format meta/version.latest)))
(def: base_headers
(List [Text Text])
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index 7df24358b..250f184bd 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -152,7 +152,7 @@
(<| (or_crash! "Compilation failed:")
..timed
(do (try.with async.monad)
- [.let [[compilation_host_dependencies compilation_libraries compilation_compilers compilation_sources compilation_target compilation_module] compilation]
+ [.let [[compilation_host_dependencies compilation_libraries compilation_compilers compilation_sources compilation_target compilation_module compilation_configuration] compilation]
import (import.import (value@ platform.#&file_system platform) compilation_libraries)
[state archive phase_wrapper] (:sharing [<parameters>]
(Platform <parameters>)
@@ -162,7 +162,7 @@
Archive
phase.Wrapper]))
(:expected (platform.initialize file_context compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender
- import compilation_sources)))
+ import compilation_sources compilation_configuration)))
[archive state] (:sharing [<parameters>]
(Platform <parameters>)
platform
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index ef7463d4e..f2e29ec1a 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -66,9 +66,10 @@
current_module (symbol.module (symbol .._))]]
(in [seed
symbol_prefix
- [.#info [.#target ""
+ [.#info [.#target ""
.#version ""
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 ""]
.#location location.dummy
.#current_module {.#Some current_module}
diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux
index 82fc97e3e..faf667534 100644
--- a/stdlib/source/test/lux/macro/syntax/definition.lux
+++ b/stdlib/source/test/lux/macro/syntax/definition.lux
@@ -34,9 +34,10 @@
))
(def: compiler
- [.#info [.#target "FAKE"
+ [.#info [.#target "FAKE"
.#version "0.0.0"
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 ""]
.#location location.dummy
.#current_module {.#None}
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 914e02d92..871cc155c 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -32,7 +32,9 @@
["[0]" /]]
["[0]" / "_"
["[1][0]" location]
- ["[1][0]" symbol]])
+ ["[1][0]" symbol]
+ ["[1][0]" configuration]
+ ["[1][0]" version]])
(template: (!expect <pattern> <value>)
[(case <value>
@@ -50,9 +52,10 @@
expected_seed random.nat
expected random.nat
dummy (random.only (|>> (n.= expected) not) random.nat)
- .let [expected_lux [.#info [.#target target
+ .let [expected_lux [.#info [.#target target
.#version version
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 source_code]
.#location location.dummy
.#current_module {.#Some expected_current_module}
@@ -98,9 +101,10 @@
expected random.nat
dummy (random.only (|>> (n.= expected) not) random.nat)
expected_error (random.ascii/upper 1)
- .let [expected_lux [.#info [.#target target
+ .let [expected_lux [.#info [.#target target
.#version version
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 source_code]
.#location location.dummy
.#current_module {.#Some expected_current_module}
@@ -203,9 +207,10 @@
expected_module]
[imported_module_name
imported_module])
- expected_lux [.#info [.#target target
+ expected_lux [.#info [.#target target
.#version version
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 source_code]
.#location location.dummy
.#current_module {.#Some expected_current_module}
@@ -304,9 +309,10 @@
.let [type_context [.#ex_counter 0
.#var_counter 0
.#var_bindings (list)]
- expected_lux [.#info [.#target target
+ expected_lux [.#info [.#target target
.#version version
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 source_code]
.#location expected_location
.#current_module {.#Some expected_current_module}
@@ -382,9 +388,10 @@
(list)))]
[current_globals
macro_globals
- [.#info [.#target ""
+ [.#info [.#target ""
.#version ""
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 ""]
.#location location.dummy
.#current_module {.#Some expected_current_module}
@@ -497,9 +504,10 @@
(list)))]
[current_globals
macro_globals
- [.#info [.#target ""
+ [.#info [.#target ""
.#version ""
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 ""]
.#location location.dummy
.#current_module {.#Some expected_current_module}
@@ -670,9 +678,10 @@
expected_lux
(: Lux
- [.#info [.#target ""
+ [.#info [.#target ""
.#version ""
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 ""]
.#location location.dummy
.#current_module {.#Some current_module}
@@ -821,9 +830,10 @@
.#mappings (list)]])]
.let [expected_lux
(: Lux
- [.#info [.#target ""
+ [.#info [.#target ""
.#version ""
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [location.dummy 0 ""]
.#location location.dummy
.#current_module {.#Some current_module}
@@ -933,9 +943,10 @@
expected random.nat
dummy (random.only (|>> (n.= expected) not) random.nat)
expected_location ..random_location
- .let [expected_lux [.#info [.#target target
+ .let [expected_lux [.#info [.#target target
.#version version
- .#mode {.#Build}]
+ .#mode {.#Build}
+ .#configuration (list)]
.#source [expected_location 0 source_code]
.#location expected_location
.#current_module {.#Some expected_current_module}
@@ -991,4 +1002,6 @@
/location.test
/symbol.test
+ /configuration.test
+ /version.test
)))
diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux
new file mode 100644
index 000000000..9776472d5
--- /dev/null
+++ b/stdlib/source/test/lux/meta/configuration.lux
@@ -0,0 +1,90 @@
+(.using
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ ["[0]" meta]
+ [abstract
+ [monad {"+" do}]
+ [\\specification
+ ["$[0]" equivalence]
+ ["$[0]" monoid]]]
+ [control
+ ["[0]" try ("[1]#[0]" functor)]
+ ["[0]" exception]
+ ["<>" parser
+ ["<[0]>" text]
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text]
+ [collection
+ ["[0]" list]]]
+ ["[0]" macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [math
+ ["[0]" random {"+" Random} ("[1]#[0]" monad)]]]]
+ [\\library
+ ["[0]" /]])
+
+(def: .public (random amount)
+ (-> Nat (Random /.Configuration))
+ (case amount
+ 0 (random#in /.empty)
+ _ (do [! random.monad]
+ [feature (random.ascii/upper amount)
+ value (random.ascii/lower amount)]
+ (# ! each (|>> (list& [feature value]))
+ (random (-- amount))))))
+
+(syntax: (failure [it <code>.any])
+ (function (_ lux)
+ (case (macro.expansion it lux)
+ {try.#Failure error}
+ {try.#Success [lux (list (code.text error))]}
+
+ {try.#Success _}
+ {try.#Failure ""})))
+
+(def: .public test
+ Test
+ (<| (_.covering /._)
+ (_.for [/.Configuration])
+ (do [! random.monad]
+ [expected (..random 5)]
+ ($_ _.and
+ (_.for [/.equivalence]
+ ($equivalence.spec /.equivalence (..random 5)))
+ (_.for [/.monoid]
+ ($monoid.spec /.equivalence /.monoid (..random 5)))
+
+ (_.cover [/.empty]
+ (list.empty? /.empty))
+ (_.cover [/.format /.parser]
+ (|> expected
+ /.format
+ (<text>.result /.parser)
+ (try#each (# /.equivalence = expected))
+ (try.else false)))
+ (_.cover [/.for]
+ (and (and (/.for [["left" "<<<"
+ "right" ">>>"]
+ true]
+ false)
+ (/.for [["left" "<<<"]
+ true]
+ false)
+ (/.for [["right" ">>>"]
+ true]
+ false))
+ (and (/.for [["yolo" ""]
+ false]
+ true)
+ (/.for [["left" "yolo"]
+ false]
+ true))))
+ (_.cover [/.invalid]
+ (and (text.contains? (value@ exception.#label /.invalid)
+ (..failure (/.for [])))
+ (text.contains? (value@ exception.#label /.invalid)
+ (..failure (/.for [["left" "yolo"] false])))))
+ ))))
diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux
new file mode 100644
index 000000000..a279158ab
--- /dev/null
+++ b/stdlib/source/test/lux/meta/version.lux
@@ -0,0 +1,55 @@
+(.using
+ [library
+ [lux "*"
+ ["_" test {"+" Test}]
+ ["[0]" static]
+ ["[0]" meta]
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" try]
+ ["[0]" exception]
+ [parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text]]
+ ["[0]" macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [math
+ ["[0]" random]
+ [number
+ ["n" nat]]]]]
+ [\\library
+ ["[0]" /]])
+
+(syntax: (failure [it <code>.any])
+ (function (_ lux)
+ (case (macro.expansion it lux)
+ {try.#Failure error}
+ {try.#Success [lux (list (code.text error))]}
+
+ {try.#Success _}
+ {try.#Failure ""})))
+
+(def: .public test
+ Test
+ (<| (_.covering /._)
+ (with_expansions [<current> (/.current)
+ <fake> (static.random code.text (random.ascii/lower 1))])
+ ($_ _.and
+ (_.cover [/.latest]
+ (n.> 0 /.latest))
+ (_.cover [/.current]
+ (not (text.empty? (/.current))))
+ (_.cover [/.for]
+ (and (/.for [<current> true]
+ false)
+ (/.for [<fake> false]
+ true)))
+ (_.cover [/.invalid]
+ (and (text.contains? (value@ exception.#label /.invalid)
+ (..failure (/.for [])))
+ (text.contains? (value@ exception.#label /.invalid)
+ (..failure (/.for [<fake> false])))))
+ )))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux
index 75f0d5d1c..ee058760a 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux
@@ -23,7 +23,10 @@
[math
["[0]" random {"+" Random} ("[1]#[0]" monad)]
[number
- ["f" frac]]]]]
+ ["f" frac]]]
+ [meta
+ ["[0]" configuration "_"
+ ["$[1]" \\test]]]]]
["[0]" / "_"
["[1][0]" complex]
["[1][0]" inference]
@@ -249,10 +252,11 @@
expected_error (random.ascii/lower 10)
location/0 /location.random
location/1 /location.random
+ configuration ($configuration.random 5)
.let [state/0 (with@ .#location location/0
- (/.state (/.info version/0 host/0)))
+ (/.state (/.info version/0 host/0 configuration)))
state/1 (with@ .#location location/1
- (/.state (/.info version/1 host/1)))]]
+ (/.state (/.info version/1 host/1 configuration)))]]
($_ _.and
(_.cover [/.set_state]
(|> (do phase.monad
@@ -330,18 +334,20 @@
expected_file (random.ascii/lower 12)
expected_code (random.ascii/lower 13)
+ configuration ($configuration.random 5)
.let [state (with@ .#location location
- (/.state (/.info version host)))]]
+ (/.state (/.info version host configuration)))]]
($_ _.and
(_.cover [/.info]
- (let [it (/.info version host)]
+ (let [it (/.info version host configuration)]
(and (text#= (version.format version)
(value@ .#version it))
(same? host
(value@ .#target it))
- (..tagged? .#Build (value@ .#mode it)))))
+ (..tagged? .#Build (value@ .#mode it))
+ (same? configuration (value@ .#configuration it)))))
(_.cover [/.state]
- (let [info (/.info version host)
+ (let [info (/.info version host configuration)
it (/.state info)]
(and (same? info
(value@ .#info it))
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux
index 3eec3a5b4..63038413d 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux
@@ -22,6 +22,8 @@
["n" nat]]]
[meta
["[0]" symbol "_"
+ ["$[1]" \\test]]
+ ["[0]" configuration "_"
["$[1]" \\test]]]
["[0]" type ("[1]#[0]" equivalence)
["[0]" check {"+" Check}]]]]
@@ -56,8 +58,9 @@
(Random Lux)
(do random.monad
[version random.nat
- host (random.ascii/lower 1)]
- (in (//.state (//.info version host)))))
+ host (random.ascii/lower 1)
+ configuration ($configuration.random 5)]
+ (in (//.state (//.info version host configuration)))))
(def: primitive
(Random Type)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux
index b976dab87..d3f1ff62d 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux
@@ -2,7 +2,6 @@
[library
[lux "*"
["_" test {"+" Test}]
- ["[0]" meta]
[abstract
[monad {"+" do}]
[\\specification
@@ -22,7 +21,10 @@
[math
["[0]" random {"+" Random} ("[1]#[0]" monad)]
[number
- ["n" nat]]]]]
+ ["n" nat]]]
+ ["[0]" meta
+ ["[0]" configuration "_"
+ ["$[1]" \\test]]]]]
["$" /////// "_"
[macro
["[1][0]" code]]
@@ -36,8 +38,9 @@
(Random Lux)
(do random.monad
[version random.nat
- host (random.ascii/lower 1)]
- (in (//.state (//.info version host)))))
+ host (random.ascii/lower 1)
+ configuration ($configuration.random 5)]
+ (in (//.state (//.info version host configuration)))))
(def: (expander macro inputs state)
/.Expander
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux
index d5cc7e0b8..69e7970f8 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux
@@ -2,7 +2,6 @@
[library
[lux "*"
["_" test {"+" Test}]
- ["[0]" meta]
[abstract
["[0]" monad {"+" do}]]
[control
@@ -18,7 +17,10 @@
[math
["[0]" random {"+" Random}]
[number
- ["n" nat]]]]]
+ ["n" nat]]]
+ ["[0]" meta
+ ["[0]" configuration "_"
+ ["$[1]" \\test]]]]]
[\\library
["[0]" /
["/[1]" //
@@ -32,8 +34,9 @@
(Random Lux)
(do random.monad
[version random.nat
- host (random.ascii/lower 1)]
- (in (//.state (//.info version host)))))
+ host (random.ascii/lower 1)
+ configuration ($configuration.random 5)]
+ (in (//.state (//.info version host configuration)))))
(def: primitive
(Random Type)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux
index 867ef7e5a..a5f1b5797 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux
@@ -11,6 +11,9 @@
["[0]" product]]
[math
["[0]" random {"+" Random}]]
+ [meta
+ ["[0]" configuration "_"
+ ["$[1]" \\test]]]
["[0]" type ("[1]#[0]" equivalence)
["[0]" check]]]]
[\\library
@@ -27,8 +30,9 @@
(Random Lux)
(do random.monad
[version random.nat
- host (random.ascii/lower 1)]
- (in (//.state (//.info version host)))))
+ host (random.ascii/lower 1)
+ configuration ($configuration.random 5)]
+ (in (//.state (//.info version host configuration)))))
(def: primitive
(Random Type)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux
index 21813bb01..e7f6a5093 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux
@@ -26,6 +26,8 @@
["f" frac]]]
[meta
["[0]" symbol
+ ["$[1]" \\test]]
+ ["[0]" configuration "_"
["$[1]" \\test]]]
["[0]" type ("[1]#[0]" equivalence)
["[0]" check]]]]
@@ -61,8 +63,9 @@
(Random Lux)
(do random.monad
[version random.nat
- host (random.ascii/lower 1)]
- (in (//analysis.state (//analysis.info version host)))))
+ host (random.ascii/lower 1)
+ configuration ($configuration.random 5)]
+ (in (//analysis.state (//analysis.info version host configuration)))))
(def: primitive
(Random Type)
diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux
index 45c22f1ec..86f813b1d 100644
--- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux
+++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux
@@ -11,7 +11,10 @@
[data
["[0]" product]]
[math
- ["[0]" random]]]]
+ ["[0]" random]]
+ [meta
+ ["[0]" configuration "_"
+ ["$[1]" \\test]]]]]
[\\library
["[0]" /
[///
@@ -75,7 +78,8 @@
[version random.nat
host (random.ascii/lower 1)
module (random.ascii/lower 2)
- .let [state (/analysis.state (/analysis.info version host))]]
+ configuration ($configuration.random 5)
+ .let [state (/analysis.state (/analysis.info version host configuration))]]
(`` ($_ _.and
(_.cover [/.unit]
(..analysis state module .Any /.unit
diff --git a/stdlib/source/test/lux/tool/compiler/meta/cli.lux b/stdlib/source/test/lux/tool/compiler/meta/cli.lux
index 15441533e..b90b8a0b3 100644
--- a/stdlib/source/test/lux/tool/compiler/meta/cli.lux
+++ b/stdlib/source/test/lux/tool/compiler/meta/cli.lux
@@ -20,6 +20,8 @@
["n" nat]]]
[meta
["[0]" symbol "_"
+ ["$[1]" \\test]]
+ ["[0]" configuration ("[1]#[0]" equivalence)
["$[1]" \\test]]]]]
[\\library
["[0]" /
@@ -40,13 +42,15 @@
target (random.ascii/lower 4)
module (random.ascii/lower 5)
compilers (random.list amount $/compiler.random)
+ configuration ($configuration.random 5)
.let [compilation' ($_ list#composite
(list#conjoint (list#each (|>> (list "--host_dependency")) host_dependencies))
(list#conjoint (list#each (|>> (list "--library")) libraries))
(list#conjoint (list#each (|>> /compiler.format (list "--compiler")) compilers))
(list#conjoint (list#each (|>> (list "--source")) sources))
- (list "--target" target)
- (list "--module" module))
+ (list "--target" target
+ "--module" module
+ "--configuration" (configuration.format configuration)))
export ($_ list#composite
(list#conjoint (list#each (|>> (list "--source")) sources))
(list "--target" target))]]
@@ -72,6 +76,7 @@
[/.Source /.#sources (list#= sources)]
[/.Target /.#target (same? target)]
[/.Module /.#module (same? module)]
+ [configuration.Configuration /.#configuration (configuration#= configuration)]
))
)))
(_.cover [/.Interpretation]
@@ -93,6 +98,7 @@
[/.#sources (list#= sources)]
[/.#target (same? target)]
[/.#module (same? module)]
+ [/.#configuration (configuration#= configuration)]
)))))
(_.cover [/.Export]
(`` (and (~~ (template [<side> <?>]
@@ -119,13 +125,15 @@
/.#compilers compilers
/.#sources sources
/.#target target
- /.#module module]}]
+ /.#module module
+ /.#configuration configuration]}]
[{/.#Interpretation [/.#host_dependencies host_dependencies
/.#libraries libraries
/.#compilers compilers
/.#sources sources
/.#target target
- /.#module module]}]
+ /.#module module
+ /.#configuration configuration]}]
[{/.#Export [sources target]}]
)))))