refactor: extract shared find_wrapper_executable for Maven/Gradle#1940
refactor: extract shared find_wrapper_executable for Maven/Gradle#1940mashraf-222 merged 2 commits intomainfrom
Conversation
Deduplicate the parent-directory walking logic in MavenStrategy.find_executable and GradleStrategy.find_executable into a shared find_wrapper_executable() helper in build_tool_strategy.py. Both strategies now delegate to this single function, parameterized by wrapper file names and system fallback command. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @HeshamHM28's task in 3m 11s —— View job PR Review SummaryPrek ChecksAll checks passed ( Code ReviewSMALL PR — focused correctness check. The refactor is clean and correct. A few notes: Behavioral change in Maven (intentional, documented): The old Gradle behavior preserved: The old Gradle loop checked Minor observation: No bugs, security issues, or breaking API changes found. Duplicate DetectionNo duplicates detected. The Test CoverageSMALL PR — skipped per review policy. Last updated: 2026-04-01 |
The parent-dir walk logic was a standalone function imported by both strategies. Moving it onto the base class lets children call self.find_wrapper_executable() with no extra import. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Ubuntu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Summary
MavenStrategy.find_executableandGradleStrategy.find_executableinto a sharedfind_wrapper_executable()helper inbuild_tool_strategy.pyfind_executablegains parent-directory walking (previously only checkedbuild_rootdirectly), matching Gradle's existing behavior for multi-module projectsChanges
build_tool_strategy.py— Addedfind_wrapper_executable(build_root, wrapper_names, system_command)that walks up frombuild_rootchecking for wrapper scripts at each level, falling back toshutil.which(system_command).maven_strategy.py— Replaced 12-linefind_executablewith one-liner delegating to the shared helper.gradle_strategy.py— Replaced 17-linefind_executablewith one-liner delegating to the shared helper.Test plan
uv run prekpasses (ruff check + ruff format)test_build_tools.pypass (includesTestMavenExecutableandTestMavenExecutableWithProjectRoot)test_java_multimodule_deps_install.pypasstest_java_test_filter_validation.pypass