From fcb1dcee2a4d502b41852a4c8e26b53ae7b2041e Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 28 May 2020 22:13:39 -0400 Subject: Can now export Lux code as library TAR files. --- stdlib/source/program/compositor.lux | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'stdlib/source/program/compositor.lux') diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 8993f21e7..d431198fa 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -49,8 +49,9 @@ ## ["." interpreter] ]] ["." / #_ - ["#." cli (#+ Configuration)] - ["#." static (#+ Static)]]) + ["#." cli (#+ Service)] + ["#." static (#+ Static)] + ["#." export]]) (def: (or-crash! failure-description action) (All [a] @@ -70,7 +71,7 @@ (with-expansions [ (as-is anchor expression artifact)] (def: #export (compiler static expander host-analysis platform generation-bundle host-directive-bundle program extender - configuration + service packager,package) (All [] (-> Static @@ -81,7 +82,7 @@ (directive.Bundle ) (-> expression artifact) Extender - Configuration + Service [(-> (Row [Module (generation.Buffer artifact)]) Binary) Path] (Promise Any))) (do {@ promise.monad} @@ -89,27 +90,36 @@ console (|> console.system promise.future (:: @ map (|>> try.assume console.async)))] - (case (get@ #/cli.service configuration) - #/cli.Compilation + (case service + (#/cli.Compilation compilation) (<| (or-crash! "Compilation failed:") (do (try.with promise.monad) - [[state archive] (:share [] + [#let [[compilation-sources compilation-target compilation-module] compilation] + [state archive] (:share [] {(Platform ) platform} {(Promise (Try [(directive.State+ ) Archive])) - (:assume (platform.initialize static (get@ #/cli.module configuration) expander host-analysis platform generation-bundle host-directive-bundle program extender))}) + (:assume (platform.initialize static compilation-module expander host-analysis platform generation-bundle host-directive-bundle program extender))}) [archive state] (:share [] {(Platform ) platform} {(Promise (Try [Archive (directive.State+ )])) - (:assume (platform.compile static expander platform configuration [archive state]))}) + (:assume (platform.compile static expander platform compilation [archive state]))}) _ (ioW.freeze (get@ #platform.&file-system platform) (get@ #/static.host static) (get@ #/static.target static) archive)] (wrap (log! "Compilation complete!")))) + + (#/cli.Export export) + (<| (or-crash! "Export failed:") + (do (try.with promise.monad) + [_ (/export.export (get@ #platform.&file-system platform) + (get@ #/static.host-module-extension static) + export)] + (wrap (log! "Export complete!")))) - #/cli.Interpretation + (#/cli.Interpretation interpretation) ## TODO: Fix the interpreter... (undefined) ## (<| (or-crash! "Interpretation failed:") - ## (interpreter.run (try.with promise.monad) console platform configuration generation-bundle)) + ## (interpreter.run (try.with promise.monad) console platform interpretation generation-bundle)) )))) -- cgit v1.2.3