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. --- new-luxc/source/program.lux | 48 +++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'new-luxc/source') 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 [])))) -- cgit v1.2.3