Skip to content

Commit b6f79d1

Browse files
chore: restore resources/ fallback logic for JAR resolution
The reviewer asked to remove the bundled JAR file, not the code that looks for it. The fallback paths are still valid if a JAR is placed there manually or by future tooling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f1d7200 commit b6f79d1

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

codeflash/languages/java/build_tool_strategy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ def find_runtime_jar(self) -> Path | None:
6060
Subclasses should override to prepend tool-specific cache paths
6161
and fall back to super().find_runtime_jar().
6262
"""
63+
resources_jar = Path(__file__).parent / "resources" / _RUNTIME_JAR_NAME
64+
if resources_jar.exists():
65+
return resources_jar
66+
6367
dev_jar_maven = _JAVA_RUNTIME_DIR / "target" / _RUNTIME_JAR_NAME
6468
if dev_jar_maven.exists():
6569
return dev_jar_maven

codeflash/languages/java/comparator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ def _find_comparator_jar(project_root: Path | None = None) -> Path | None:
6868
if m2_jar.exists():
6969
return m2_jar
7070

71+
# Check bundled JAR in package resources
72+
resources_jar = Path(__file__).parent / "resources" / CODEFLASH_RUNTIME_JAR_NAME
73+
if resources_jar.exists():
74+
return resources_jar
75+
7176
return None
7277

7378

codeflash/languages/java/line_profiler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,11 @@ def find_agent_jar() -> Path | None:
584584
if m2_jar.exists():
585585
return m2_jar
586586

587+
# Check bundled JAR in package resources
588+
resources_jar = Path(__file__).parent / "resources" / AGENT_JAR_NAME
589+
if resources_jar.exists():
590+
return resources_jar
591+
587592
# Check development build directory
588593
dev_jar = Path(__file__).parent.parent.parent.parent / "codeflash-java-runtime" / "target" / AGENT_JAR_NAME
589594
if dev_jar.exists():

0 commit comments

Comments
 (0)