MCPcopy Create free account
hub / github.com/FastLED/FastLED / fbuild_build_and_upload

Function fbuild_build_and_upload

ci/util/fbuild_adapter.py:94–142  ·  view source on GitHub ↗

Build and upload firmware using fbuild. This function uses the fbuild DaemonConnection to compile and upload firmware to an embedded device. It does NOT start monitoring - the caller should use the existing run_monitor function for that. Args: project_dir: Path to project d

(
    project_dir: Path,
    environment: str,
    port: str | None = None,
    clean_build: bool = False,
    timeout: float = 1800,
)

Source from the content-addressed store, hash-verified

92
93
94def fbuild_build_and_upload(
95 project_dir: Path,
96 environment: str,
97 port: str | None = None,
98 clean_build: bool = False,
99 timeout: float = 1800,
100) -> tuple[bool, str]:
101 """Build and upload firmware using fbuild.
102
103 This function uses the fbuild DaemonConnection to compile and upload firmware
104 to an embedded device. It does NOT start monitoring - the caller
105 should use the existing run_monitor function for that.
106
107 Args:
108 project_dir: Path to project directory containing platformio.ini
109 environment: Build environment name (e.g., 'esp32c6')
110 port: Serial port for upload (auto-detect if None)
111 clean_build: Whether to perform a clean build
112 timeout: Maximum wait time in seconds (default: 30 minutes)
113
114 Returns:
115 Tuple of (success: bool, message: str)
116 """
117 try:
118 from fbuild import Daemon, connect_daemon
119 except ImportError as e:
120 return False, f"fbuild not available: {e}"
121
122 try:
123 Daemon.ensure_running()
124
125 with connect_daemon(project_dir, environment) as conn:
126 success: bool = conn.deploy(
127 port=port,
128 clean=clean_build,
129 monitor_after=False, # We'll handle monitoring separately via run_monitor
130 timeout=timeout,
131 )
132
133 if success:
134 return True, "Build and upload completed successfully"
135 else:
136 return False, "Build or upload failed"
137
138 except KeyboardInterrupt as ki:
139 handle_keyboard_interrupt(ki)
140 raise
141 except Exception as e:
142 return False, f"fbuild error: {e}"
143
144
145def fbuild_build_only(

Callers

nothing calls this directly

Calls 2

deployMethod · 0.45

Tested by

no test coverage detected