aboutsummaryrefslogtreecommitdiff
path: root/new-luxc
diff options
context:
space:
mode:
authorEduardo Julian2020-05-28 22:13:39 -0400
committerEduardo Julian2020-05-28 22:13:39 -0400
commitfcb1dcee2a4d502b41852a4c8e26b53ae7b2041e (patch)
tree704aa1808b8c27208a942f2af4cbd9adbc5f324a /new-luxc
parent2139e72d8e7c58cb355799d4a8412a0c38fb481c (diff)
Can now export Lux code as library TAR files.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/program.lux48
1 files changed, 31 insertions, 17 deletions
diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux
index f525d14d5..54f1437c7 100644
--- a/new-luxc/source/program.lux
+++ b/new-luxc/source/program.lux
@@ -10,7 +10,7 @@
[parser
[cli (#+ program:)]]
[concurrency
- [promise (#+ Promise)]]]
+ ["." promise (#+ Promise)]]]
[data
["." product]
[text
@@ -147,20 +147,34 @@
(host.array-write 3 (:coerce java/lang/Object state)))
method))))
-(program: [{configuration /cli.configuration}]
- (let [jar-path (format (get@ #/cli.target configuration) (:: file.system separator) "program.jar")]
- (exec (/.compiler {#/static.host @.jvm
- #/static.host-module-extension ".jvm"
- #/static.target (get@ #/cli.target configuration)
- #/static.artifact-extension ".class"}
- ..expander
- analysis.bundle
- ..platform
- ## generation.bundle
- translation.bundle
- (directive.bundle ..extender)
- jvm/program.program
- ..extender
- configuration
- [(packager.package jvm/program.class) jar-path])
+(def: (target service)
+ (-> /cli.Service /cli.Target)
+ (case service
+ (^or (#/cli.Compilation [sources target module])
+ (#/cli.Interpretation [sources target module])
+ (#/cli.Export [sources target]))
+ target))
+
+(def: (declare-success! _)
+ (-> Any (Promise Any))
+ (promise.future (io.exit +0)))
+
+(program: [{service /cli.service}]
+ (let [jar-path (format (..target service) (:: file.system separator) "program.jar")]
+ (exec (do promise.monad
+ [_ (/.compiler {#/static.host @.jvm
+ #/static.host-module-extension ".jvm"
+ #/static.target (..target service)
+ #/static.artifact-extension ".class"}
+ ..expander
+ analysis.bundle
+ ..platform
+ ## generation.bundle
+ translation.bundle
+ (directive.bundle ..extender)
+ jvm/program.program
+ ..extender
+ service
+ [(packager.package jvm/program.class) jar-path])]
+ (..declare-success! []))
(io.io []))))