diff --git a/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java b/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java index ac827ceda7..ad8743a7c3 100644 --- a/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java +++ b/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java @@ -228,13 +228,11 @@ public void doGenerate(List federates, RtiConfig rtiConfig) { } } - messageReporter - .nowhere() - .info("##### Generating launcher for federation " + " in directory " + fileConfig.binPath); - // Write the launcher file. - // Delete file previously produced, if any. File file = fileConfig.binPath.resolve(fileConfig.name).toFile(); + messageReporter.nowhere().info("Script for launching the federation: " + file); + + // Delete file previously produced, if any. if (file.exists()) { if (!file.delete()) messageReporter diff --git a/core/src/main/java/org/lflang/generator/LFGenerator.java b/core/src/main/java/org/lflang/generator/LFGenerator.java index b43254f1ae..f4e61e93d5 100644 --- a/core/src/main/java/org/lflang/generator/LFGenerator.java +++ b/core/src/main/java/org/lflang/generator/LFGenerator.java @@ -80,7 +80,7 @@ private GeneratorBase createGenerator(LFGeneratorContext context) { case CCPP -> new CGenerator(context, true); case Python -> new PythonGenerator(context); case CPP -> new CppGenerator(context, scopeProvider); - case TS -> new TSGenerator(context, scopeProvider); + case TS -> new TSGenerator(context); case Rust -> new RustGenerator(context, scopeProvider); }; } diff --git a/core/src/main/kotlin/org/lflang/generator/ts/TSGenerator.kt b/core/src/main/kotlin/org/lflang/generator/ts/TSGenerator.kt index 995bbf2a84..66f8f47330 100644 --- a/core/src/main/kotlin/org/lflang/generator/ts/TSGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/ts/TSGenerator.kt @@ -34,7 +34,6 @@ import org.lflang.generator.* import org.lflang.generator.GeneratorUtils.canGenerate import org.lflang.lf.Preamble import org.lflang.model -import org.lflang.scoping.LFGlobalScopeProvider import org.lflang.target.property.DockerProperty import org.lflang.target.property.NoCompileProperty import org.lflang.target.property.ProtobufsProperty @@ -59,8 +58,7 @@ private const val NO_NPM_MESSAGE = "The TypeScript target requires npm >= 6.14.4 * @author Hokeun Kim */ class TSGenerator( - private val context: LFGeneratorContext, - private val scopeProvider: LFGlobalScopeProvider + context: LFGeneratorContext ) : GeneratorBase(context) { @@ -440,6 +438,11 @@ class TSGenerator( context.unsuccessfulFinish() } else { context.finish(GeneratorResult.Status.COMPILED, codeMaps) + val shScriptPath = fileConfig.binPath.resolve(fileConfig.name) + val jsPath = fileConfig.srcGenPath.resolve("dist").resolve("${fileConfig.name}.js") + FileUtil.writeToFile("#!/bin/sh\nnode $jsPath", shScriptPath) + shScriptPath.toFile().setExecutable(true) + messageReporter.nowhere().info("Script for executing the compiled program: $shScriptPath.") } }