MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / build_library

Function build_library

build.py:130–169  ·  view source on GitHub ↗

Builds the Java standard library shim.

()

Source from the content-addressed store, hash-verified

128 return False
129 try:
130 with zipfile.ZipFile(jar_path) as archive:
131 return any(
132 name.endswith(".class") and not name.startswith(Config.RUNTIME_CLASS_PREFIX)
133 for name in archive.namelist()
134 )
135 except (OSError, zipfile.BadZipFile):
136 return True
137
138# --- Build Tasks (Replaces Makefile Targets) ---
139
140def clean():
141 """Cleans all generated files and build artifacts."""
142 print(f"{Colors.CYAN}🧹 Cleaning all components...{Colors.RESET}")
143
144 # Root cargo clean
145 run_command(["cargo", "clean"], cwd=Config.ROOT_DIR)
146
147 # Subproject cargo clean
148 run_command(["cargo", "clean"], cwd=Config.JAVA_LINKER_DIR)
149 run_command(["cargo", "clean"], cwd=Config.CARGO_JVM_DIR)
150
151 # Remove specific files and directories
152 for path in [
153 Config.CONFIG_TOML,
154 Config.JVM_TARGET_JSON,
155 Config.RUNTIME_DIR / "build"
156 ]:
157 try:
158 if path.is_dir():
159 shutil.rmtree(path)
160 elif path.is_file():
161 path.unlink()
162 except FileNotFoundError:
163 pass # It's already clean
164 print(f"{Colors.GREEN}🧼 All clean!{Colors.RESET}")
165
166def install_rust_components():
167 """Installs required Rust nightly components."""
168 print(f"{Colors.CYAN}🔧 Installing Rust components...{Colors.RESET}")
169 run_command(
170 ["rustup", "component", "add", "rustc-dev", "rust-src", "llvm-tools-preview"],
171 cwd=Config.ROOT_DIR,
172 )

Callers 1

all_tasksFunction · 0.85

Calls 2

is_staleFunction · 0.85
run_commandFunction · 0.70

Tested by

no test coverage detected