Compile examples for a single board using PioCompiler. Args: use_fbuild: If None, uses BOARD_BUILDS_USE_FBUILD (default True). If True, uses fbuild. If False, uses PlatformIO's `pio run`.
(
board: Board,
examples: list[str],
defines: list[str],
verbose: bool,
global_cache_dir: Optional[Path] = None,
merged_bin: bool = False,
merged_bin_output: Optional[Path] = None,
extra_packages: Optional[list[str]] = None,
max_failures: Optional[int] = None,
skip_filters: bool = False,
use_fbuild: Optional[bool] = None,
)
| 39 | |
| 40 | |
| 41 | def compile_board_examples( |
| 42 | board: Board, |
| 43 | examples: list[str], |
| 44 | defines: list[str], |
| 45 | verbose: bool, |
| 46 | global_cache_dir: Optional[Path] = None, |
| 47 | merged_bin: bool = False, |
| 48 | merged_bin_output: Optional[Path] = None, |
| 49 | extra_packages: Optional[list[str]] = None, |
| 50 | max_failures: Optional[int] = None, |
| 51 | skip_filters: bool = False, |
| 52 | use_fbuild: Optional[bool] = None, |
| 53 | ) -> BoardCompilationResult: |
| 54 | """Compile examples for a single board using PioCompiler. |
| 55 | |
| 56 | Args: |
| 57 | use_fbuild: If None, uses BOARD_BUILDS_USE_FBUILD (default True). |
| 58 | If True, uses fbuild. If False, uses PlatformIO's `pio run`. |
| 59 | """ |
| 60 | if use_fbuild is None: |
| 61 | use_fbuild = BOARD_BUILDS_USE_FBUILD |
| 62 | |
| 63 | # Resolve global cache directory immediately for display |
| 64 | resolved_cache_dir = None |
| 65 | if global_cache_dir is not None: |
| 66 | # User specified a path - use it exactly as provided |
| 67 | resolved_cache_dir = global_cache_dir.resolve() |
| 68 | else: |
| 69 | # Default path ends with 'global_cache' |
| 70 | resolved_cache_dir = Path.home() / ".fastled" / "global_cache" |
| 71 | |
| 72 | print(f"\n{'=' * 60}") |
| 73 | print(f"COMPILING BOARD: {board.board_name}") |
| 74 | print(f"EXAMPLES: {', '.join(examples)}") |
| 75 | if merged_bin: |
| 76 | print("MERGED-BIN MODE: Enabled") |
| 77 | if merged_bin_output: |
| 78 | print(f"MERGED-BIN OUTPUT: {merged_bin_output}") |
| 79 | |
| 80 | # Show cache directories in verbose mode only |
| 81 | paths = FastLEDPaths(board.board_name) |
| 82 | if verbose: |
| 83 | print(f"GLOBAL CACHE: {resolved_cache_dir}") |
| 84 | print(f"BUILD CACHE: {paths.build_cache_dir}") |
| 85 | print(f"CORE DIR: {paths.core_dir}") |
| 86 | print(f"PACKAGES DIR: {paths.packages_dir}") |
| 87 | |
| 88 | # Apply filters based on @filter directives (unless skip_filters is True) |
| 89 | if skip_filters: |
| 90 | # User explicitly requested to skip filters (--no-filter flag) |
| 91 | filtered_examples = examples |
| 92 | skipped_examples: list[tuple[str, str]] = [] |
| 93 | else: |
| 94 | # Apply filters to prevent compilation failures |
| 95 | filtered_examples, skipped_examples = get_filtered_examples(board, examples) |
| 96 | |
| 97 | if skipped_examples: |
| 98 | print( |