"""Build a minimal, offline, hand-rolled jar and its pom.xml, laid out as a Maven-compatible repository, for integration-testing the `java` module of id-configurator. No network access and no build backend (maven/gradle) are used: the jar is a plain zip file assembled with the standard library only, so this script can run in a minimal Python image with nothing installed. """ from __future__ import annotations import pathlib import zipfile GROUP = "org.interdiode" GROUP_PATH = GROUP.replace(".", "/") ARTIFACT = "idconfiguratortestpkg" VERSION = "0.0.1" OUT_DIR = pathlib.Path("/srv") / GROUP_PATH / ARTIFACT / VERSION MANIFEST = "Manifest-Version: 1.0\n" POM = f""" 4.0.0 {GROUP} {ARTIFACT} {VERSION} jar Test-only artifact served by the id-configurator integration tests """ def build_jar(path: pathlib.Path) -> None: with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as archive: archive.writestr("META-INF/MANIFEST.MF", MANIFEST) archive.writestr( "marker.txt", "test-only artifact served by the id-configurator integration tests\n", ) def main() -> None: OUT_DIR.mkdir(parents=True, exist_ok=True) build_jar(OUT_DIR / f"{ARTIFACT}-{VERSION}.jar") (OUT_DIR / f"{ARTIFACT}-{VERSION}.pom").write_text(POM, encoding="utf-8") if __name__ == "__main__": main()