Compile the project using fbuild CLI subprocess. Uses ``fbuild build`` as a subprocess so that Ctrl+C terminates it immediately (the Rust binary handles SIGINT natively). Args: build_dir: Project directory containing platformio.ini environment: Build environment (None =
(
build_dir: Path,
environment: str | None = None,
verbose: bool = False,
clean: bool = False,
timeout: float = 1800,
quiet: bool = False,
log_file: IO[str] | None = None,
)
| 285 | |
| 286 | |
| 287 | def run_fbuild_compile( |
| 288 | build_dir: Path, |
| 289 | environment: str | None = None, |
| 290 | verbose: bool = False, |
| 291 | clean: bool = False, |
| 292 | timeout: float = 1800, |
| 293 | quiet: bool = False, |
| 294 | log_file: IO[str] | None = None, |
| 295 | ) -> FbuildCommandResult: |
| 296 | """Compile the project using fbuild CLI subprocess. |
| 297 | |
| 298 | Uses ``fbuild build`` as a subprocess so that Ctrl+C terminates it |
| 299 | immediately (the Rust binary handles SIGINT natively). |
| 300 | |
| 301 | Args: |
| 302 | build_dir: Project directory containing platformio.ini |
| 303 | environment: Build environment (None = auto-detect) |
| 304 | verbose: Enable verbose output |
| 305 | clean: Perform clean build |
| 306 | timeout: Maximum build time in seconds (default: 30 minutes) |
| 307 | quiet: Suppress verbose output (emit single summary line) |
| 308 | log_file: File to redirect verbose output to in quiet mode |
| 309 | |
| 310 | Returns: |
| 311 | Result containing success flag, return code, and captured output |
| 312 | """ |
| 313 | import subprocess |
| 314 | |
| 315 | from running_process import RunningProcess |
| 316 | |
| 317 | if environment is None: |
| 318 | raise ValueError("environment must be specified for fbuild compilation") |
| 319 | |
| 320 | out = _get_output(quiet, log_file) |
| 321 | print("=" * 60, file=out) |
| 322 | print("COMPILING (fbuild)", file=out) |
| 323 | print("=" * 60, file=out) |
| 324 | |
| 325 | fbuild_exe = get_fbuild_executable() |
| 326 | if fbuild_exe is None: |
| 327 | message = "BUILD FAIL fbuild not found on PATH" |
| 328 | print(message, file=out) |
| 329 | return FbuildCommandResult(success=False, output=message) |
| 330 | |
| 331 | cmd: list[str] = [ |
| 332 | fbuild_exe, |
| 333 | str(build_dir), |
| 334 | "build", |
| 335 | "-e", |
| 336 | environment, |
| 337 | ] |
| 338 | if verbose: |
| 339 | cmd.append("-v") |
| 340 | if clean: |
| 341 | cmd.append("-c") |
| 342 | |
| 343 | print(f"Running: {subprocess.list2cmdline(cmd)}", file=out) |
| 344 | print(file=out) |
no test coverage detected