diff --git a/code_to_optimize/java/pom.xml b/code_to_optimize/java/pom.xml index 06778ecaa..b8306a2a6 100644 --- a/code_to_optimize/java/pom.xml +++ b/code_to_optimize/java/pom.xml @@ -42,7 +42,7 @@ com.codeflash codeflash-runtime - 1.0.0 + 1.0.1 test diff --git a/codeflash-java-runtime/pom.xml b/codeflash-java-runtime/pom.xml index 36099feda..398ddab1a 100644 --- a/codeflash-java-runtime/pom.xml +++ b/codeflash-java-runtime/pom.xml @@ -7,7 +7,7 @@ com.codeflash codeflash-runtime - 1.0.0 + 1.0.1 jar CodeFlash Java Runtime diff --git a/codeflash/languages/java/build_tool_strategy.py b/codeflash/languages/java/build_tool_strategy.py index 67c295f2d..3d9cca233 100644 --- a/codeflash/languages/java/build_tool_strategy.py +++ b/codeflash/languages/java/build_tool_strategy.py @@ -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" diff --git a/codeflash/languages/java/build_tools.py b/codeflash/languages/java/build_tools.py index a1203ac4a..713db57db 100644 --- a/codeflash/languages/java/build_tools.py +++ b/codeflash/languages/java/build_tools.py @@ -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" diff --git a/codeflash/languages/java/gradle_strategy.py b/codeflash/languages/java/gradle_strategy.py index 81b1b6d59..b4481dd6e 100644 --- a/codeflash/languages/java/gradle_strategy.py +++ b/codeflash/languages/java/gradle_strategy.py @@ -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) diff --git a/codeflash/languages/java/maven_strategy.py b/codeflash/languages/java/maven_strategy.py index 6ab91cb3d..95dd310c4 100644 --- a/codeflash/languages/java/maven_strategy.py +++ b/codeflash/languages/java/maven_strategy.py @@ -62,11 +62,11 @@ CODEFLASH_CACHE_DIR = Path.home() / ".cache" / "codeflash" -CODEFLASH_DEPENDENCY_SNIPPET = """\ +CODEFLASH_DEPENDENCY_SNIPPET = f"""\ com.codeflash codeflash-runtime - 1.0.0 + {CODEFLASH_RUNTIME_VERSION} test """ @@ -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", ] @@ -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 "system" in content: - - def replace_system_dep(match: re.Match[str]) -> str: - block: str = match.group(0) - if "codeflash-runtime" in block and "system" in block: - return ( - "\n" - " com.codeflash\n" - " codeflash-runtime\n" - " 1.0.0\n" - " test\n" - " " - ) + + def update_codeflash_dep(match: re.Match[str]) -> str: + block: str = match.group(0) + if "codeflash-runtime" not in block: return block + return ( + "\n" + " com.codeflash\n" + " codeflash-runtime\n" + f" {CODEFLASH_RUNTIME_VERSION}\n" + " test\n" + " " + ) - content = re.sub(r"[\s\S]*?", 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"[\s\S]*?", 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 = "" @@ -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 diff --git a/codeflash/languages/java/resources/codeflash-runtime-1.0.0.jar b/codeflash/languages/java/resources/codeflash-runtime-1.0.0.jar deleted file mode 100644 index 546a8b89d..000000000 Binary files a/codeflash/languages/java/resources/codeflash-runtime-1.0.0.jar and /dev/null differ diff --git a/tests/test_languages/fixtures/java_tracer_e2e/pom.xml b/tests/test_languages/fixtures/java_tracer_e2e/pom.xml index 7fffde8b2..fc35a9a6d 100644 --- a/tests/test_languages/fixtures/java_tracer_e2e/pom.xml +++ b/tests/test_languages/fixtures/java_tracer_e2e/pom.xml @@ -23,7 +23,7 @@ com.codeflash codeflash-runtime - 1.0.0 + 1.0.1 test