Generates config.toml and jvm-unknown-unknown.json from templates.
()
| 223 | recorded_toolchain = ( |
| 224 | Config.RUST_BACKEND_TOOLCHAIN.read_text() |
| 225 | if Config.RUST_BACKEND_TOOLCHAIN.exists() |
| 226 | else None |
| 227 | ) |
| 228 | if ( |
| 229 | not is_stale(Config.RUST_BACKEND_DYLIB, sources) |
| 230 | and recorded_toolchain == toolchain |
| 231 | ): |
| 232 | print(f"{Colors.GREEN}✅ Rust codegen backend is up to date.{Colors.RESET}") |
| 233 | return |
| 234 | |
| 235 | print(f"{Colors.CYAN}📦 Building Rust codegen backend...{Colors.RESET}") |
| 236 | # Setting RUSTFLAGS as an environment variable is more robust. |
| 237 | env = os.environ.copy() |
| 238 | env["RUSTFLAGS"] = "-Awarnings" |
| 239 | subprocess.run(["cargo", "build", "--release"], cwd=Config.ROOT_DIR, check=True, env=env) |
| 240 | Config.RUST_BACKEND_TOOLCHAIN.write_text(toolchain) |
| 241 | print(f"{Colors.GREEN} Rust codegen backend built successfully.{Colors.RESET}") |
| 242 | |
| 243 | def build_java_linker(): |
| 244 | """Builds the java-linker subproject.""" |
| 245 | if not is_stale(Config.JAVA_LINKER_EXE, Config.LINKER_RUST_SOURCES): |
| 246 | print(f"{Colors.GREEN}✅ Java linker is up to date.{Colors.RESET}") |