Skip to content

fix: relax run tool - #151

Open
naveena456 wants to merge 4 commits into
eclipse-score:mainfrom
bgsw-contrib:feature/relax-run-tool
Open

fix: relax run tool#151
naveena456 wants to merge 4 commits into
eclipse-score:mainfrom
bgsw-contrib:feature/relax-run-tool

Conversation

@naveena456

@naveena456 naveena456 commented Sep 11, 2026

Copy link
Copy Markdown

Enhanced the script to avoid unnecessary Bazel execution when a matching local tool is available.

  • Detect and validate the locally installed tool version.
  • Use the local tool directly when the version matches exactly.
  • Added --strict to always use the Bazel-based tool.
  • Fall back to Bazel if the local tool is unavailable or the version does not match.

Closes #148

@naveena456 naveena456 changed the title Feature/relax run tool relax run tool Sep 11, 2026
@naveena456 naveena456 changed the title relax run tool fix: relax run tool Sep 11, 2026
@naveena456 naveena456 mentioned this pull request Sep 11, 2026
Comment thread tools/run-tool Outdated
local installer="${SCRIPT_DIR}/internal/devcontainer/install.py"
command -v python3 >/dev/null 2>&1 || return 1
[[ -f "${installer}" ]] || return 1
python3 "${installer}" version "${tool_name}" 2>/dev/null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I prefer that tool_name is passed in as argument like it is done at installed_version

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed

Comment thread tools/run-tool
installed_version() {
local tool="$1" arg output version
while IFS= read -r arg; do
if output=$("${tool}" "${arg}" </dev/null 2>&1); then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This script sets -euo pipefail. Will it fail, when the tool returns an error? Imagine a tool understands -v but not --version or -version.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No; because the command runs in an if condition, set -e ignores its non-zero status, the loop continues through all version flags, and if none succeeds, installed_version returns 1, causing the local check to fail and run-tool to fall back to Bazel.

Comment thread tools/run-tool

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

because the script got more complicated, I would like to have tests added.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

New test run-tool to cover local version fallback has been added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

relax run-tool

2 participants