diff --git a/.github/scripts/package_lfc.sh b/.github/scripts/package_lfc.sh index abc282e9c6..f89379364b 100755 --- a/.github/scripts/package_lfc.sh +++ b/.github/scripts/package_lfc.sh @@ -6,8 +6,8 @@ cd $GITHUB_WORKSPACE outname="lfc_nightly_$(date '+%Y%m%d-%H%M%S')" -# build lfc compiler -./gradlew generateStandaloneCompiler +# build lf compiler +./gradlew buildLfc # assemble the files in a separate directory mkdir -p $outname/bin diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99a12d0a54..e087715ba2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -229,7 +229,7 @@ jobs: run: pip3 install -r benchmark/runner/requirements.txt - name: Build lfc; run: | - ./gradlew generateStandaloneCompiler + ./gradlew buildLfc - name: "Set LF_PATH environmental variable" run: | echo "LF_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV diff --git a/bin/build-lfc b/bin/build-lfc index 224624a556..9630b9acd9 100755 --- a/bin/build-lfc +++ b/bin/build-lfc @@ -88,7 +88,7 @@ fi if [ ! -f "${jarpath}" ] || ! "${FIND}" "${lfbase}src" -path "${lfbase}src/test" -prune -o -type f -newer "${jarpath}" -exec false {} +; then # Check if jar is missing or out-of-date relative to source files 1>&2 echo "Jar file is missing or out-of-date; running Gradle..." - "${base}gradlew" ${flags} -p "${base}" generateStandaloneCompiler + "${base}gradlew" ${flags} -p "${base}" buildLfc touch -c -- "${jarpath}" # Ensure the file timestamp is up-to-date even if the file didn't need to be updated else echo "Already up-to-date." diff --git a/bin/lfc b/bin/lfc index 12ab5d948f..a2a79e3e77 100755 --- a/bin/lfc +++ b/bin/lfc @@ -31,7 +31,7 @@ popd () { # Build first if no jar exists. if [[ ! -f "$jarpath" ]]; then pushd "$base" - ./gradlew generateStandaloneCompiler + ./gradlew buildLfc popd fi diff --git a/bin/lfc.ps1 b/bin/lfc.ps1 index 145e89951a..9e0a7a985b 100644 --- a/bin/lfc.ps1 +++ b/bin/lfc.ps1 @@ -12,7 +12,7 @@ $jarpath="$lfbase\build\libs\org.lflang.lfc-0.1.0-SNAPSHOT-all.jar" if (-not (Test-Path $jarpath -PathType leaf)) { $old_pwd = $pwd cd $base - ./gradlew generateStandaloneCompiler + ./gradlew buildLfc cd $old_pwd } @@ -34,4 +34,4 @@ if ([version]$java_version -lt [version]"11.0") { } # invoke lfc -& $java_cmd -jar $jarpath $args \ No newline at end of file +& $java_cmd -jar $jarpath $args diff --git a/org.lflang.lfc/build.gradle b/org.lflang.lfc/build.gradle index 2df8b7b950..f96d08da49 100644 --- a/org.lflang.lfc/build.gradle +++ b/org.lflang.lfc/build.gradle @@ -7,7 +7,7 @@ dependencies { apply plugin: 'application' apply plugin: 'com.github.johnrengelman.shadow' -task generateStandaloneCompiler() { +task buildLfc() { apply plugin: 'application' apply plugin: 'com.github.johnrengelman.shadow' mainClassName = 'org.lflang.lfc.Main' @@ -25,7 +25,7 @@ task generateStandaloneCompiler() { } } -generateStandaloneCompiler.finalizedBy shadowJar +buildLfc.finalizedBy shadowJar task runLfc(type: JavaExec) { // Note: when you use --args, you need to escape cli flags which start with -- @@ -35,4 +35,4 @@ task runLfc(type: JavaExec) { group = "application" classpath = sourceSets.main.runtimeClasspath mainClass = 'org.lflang.lfc.Main' -} \ No newline at end of file +} diff --git a/org.lflang.lfc/src/org/lflang/lfc/Main.java b/org.lflang.lfc/src/org/lflang/lfc/Main.java index e0d469ed44..8b5c2ae3ba 100644 --- a/org.lflang.lfc/src/org/lflang/lfc/Main.java +++ b/org.lflang.lfc/src/org/lflang/lfc/Main.java @@ -59,7 +59,7 @@ public class Main { * The location of the class file of this class inside of the jar. */ private static String MAIN_PATH_IN_JAR = String.join("/", - new String[] {"!", "org", "lflang", "generator", "Main.class"}); + new String[] {"!", "org", "lflang", "lfc", "Main.class"}); /** @@ -240,8 +240,8 @@ public static void main(final String[] args) { String jarUrl = mainClassUrl.replace("jar:", "").replace(MAIN_PATH_IN_JAR, ""); main.jarPath = Paths.get(new URL(jarUrl).toURI()); - main.srcPath = main.jarPath.getParent().resolve(Paths.get("..", "..", "src")).normalize(); - main.rootPath = main.jarPath.getParent().resolve(Paths.get("..", "..", "..")).normalize(); + main.srcPath = main.jarPath.getParent().getParent().getParent().resolve("src").normalize(); + main.rootPath = main.jarPath.getParent().getParent().getParent().getParent().normalize(); } catch (MalformedURLException | URISyntaxException e) { reporter.printFatalErrorAndExit("An unexpected error occurred:", e); } @@ -347,7 +347,7 @@ private void rebuildOrExit() { } else { cmdList.add("./gradlew"); } - cmdList.add("generateStandaloneCompiler"); + cmdList.add("buildLfc"); if (!this.mustUpdate()) { cmdList.add("--offline"); } @@ -377,7 +377,7 @@ private void rebuildOrExit() { * @return */ private boolean rebuildAndFork() { - // jar:file:org.lflang.linguafranca/build/libs/org.lflang.linguafranca-0.1.0-SNAPSHOT-all.jar!/org/icyphy/generator/Main.class + // jar:file:org.lflang.lfc/build/libs/org.lflang.lfc--SNAPSHOT-all.jar!/org/lflang/lfc/Main.class if (needsUpdate()) { // Only rebuild if the jar is out-of-date. reporter.printInfo("Jar file is missing or out-of-date; running Gradle.");