Invoke ``ci/ci-compile.py`` for ``board`` with the chosen ``backend``. Returns True on success. Output is streamed so a slow first-time framework download is visible to the user.
(
project_root: Path,
board: str,
example: str,
backend: str,
*,
timeout_seconds: int,
)
| 429 | |
| 430 | |
| 431 | def _run_compile( |
| 432 | project_root: Path, |
| 433 | board: str, |
| 434 | example: str, |
| 435 | backend: str, |
| 436 | *, |
| 437 | timeout_seconds: int, |
| 438 | ) -> bool: |
| 439 | """Invoke ``ci/ci-compile.py`` for ``board`` with the chosen ``backend``. |
| 440 | |
| 441 | Returns True on success. Output is streamed so a slow first-time |
| 442 | framework download is visible to the user. |
| 443 | """ |
| 444 | if backend not in {"fbuild", "platformio"}: |
| 445 | raise ValueError(f"unknown backend {backend!r}") |
| 446 | |
| 447 | backend_flag = "--fbuild" if backend == "fbuild" else "--pio" |
| 448 | cmd: list[str] = [ |
| 449 | "uv", |
| 450 | "run", |
| 451 | "python", |
| 452 | "ci/ci-compile.py", |
| 453 | board, |
| 454 | "--examples", |
| 455 | example, |
| 456 | backend_flag, |
| 457 | ] |
| 458 | |
| 459 | print( |
| 460 | f"\n>>> Compiling [{backend}]: {subprocess.list2cmdline(cmd)}", |
| 461 | flush=True, |
| 462 | ) |
| 463 | try: |
| 464 | result = RunningProcess.run( |
| 465 | cmd, |
| 466 | check=False, |
| 467 | cwd=str(project_root), |
| 468 | timeout=timeout_seconds, |
| 469 | ) |
| 470 | except KeyboardInterrupt as ki: |
| 471 | handle_keyboard_interrupt(ki) |
| 472 | raise |
| 473 | |
| 474 | success = result.returncode == 0 |
| 475 | if not success: |
| 476 | print( |
| 477 | f"\n!!! Compile failed for backend={backend} board={board} " |
| 478 | f"(rc={result.returncode})", |
| 479 | file=sys.stderr, |
| 480 | ) |
| 481 | return success |
| 482 | |
| 483 | |
| 484 | # --------------------------------------------------------------------------- |
no test coverage detected