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

Function run_compile

ci/debug_attached.py:167–247  ·  view source on GitHub ↗

Compile the PlatformIO project. On Windows Git Bash: Runs via cmd.exe with clean environment (no Git Bash indicators) On other platforms: Runs directly with UTF-8 environment Args: build_dir: Project directory containing platformio.ini environment: PlatformIO environmen

(
    build_dir: Path,
    environment: str | None = None,
    verbose: bool = False,
    clean: bool = False,
)

Source from the content-addressed store, hash-verified

165
166
167def run_compile(
168 build_dir: Path,
169 environment: str | None = None,
170 verbose: bool = False,
171 clean: bool = False,
172) -> bool:
173 """Compile the PlatformIO project.
174
175 On Windows Git Bash: Runs via cmd.exe with clean environment (no Git Bash indicators)
176 On other platforms: Runs directly with UTF-8 environment
177
178 Args:
179 build_dir: Project directory containing platformio.ini
180 environment: PlatformIO environment to build (None = default)
181 verbose: Enable verbose output
182 clean: Clean build artifacts before compiling
183
184 Returns:
185 True if compilation succeeded, False otherwise
186 """
187 if clean:
188 clean_cmd = ["pio", "run", "--target", "clean", "--project-dir", str(build_dir)]
189 if environment:
190 clean_cmd.extend(["--environment", environment])
191 print("🧹 Cleaning build artifacts...")
192 subprocess.run(clean_cmd, capture_output=True)
193
194 cmd = ["pio", "run", "--project-dir", str(build_dir)]
195 if environment:
196 cmd.extend(["--environment", environment])
197 if verbose:
198 cmd.append("--verbose")
199
200 print("=" * 60)
201 print("COMPILING")
202 print("=" * 60)
203
204 # Log which sketch is being compiled (from PLATFORMIO_SRC_DIR env var)
205 src_dir = os.environ.get("PLATFORMIO_SRC_DIR")
206 if src_dir:
207 # Convert to relative path for cleaner output
208 try:
209 rel_path = Path(src_dir).relative_to(build_dir)
210 print(f"📁 Source: {rel_path}")
211 except ValueError:
212 # Not relative to build_dir, show absolute path
213 print(f"📁 Source: {src_dir}")
214 else:
215 print("📁 Source: (using platformio.ini default)")
216 print()
217
218 formatter = TimestampFormatter()
219 # Use create_pio_process() for Git Bash compatibility
220 proc = create_pio_process(
221 cmd,
222 cwd=build_dir,
223 output_formatter=formatter,
224 auto_run=True,

Callers 1

deployMethod · 0.90

Calls 9

TimestampFormatterClass · 0.90
create_pio_processFunction · 0.90
terminateMethod · 0.80
printFunction · 0.50
runMethod · 0.45
appendMethod · 0.45
getMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected