Build firmware using fbuild without uploading. Args: project_dir: Path to project directory containing platformio.ini environment: Build environment name (e.g., 'esp32c6') clean_build: Whether to perform a clean build verbose: Enable verbose build output
(
project_dir: Path,
environment: str,
clean_build: bool = False,
verbose: bool = False,
timeout: float = 1800,
)
| 143 | |
| 144 | |
| 145 | def fbuild_build_only( |
| 146 | project_dir: Path, |
| 147 | environment: str, |
| 148 | clean_build: bool = False, |
| 149 | verbose: bool = False, |
| 150 | timeout: float = 1800, |
| 151 | ) -> tuple[bool, str]: |
| 152 | """Build firmware using fbuild without uploading. |
| 153 | |
| 154 | Args: |
| 155 | project_dir: Path to project directory containing platformio.ini |
| 156 | environment: Build environment name (e.g., 'esp32c6') |
| 157 | clean_build: Whether to perform a clean build |
| 158 | verbose: Enable verbose build output |
| 159 | timeout: Maximum wait time in seconds (default: 30 minutes) |
| 160 | |
| 161 | Returns: |
| 162 | Tuple of (success: bool, message: str) |
| 163 | """ |
| 164 | try: |
| 165 | from fbuild import Daemon, connect_daemon |
| 166 | except ImportError as e: |
| 167 | return False, f"fbuild not available: {e}" |
| 168 | |
| 169 | try: |
| 170 | Daemon.ensure_running() |
| 171 | |
| 172 | with connect_daemon(project_dir, environment) as conn: |
| 173 | success: bool = conn.build( |
| 174 | clean=clean_build, |
| 175 | verbose=verbose, |
| 176 | timeout=timeout, |
| 177 | ) |
| 178 | |
| 179 | if success: |
| 180 | return True, "Build completed successfully" |
| 181 | else: |
| 182 | return False, "Build failed" |
| 183 | |
| 184 | except KeyboardInterrupt as ki: |
| 185 | handle_keyboard_interrupt(ki) |
| 186 | raise |
| 187 | except Exception as e: |
| 188 | return False, f"fbuild error: {e}" |
nothing calls this directly
no test coverage detected