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" diff --git a/.github/workflows/cli-tests.yml b/.github/workflows/cli-tests.yml index 2b718a774d..edcc31b6f8 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.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 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 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.ps1 b/util/scripts/launch.ps1 index dda258cc44..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 } @@ -29,9 +30,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}" --quiet assemble ":cli:${tool}:assemble" +& "${base}/build/install/lf-cli/bin/${tool}" @args diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index 36a342bd25..5e52051c60 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")" @@ -52,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]" @@ -72,8 +73,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}" --quiet assemble ":cli:${tool}:assemble" +"${base}/build/install/lf-cli/bin/${tool}" "$@"