Generates core.json from the library shim JAR.
()
| 169 | run_command( |
| 170 | ["rustup", "component", "add", "rustc-dev", "rust-src", "llvm-tools-preview"], |
| 171 | cwd=Config.ROOT_DIR, |
| 172 | ) |
| 173 | |
| 174 | def build_runtime(): |
| 175 | """Builds the Java runtime support JAR.""" |
| 176 | if (not is_stale(Config.RUNTIME_JAR, Config.RUNTIME_SOURCES) |
| 177 | and not contains_non_runtime_classes(Config.RUNTIME_JAR)): |
| 178 | print(f"{Colors.GREEN}✅ Java runtime is up to date.{Colors.RESET}") |
| 179 | return |
| 180 | |
| 181 | if not Config.RUNTIME_SOURCES: |
| 182 | print(f"{Colors.RED}❌ No Java sources found under {Config.RUNTIME_DIR / 'src'}{Colors.RESET}") |
| 183 | sys.exit(1) |
| 184 | |
| 185 | print(f"{Colors.CYAN}📚 Building Java runtime...{Colors.RESET}") |
| 186 | |
| 187 | if Config.RUNTIME_CLASSES_DIR.exists(): |
| 188 | shutil.rmtree(Config.RUNTIME_CLASSES_DIR) |
| 189 | Config.RUNTIME_CLASSES_DIR.mkdir(parents=True, exist_ok=True) |
| 190 | Config.RUNTIME_JAR.parent.mkdir(parents=True, exist_ok=True) |
| 191 | |
| 192 | source_paths = [str(path) for path in Config.RUNTIME_SOURCES] |
| 193 | javac_base = ["javac", "-Xlint:-options", "-d", str(Config.RUNTIME_CLASSES_DIR)] |
| 194 | proc = run_command(["javac", "--release", "8"] + javac_base[1:] + source_paths, check=False) |
| 195 | if proc.returncode != 0: |
| 196 | print( |
| 197 | f"{Colors.YELLOW}⚠️ javac --release 8 failed; retrying with -source 8 -target 8.{Colors.RESET}" |
| 198 | ) |
| 199 | run_command(["javac", "-source", "8", "-target", "8"] + javac_base[1:] + source_paths) |
no test coverage detected