Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradlew not longer used to run dev version of lf cli tools #1988

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/scripts/test-lfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions .github/scripts/test-lfd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
16 changes: 8 additions & 8 deletions .github/scripts/test-lff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
12 changes: 6 additions & 6 deletions .github/workflows/cli-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 4 additions & 7 deletions util/scripts/launch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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}"
}
& "${gradlew}" --quiet assemble ":cli:${tool}:assemble"
& "${base}/build/install/lf-cli/bin/${tool}" @args
16 changes: 7 additions & 9 deletions util/scripts/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down Expand Up @@ -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]"
Expand All @@ -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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using --quiet is a very good idea! However, by dropping the -p it is now not possible anymore to run lfc-dev from an arbitrary directory. For me, this was the main reason for using the script instead of the corresponding gradle run command. I will provide a fix in another PR.

"${base}/build/install/lf-cli/bin/${tool}" "$@"
Loading