Skip to content

Commit aeeca5c

Browse files
HeshamHM28claude
authored andcommitted
fix(java): find mvnw in parent dirs and respect --no-pr in tracer path
- Walk up parent directories when looking for mvnw wrapper, fixing multi-module projects where mvnw is in the root but optimizer runs from a submodule - Respect user's --no-pr flag in Java tracer path instead of hardcoding no_pr=True, allowing PR creation from tracer-based optimizations - Add --no-pr to e2e tracer test script Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f3eecac commit aeeca5c

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

codeflash/languages/java/maven_strategy.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -647,12 +647,16 @@ def get_text(xpath: str, default: str | None = None) -> str | None:
647647
return None
648648

649649
def find_executable(self, build_root: Path) -> str | None:
650-
mvnw_path = build_root / "mvnw"
651-
if mvnw_path.exists():
652-
return str(mvnw_path)
653-
mvnw_cmd_path = build_root / "mvnw.cmd"
654-
if mvnw_cmd_path.exists():
655-
return str(mvnw_cmd_path)
650+
# Walk up parent directories to find mvnw (multi-module projects keep it in the root)
651+
search = build_root.resolve()
652+
while search != search.parent:
653+
mvnw_path = search / "mvnw"
654+
if mvnw_path.exists():
655+
return str(mvnw_path)
656+
mvnw_cmd_path = search / "mvnw.cmd"
657+
if mvnw_cmd_path.exists():
658+
return str(mvnw_cmd_path)
659+
search = search.parent
656660
if Path("mvnw").exists():
657661
return "./mvnw"
658662
if Path("mvnw.cmd").exists():

codeflash/tracer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def _run_java_tracer(existing_args: Namespace | None = None) -> ArgumentParser:
419419
config.replay_test = replay_test_paths
420420
config.previous_checkpoint_functions = None
421421
config.effort = EffortLevel.HIGH.value
422-
config.no_pr = True
422+
config.no_pr = getattr(config, "no_pr", False)
423423
config.file = None
424424
config.function = None
425425
config.test_project_root = project_root

tests/scripts/end_to_end_test_java_tracer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def run_test(expected_improvement_pct: int) -> bool:
5252
"codeflash.main",
5353
"optimize",
5454
"java",
55+
"--no-pr",
5556
"-cp",
5657
str(classes_dir),
5758
"com.example.Workload",

0 commit comments

Comments
 (0)