Skip to content
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
2 changes: 1 addition & 1 deletion code_to_optimize/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>com.codeflash</groupId>
<artifactId>codeflash-runtime</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion codeflash-java-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.codeflash</groupId>
<artifactId>codeflash-runtime</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>jar</packaging>

<name>CodeFlash Java Runtime</name>
Expand Down
2 changes: 1 addition & 1 deletion codeflash/languages/java/build_tool_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

logger = logging.getLogger(__name__)

_RUNTIME_JAR_NAME = "codeflash-runtime-1.0.0.jar"
_RUNTIME_JAR_NAME = "codeflash-runtime-1.0.1.jar"
_JAVA_RUNTIME_DIR = Path(__file__).parent.parent.parent.parent / "codeflash-java-runtime"


Expand Down
2 changes: 1 addition & 1 deletion codeflash/languages/java/build_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

logger = logging.getLogger(__name__)

CODEFLASH_RUNTIME_VERSION = "1.0.0"
CODEFLASH_RUNTIME_VERSION = "1.0.1"
CODEFLASH_RUNTIME_JAR_NAME = f"codeflash-runtime-{CODEFLASH_RUNTIME_VERSION}.jar"

JACOCO_PLUGIN_VERSION = "0.8.13"
Expand Down
2 changes: 1 addition & 1 deletion codeflash/languages/java/gradle_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def ensure_runtime(self, build_root: Path, test_module: str | None) -> bool:

libs_dir = module_root / "libs"
libs_dir.mkdir(parents=True, exist_ok=True)
dest_jar = libs_dir / "codeflash-runtime-1.0.0.jar"
dest_jar = libs_dir / "codeflash-runtime-1.0.1.jar"

if not dest_jar.exists():
logger.info("Copying codeflash-runtime JAR to %s", dest_jar)
Expand Down
46 changes: 23 additions & 23 deletions codeflash/languages/java/maven_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@

CODEFLASH_CACHE_DIR = Path.home() / ".cache" / "codeflash"

CODEFLASH_DEPENDENCY_SNIPPET = """\
CODEFLASH_DEPENDENCY_SNIPPET = f"""\
<dependency>
<groupId>com.codeflash</groupId>
<artifactId>codeflash-runtime</artifactId>
<version>1.0.0</version>
<version>{CODEFLASH_RUNTIME_VERSION}</version>
<scope>test</scope>
</dependency>
</dependencies>"""
Expand Down Expand Up @@ -140,7 +140,7 @@ def install_codeflash_runtime(project_root: Path, runtime_jar_path: Path, mvn: s
f"-Dfile={runtime_jar_path}",
"-DgroupId=com.codeflash",
"-DartifactId=codeflash-runtime",
"-Dversion=1.0.0",
f"-Dversion={CODEFLASH_RUNTIME_VERSION}",
"-Dpackaging=jar",
"-B",
]
Expand Down Expand Up @@ -288,26 +288,26 @@ def add_codeflash_dependency(pom_path: Path) -> bool:
content = pom_path.read_text(encoding="utf-8")

if "codeflash-runtime" in content:
if "<scope>system</scope>" in content:

def replace_system_dep(match: re.Match[str]) -> str:
block: str = match.group(0)
if "codeflash-runtime" in block and "<scope>system</scope>" in block:
return (
"<dependency>\n"
" <groupId>com.codeflash</groupId>\n"
" <artifactId>codeflash-runtime</artifactId>\n"
" <version>1.0.0</version>\n"
" <scope>test</scope>\n"
" </dependency>"
)

def update_codeflash_dep(match: re.Match[str]) -> str:
block: str = match.group(0)
if "codeflash-runtime" not in block:
return block
return (
"<dependency>\n"
" <groupId>com.codeflash</groupId>\n"
" <artifactId>codeflash-runtime</artifactId>\n"
f" <version>{CODEFLASH_RUNTIME_VERSION}</version>\n"
" <scope>test</scope>\n"
" </dependency>"
)

content = re.sub(r"<dependency>[\s\S]*?</dependency>", replace_system_dep, content)
pom_path.write_text(content, encoding="utf-8")
logger.info("Replaced system-scope codeflash-runtime dependency with test scope")
return True
logger.info("codeflash-runtime dependency already present in pom.xml")
updated = re.sub(r"<dependency>[\s\S]*?</dependency>", update_codeflash_dep, content)
if updated != content:
pom_path.write_text(updated, encoding="utf-8")
logger.info("Updated codeflash-runtime dependency to version %s in pom.xml", CODEFLASH_RUNTIME_VERSION)
else:
logger.info("codeflash-runtime dependency already up to date in pom.xml")
return True

closing_tag = "</dependencies>"
Expand Down Expand Up @@ -571,8 +571,8 @@ class MavenStrategy(BuildToolStrategy):
/ "com"
/ "codeflash"
/ "codeflash-runtime"
/ "1.0.0"
/ "codeflash-runtime-1.0.0.jar"
/ "1.0.1"
/ "codeflash-runtime-1.0.1.jar"
)

@property
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_languages/fixtures/java_tracer_e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>com.codeflash</groupId>
<artifactId>codeflash-runtime</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Loading