Ensure unity build files are generated and up-to-date. Args: unity_chunks: Number of unity chunks to generate verbose: Enable verbose output Returns: Exit code (0 = success)
(unity_chunks: int, verbose: bool = False)
| 351 | |
| 352 | |
| 353 | def ensure_unity_files_generated(unity_chunks: int, verbose: bool = False) -> int: |
| 354 | """ |
| 355 | Ensure unity build files are generated and up-to-date. |
| 356 | |
| 357 | Args: |
| 358 | unity_chunks: Number of unity chunks to generate |
| 359 | verbose: Enable verbose output |
| 360 | |
| 361 | Returns: |
| 362 | Exit code (0 = success) |
| 363 | """ |
| 364 | if unity_chunks <= 0: |
| 365 | return 0 # Unity builds disabled |
| 366 | |
| 367 | print(f"Generating unity build files ({unity_chunks} chunks)...") |
| 368 | |
| 369 | cmd = [ |
| 370 | "uv", |
| 371 | "run", |
| 372 | "python", |
| 373 | str(PROJECT_ROOT / "ci" / "wasm_unity_generator.py"), |
| 374 | "--chunks", |
| 375 | str(unity_chunks), |
| 376 | "--output", |
| 377 | str(UNITY_DIR), |
| 378 | ] |
| 379 | |
| 380 | if verbose: |
| 381 | cmd.append("--verbose") |
| 382 | |
| 383 | result = subprocess.run(cmd, cwd=PROJECT_ROOT) |
| 384 | |
| 385 | if result.returncode != 0: |
| 386 | print(f"✗ Unity file generation failed with return code {result.returncode}") |
| 387 | return result.returncode |
| 388 | |
| 389 | return 0 |
| 390 | |
| 391 | |
| 392 | def create_thin_archive( |
no test coverage detected