Runs a command, prints it, and checks for errors.
(cmd: List[str], cwd: Path = None, check: bool = True)
| 59 | DYLIB_SUFFIX = ".dll" |
| 60 | elif platform.system() == "Darwin": |
| 61 | DYLIB_PREFIX = "lib" |
| 62 | DYLIB_SUFFIX = ".dylib" |
| 63 | else: |
| 64 | DYLIB_PREFIX = "lib" |
| 65 | DYLIB_SUFFIX = ".so" |
| 66 | |
| 67 | RUST_BACKEND_DYLIB = ROOT_DIR / "target/release" / f"{DYLIB_PREFIX}rustc_codegen_jvm{DYLIB_SUFFIX}" |
| 68 | RUST_BACKEND_TOOLCHAIN = ROOT_DIR / "target/release/.rustc_codegen_jvm-toolchain" |
| 69 | JAVA_LINKER_EXE = JAVA_LINKER_DIR / "target/release/java-linker" |
| 70 | CARGO_JVM_EXE = CARGO_JVM_DIR / "target/release" / ( |
| 71 | "cargo-jvm.exe" if platform.system() == "Windows" else "cargo-jvm" |
| 72 | ) |
| 73 | |
| 74 | RUNTIME_CLASS_PREFIX = "org/rustlang/runtime/" |
| 75 | |
| 76 | # --- Helper Functions --- |
| 77 | |
| 78 | def run_command(cmd: List[str], cwd: Path = None, check: bool = True): |
| 79 | """Runs a command, prints it, and checks for errors.""" |
| 80 | cwd_str = f" (in {cwd})" if cwd else "" |
| 81 | print(f"{Colors.YELLOW}▶️ Running: {' '.join(cmd)}{cwd_str}{Colors.RESET}") |
| 82 | try: |
| 83 | proc = subprocess.run( |
no outgoing calls
no test coverage detected