From 4e1ca21a497a3ba6892e569f8523e7a9ab231526 Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Thu, 31 Aug 2023 21:44:24 -0700 Subject: [PATCH 1/8] Do not use gradlew to run dev version of lf cli tools --- util/scripts/launch.ps1 | 8 ++------ util/scripts/launch.sh | 7 ++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/util/scripts/launch.ps1 b/util/scripts/launch.ps1 index dda258cc44..bb14204f5c 100644 --- a/util/scripts/launch.ps1 +++ b/util/scripts/launch.ps1 @@ -29,9 +29,5 @@ $base="$PSScriptRoot\..\..\" $gradlew="${base}/gradlew.bat" # invoke script -if ($args.Length -eq 0) { - & "${gradlew}" -p "${base}" "cli:${tool}:run" -} else { - $argsString = $args -join " " - & "${gradlew}" -p "${base}" "cli:${tool}:run" --args="${argsString}" -} \ No newline at end of file +& "${gradlew}" assemble +& "${base}/build/install/lf-cli/bin/${tool}" @args \ No newline at end of file diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index 36a342bd25..22a272f81f 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -72,8 +72,5 @@ fi gradlew="${base}/gradlew" # Launch the tool. -if [ $# -eq 0 ]; then - "${gradlew}" -p "${base}" "cli:${tool}:run" -else - "${gradlew}" -p "${base}" "cli:${tool}:run" --args="$*" -fi +"${gradlew}" assemble +"${base}/build/install/lf-cli/bin/${tool}" "$@" \ No newline at end of file From 02a8557b41ac5539303bfad6f2078616eb7428ed Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Tue, 5 Sep 2023 19:50:12 -0700 Subject: [PATCH 2/8] Optimise gradle per @lhstrh suggestions, add --quiet flag --- util/scripts/launch.ps1 | 2 +- util/scripts/launch.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/util/scripts/launch.ps1 b/util/scripts/launch.ps1 index bb14204f5c..40cd25ba55 100644 --- a/util/scripts/launch.ps1 +++ b/util/scripts/launch.ps1 @@ -29,5 +29,5 @@ $base="$PSScriptRoot\..\..\" $gradlew="${base}/gradlew.bat" # invoke script -& "${gradlew}" assemble +& "${gradlew}" --quiet assemble ":cli:${tool}:assemble" & "${base}/build/install/lf-cli/bin/${tool}" @args \ No newline at end of file diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index 22a272f81f..5233cb55fb 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -18,6 +18,8 @@ # This solution, adapted from an example written by Geoff Nixon, is POSIX- # compliant and robust to symbolic links. If a chain of more than 1000 links # is encountered, we return. +set -euo pipefail + find_dir() ( start_dir=$PWD cd "$(dirname "$1")" @@ -72,5 +74,5 @@ fi gradlew="${base}/gradlew" # Launch the tool. -"${gradlew}" assemble +"${gradlew}" --quiet assemble ":cli:${tool}:assemble" "${base}/build/install/lf-cli/bin/${tool}" "$@" \ No newline at end of file From 963baefc4876fdcd3c906fa13fe1402947826ac8 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 18:05:14 -0700 Subject: [PATCH 3/8] Rename executables in bin --- bin/{lfc => lfc-dev} | 0 bin/{lfc.ps1 => lfc-dev.ps1} | 0 bin/{lfd => lfd-dev} | 0 bin/{lfd.ps1 => lfd-dev.ps1} | 0 bin/{lff => lff-dev} | 0 bin/{lff.ps1 => lff-dev.ps1} | 0 util/scripts/launch.sh | 7 +++---- 7 files changed, 3 insertions(+), 4 deletions(-) rename bin/{lfc => lfc-dev} (100%) rename bin/{lfc.ps1 => lfc-dev.ps1} (100%) rename bin/{lfd => lfd-dev} (100%) rename bin/{lfd.ps1 => lfd-dev.ps1} (100%) rename bin/{lff => lff-dev} (100%) rename bin/{lff.ps1 => lff-dev.ps1} (100%) diff --git a/bin/lfc b/bin/lfc-dev similarity index 100% rename from bin/lfc rename to bin/lfc-dev diff --git a/bin/lfc.ps1 b/bin/lfc-dev.ps1 similarity index 100% rename from bin/lfc.ps1 rename to bin/lfc-dev.ps1 diff --git a/bin/lfd b/bin/lfd-dev similarity index 100% rename from bin/lfd rename to bin/lfd-dev diff --git a/bin/lfd.ps1 b/bin/lfd-dev.ps1 similarity index 100% rename from bin/lfd.ps1 rename to bin/lfd-dev.ps1 diff --git a/bin/lff b/bin/lff-dev similarity index 100% rename from bin/lff rename to bin/lff-dev diff --git a/bin/lff.ps1 b/bin/lff-dev.ps1 similarity index 100% rename from bin/lff.ps1 rename to bin/lff-dev.ps1 diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index 5233cb55fb..b5e0f8c03e 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -54,12 +54,11 @@ else fi #============================================================================ - -if [[ "$0" == *lfc ]]; then +if [[ "${0%%-dev}" == *lfc ]]; then tool="lfc" -elif [[ "$0" == *lff ]]; then +elif [[ "${0%%-dev}" == *lff ]]; then tool="lff" -elif [[ "$0" == *lfd ]]; then +elif [[ "${0%%-dev}" == *lfd ]]; then tool="lfd" else known_commands="[lfc, lff, lfd]" From 805c149cf8b1d531a885b7e80c024fa13d37223b Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 18:15:17 -0700 Subject: [PATCH 4/8] Add trailing newline --- util/scripts/launch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index b5e0f8c03e..5e52051c60 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -74,4 +74,4 @@ gradlew="${base}/gradlew" # Launch the tool. "${gradlew}" --quiet assemble ":cli:${tool}:assemble" -"${base}/build/install/lf-cli/bin/${tool}" "$@" \ No newline at end of file +"${base}/build/install/lf-cli/bin/${tool}" "$@" From 313db97f79e18edced156060f968cb48f87014fd Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 18:35:55 -0700 Subject: [PATCH 5/8] Update CLI tests --- .github/scripts/test-lfc.sh | 6 +++--- .github/scripts/test-lfd.sh | 6 +++--- .github/scripts/test-lff.sh | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/scripts/test-lfc.sh b/.github/scripts/test-lfc.sh index fe9b6e3757..bc43342e44 100755 --- a/.github/scripts/test-lfc.sh +++ b/.github/scripts/test-lfc.sh @@ -14,7 +14,7 @@ function test_with_links() { foo/bar/baz/link-${1} --help } -bin/lfc test/C/src/Minimal.lf +bin/lfc-dev test/C/src/Minimal.lf -# Ensure that lfc is robust to symbolic links. -test_with_links "lfc" +# Ensure that lfc can be invoked via symbolic links. +test_with_links "lfc-dev" diff --git a/.github/scripts/test-lfd.sh b/.github/scripts/test-lfd.sh index 041daf7029..0f04fcc5b1 100755 --- a/.github/scripts/test-lfd.sh +++ b/.github/scripts/test-lfd.sh @@ -14,7 +14,7 @@ function test_with_links() { foo/bar/baz/link-${1} --help } -bin/lfd test/C/src/Minimal.lf +bin/lfd-dev test/C/src/Minimal.lf -# Ensure that lfd is robust to symbolic links. -test_with_links "lfd" +# Ensure that lfd can be invoked via symbolic links. +test_with_links "lfd-dev" diff --git a/.github/scripts/test-lff.sh b/.github/scripts/test-lff.sh index d98578a39b..273c26b429 100755 --- a/.github/scripts/test-lff.sh +++ b/.github/scripts/test-lff.sh @@ -15,14 +15,14 @@ function test_with_links() { } # just a couple of smoke tests -bin/lff --help -bin/lff --version +bin/lff-dev --help +bin/lff-dev --version -bin/lff -d test/C/src/Minimal.lf -bin/lff --dry-run test/Cpp/src/Minimal.lf +bin/lff-dev -d test/C/src/Minimal.lf +bin/lff-dev --dry-run test/Cpp/src/Minimal.lf -bin/lff -d test/C/src/Minimal.lf -bin/lff --dry-run test/Cpp/src/Minimal.lf +bin/lff-dev -d test/C/src/Minimal.lf +bin/lff-dev --dry-run test/Cpp/src/Minimal.lf -# Ensure that lff is robust to symbolic links. -test_with_links "lff" +# Ensure that lff can be invoked via symbolic links. +test_with_links "lff-dev" From 6b49fa464a44f4cbc7a7edfd6764a525df40452e Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 20:09:56 -0700 Subject: [PATCH 6/8] Fix more filenames --- .github/workflows/cli-tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cli-tests.yml b/.github/workflows/cli-tests.yml index 2b718a774d..5312aef33c 100644 --- a/.github/workflows/cli-tests.yml +++ b/.github/workflows/cli-tests.yml @@ -44,24 +44,24 @@ jobs: if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} - name: Test lfc PowerShell script (Windows only) run: | - bin/lfc.ps1 --version - bin/lfc.ps1 test/C/src/Minimal.lf + bin/lfc-dev.ps1 --version + bin/lfc-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lfc.bat --version ./build/install/lf-cli/bin/lfc.bat test/C/src/Minimal.lf if: ${{ runner.os == 'Windows' }} - name: Test lff PowerShell script (Windows only) run: | - bin/lff.ps1 --version - bin/lff.ps1 test/C/src/Minimal.lf + bin/lff-dev-dev.ps1 --version + bin/lff-dev-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lff.bat --version ./build/install/lf-cli/bin/lff.bat test/C/src/Minimal.lf if: ${{ runner.os == 'Windows' }} - name: Test lfd PowerShell script (Windows only) run: | - bin/lfd.ps1 --version - bin/lfd.ps1 test/C/src/Minimal.lf + bin/lfd-dev.ps1 --version + bin/lfd-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lfd.bat --version ./build/install/lf-cli/bin/lfd.bat test/C/src/Minimal.lf From d310df13bdd7fb7da9d18712669a5a083139dec4 Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Wed, 6 Sep 2023 20:42:00 -0700 Subject: [PATCH 7/8] Strip out '-dev', and add trailing space --- util/scripts/launch.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/scripts/launch.ps1 b/util/scripts/launch.ps1 index 40cd25ba55..9100c75434 100644 --- a/util/scripts/launch.ps1 +++ b/util/scripts/launch.ps1 @@ -13,7 +13,8 @@ $invokerName = [System.IO.Path]::GetFileNameWithoutExtension("$(Split-Path -Path $mainClassTable = @{"lfc" = "org.lflang.cli.Lfc"; "lff" = "org.lflang.cli.Lff"; "lfd" = "org.lflang.cli.Lfd"} $tool = $null foreach ($k in $mainClassTable.Keys) { - if ($invokerName.EndsWith($k)) { + # This replacement is not ideal, but it is kinda analogous to its counterpart in launch.sh. + if ($invokerName.Contains(($k -replace "-dev", ""))) { $tool = $k break } @@ -30,4 +31,4 @@ $gradlew="${base}/gradlew.bat" # invoke script & "${gradlew}" --quiet assemble ":cli:${tool}:assemble" -& "${base}/build/install/lf-cli/bin/${tool}" @args \ No newline at end of file +& "${base}/build/install/lf-cli/bin/${tool}" @args From 3f42c83a51b037abaabc49c91d568dd50c39040b Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Wed, 6 Sep 2023 20:53:18 -0700 Subject: [PATCH 8/8] Fix broken script names --- .github/workflows/cli-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli-tests.yml b/.github/workflows/cli-tests.yml index 5312aef33c..edcc31b6f8 100644 --- a/.github/workflows/cli-tests.yml +++ b/.github/workflows/cli-tests.yml @@ -52,8 +52,8 @@ jobs: if: ${{ runner.os == 'Windows' }} - name: Test lff PowerShell script (Windows only) run: | - bin/lff-dev-dev.ps1 --version - bin/lff-dev-dev.ps1 test/C/src/Minimal.lf + bin/lff-dev.ps1 --version + bin/lff-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lff.bat --version ./build/install/lf-cli/bin/lff.bat test/C/src/Minimal.lf