aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/compositor
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/program/compositor.lux56
-rw-r--r--stdlib/source/program/compositor/cli.lux31
-rw-r--r--stdlib/source/program/compositor/static.lux11
3 files changed, 39 insertions, 59 deletions
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index fcf05f164..43bc084c5 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -49,7 +49,8 @@
## ["." interpreter]
]]
["." / #_
- ["#." cli (#+ Service)]])
+ ["#." cli (#+ Configuration)]
+ ["#." static (#+ Static)]])
(def: (or-crash! failure-description action)
(All [a]
@@ -67,48 +68,20 @@
(wrap output))))
(with-expansions [<parameters> (as-is anchor expression artifact)]
- ## TODO: Clean-up ASAP.
- ## (def: (save-artifacts! system state [packager package])
- ## (All [<parameters>]
- ## (-> (file.System Promise)
- ## (directive.State+ <parameters>)
- ## [(-> (Row [Module (generation.Buffer artifact)]) Binary) Path]
- ## (Promise (Try Any))))
- ## (let [?outcome (phase.run' state
- ## (:share [<parameters>]
- ## {(directive.State+ <parameters>)
- ## state}
- ## {(directive.Operation <parameters>
- ## (generation.Output artifact))
- ## (directive.lift-generation generation.output)}))]
- ## (case ?outcome
- ## (#try.Success [state output])
- ## (do (try.with promise.monad)
- ## [file (: (Promise (Try (File Promise)))
- ## (file.get-file promise.monad system package))]
- ## (!.use (:: file over-write) (packager output)))
-
- ## (#try.Failure error)
- ## (promise@wrap (#try.Failure error)))))
-
- (def: #export (compiler target partial-host-extension
- expander host-analysis platform host generation-bundle host-directive-bundle program extender
- service
- extension
+ (def: #export (compiler static
+ expander host-analysis platform generation-bundle host-directive-bundle program extender
+ configuration
packager,package)
(All [<parameters>]
- (-> Path
- Text
+ (-> Static
Expander
analysis.Bundle
(IO (Platform <parameters>))
- Host
(generation.Bundle <parameters>)
(directive.Bundle <parameters>)
(-> expression artifact)
Extender
- Service
- Text
+ Configuration
[(-> (Row [Module (generation.Buffer artifact)]) Binary) Path]
(Promise Any)))
(do promise.monad
@@ -116,8 +89,8 @@
console (|> console.system
promise.future
(:: @ map (|>> try.assume console.async)))]
- (case service
- (#/cli.Compilation configuration)
+ (case (get@ #/cli.service configuration)
+ #/cli.Compilation
(<| (or-crash! "Compilation failed:")
(do (try.with promise.monad)
[[state archive] (:share [<parameters>]
@@ -125,19 +98,16 @@
platform}
{(Promise (Try [(directive.State+ <parameters>)
Archive]))
- (platform.initialize extension target host (get@ #/cli.module configuration) expander host-analysis platform generation-bundle host-directive-bundle program extender)})
+ (platform.initialize static (get@ #/cli.module configuration) expander host-analysis platform generation-bundle host-directive-bundle program extender)})
[archive state] (:share [<parameters>]
{(Platform <parameters>)
platform}
{(Promise (Try [Archive (directive.State+ <parameters>)]))
- (platform.compile target partial-host-extension expander platform host configuration archive extension state)})
- _ (ioW.freeze (get@ #platform.&file-system platform) host target archive)
- ## _ (save-artifacts! (get@ #platform.&file-system platform) state packager,package)
- ## _ (cache/io.clean target ...)
- ]
+ (platform.compile static expander platform configuration [archive state])})
+ _ (ioW.freeze (get@ #platform.&file-system platform) (get@ #/static.host static) (get@ #/static.target static) archive)]
(wrap (log! "Compilation complete!"))))
- (#/cli.Interpretation configuration)
+ #/cli.Interpretation
## TODO: Fix the interpreter...
(undefined)
## (<| (or-crash! "Interpretation failed:")
diff --git a/stdlib/source/program/compositor/cli.lux b/stdlib/source/program/compositor/cli.lux
index 4453d5d36..0c20257ed 100644
--- a/stdlib/source/program/compositor/cli.lux
+++ b/stdlib/source/program/compositor/cli.lux
@@ -4,23 +4,20 @@
["p" parser
["." cli (#+ Parser)]]]
[world
- [file (#+ Path)]]]
- ## [///
- ## [importer (#+ Source)]]
- )
+ [file (#+ Path)]]])
+
+(type: #export Service
+ #Compilation
+ #Interpretation)
(type: #export Configuration
- {## #sources (List Source)
+ {#service Service
#sources (List Path)
#target Path
#module Text})
-(type: #export Service
- (#Compilation Configuration)
- (#Interpretation Configuration))
-
(template [<name> <long>]
- [(def: #export <name>
+ [(def: <name>
(Parser Text)
(cli.named <long> cli.any))]
@@ -29,15 +26,17 @@
[module "--module"]
)
+
+(def: service
+ (Parser Service)
+ ($_ p.or
+ (cli.this "build")
+ (cli.this "repl")))
+
(def: #export configuration
(Parser Configuration)
($_ p.and
+ ..service
(p.some ..source)
..target
..module))
-
-(def: #export service
- (Parser Service)
- ($_ p.or
- (p.after (cli.this "build") ..configuration)
- (p.after (cli.this "repl") ..configuration)))
diff --git a/stdlib/source/program/compositor/static.lux b/stdlib/source/program/compositor/static.lux
new file mode 100644
index 000000000..3fdd8727e
--- /dev/null
+++ b/stdlib/source/program/compositor/static.lux
@@ -0,0 +1,11 @@
+(.module:
+ [lux #*
+ [target (#+ Host)]
+ [world
+ [file (#+ Path)]]])
+
+(type: #export Static
+ {#host Host
+ #host-module-extension Text
+ #target Path
+ #artifact-extension Text})