diff --git a/org.lflang.lfc/build.gradle b/org.lflang.lfc/build.gradle index 625109c65f..da105af074 100644 --- a/org.lflang.lfc/build.gradle +++ b/org.lflang.lfc/build.gradle @@ -32,6 +32,10 @@ task buildLfc(dependsOn: ['setupTypescriptRuntime']) { apply plugin: 'application' apply plugin: 'com.github.johnrengelman.shadow' mainClassName = 'org.lflang.lfc.Main' + inputs.dir 'src' + inputs.dir '../org.lflang/src' + inputs.dir '../org.lflang/src-gen' + outputs.dir 'build' shadowJar { zip64 true @@ -50,7 +54,8 @@ task buildLfc(dependsOn: ['setupTypescriptRuntime']) { task setupTypescriptRuntime(type: Exec) { workingDir '../org.lflang/src/lib/ts/reactor-ts' commandLine 'npm', 'install' - outputs.file('../org.lflang/src/lib/ts/reactor-ts/*') + outputs.dir('../org.lflang/src/lib/ts/reactor-ts/lib') + inputs.dir('../org.lflang/src/lib/ts/reactor-ts') } buildLfc.finalizedBy shadowJar diff --git a/org.lflang/src/lib/ts/package.json b/org.lflang/src/lib/ts/package.json index 5b02ca52a1..70e99fb943 100644 --- a/org.lflang/src/lib/ts/package.json +++ b/org.lflang/src/lib/ts/package.json @@ -22,6 +22,7 @@ "@babel/preset-typescript": "^7.8.3", "command-line-usage": "^6.1.0", "command-line-args": "^5.1.1", + "microtime": "^3.1.1", "rimraf": "^3.0.2" }, "devDependencies": { diff --git a/org.lflang/src/lib/ts/reactor-ts b/org.lflang/src/lib/ts/reactor-ts index b3df0490c0..cbd9961884 160000 --- a/org.lflang/src/lib/ts/reactor-ts +++ b/org.lflang/src/lib/ts/reactor-ts @@ -1 +1 @@ -Subproject commit b3df0490c023f39e82d6e28d0d91c7abde117240 +Subproject commit cbd9961884d075be18cbcf55062cf185277bea63 diff --git a/org.lflang/src/org/lflang/generator/ts/TSGenerator.kt b/org.lflang/src/org/lflang/generator/ts/TSGenerator.kt index 3b8e9d6c9b..aadf07b9a7 100644 --- a/org.lflang/src/org/lflang/generator/ts/TSGenerator.kt +++ b/org.lflang/src/org/lflang/generator/ts/TSGenerator.kt @@ -91,7 +91,7 @@ class TSGenerator( */ val CONFIG_FILES = arrayOf("package.json", "tsconfig.json", "babel.config.js", ".eslintrc.json") - val RT_CONFIG_FILES = arrayOf("package.json", "package-lock.json", "tsconfig.json", ".babelrc") + val RT_CONFIG_FILES = arrayOf("package.json", "tsconfig.json") private val VG = ExpressionGenerator(::timeInTargetLanguage) { param -> "this.${param.name}.get()" } @@ -148,7 +148,6 @@ class TSGenerator( clean(context) copyRuntime() - buildRuntime() copyConfigFiles() val codeMaps = HashMap() @@ -208,19 +207,21 @@ class TSGenerator( */ private fun copyRuntime() { FileUtil.copyDirectoryFromClassPath( - "$LIB_PATH/reactor-ts", - tsFileConfig.reactorTsPath(), + "$LIB_PATH/reactor-ts/lib", + tsFileConfig.reactorTsPath().resolve("lib"), true ) - } - - private fun buildRuntime() { - (commandFactory.createCommand( - "npm", - listOf("install"), - tsFileConfig.reactorTsPath(), - false // only produce a warning if command is not found - )).run() + FileUtil.copyDirectoryFromClassPath( + "$LIB_PATH/reactor-ts/src/core/@types", + tsFileConfig.reactorTsPath().resolve("src/core/@types"), + true + ) + for (configFile in RT_CONFIG_FILES) { + FileUtil.copyFileFromClassPath( + "$LIB_PATH/reactor-ts/$configFile", + tsFileConfig.reactorTsPath().resolve(configFile) + ) + } } /**