"""Reproducibly build the Java 17 diagnostic agent; no Minecraft dependencies.""" from pathlib import Path import subprocess import tempfile import zipfile root = Path(__file__).resolve().parent with tempfile.TemporaryDirectory() as directory: subprocess.run([ "java", "-m", "jdk.compiler/com.sun.tools.javac.Main", "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "-source", "17", "-target", "17", "-d", directory, str(root / "PlayerSaveDiagnostics.java"), ], check=True) with zipfile.ZipFile(root / "player-save-diagnostics.jar", "w", zipfile.ZIP_DEFLATED) as archive: def write(name, data): entry = zipfile.ZipInfo(name, (2026, 1, 1, 0, 0, 0)) entry.compress_type = zipfile.ZIP_DEFLATED archive.writestr(entry, data) write("META-INF/MANIFEST.MF", b"Manifest-Version: 1.0\nPremain-Class: PlayerSaveDiagnostics\n\n") for path in sorted(Path(directory).glob("*.class")): write(path.name, path.read_bytes())