(version, platform, skip_build)
| 372 | # The problem is that the "idf.py build" always results in an error, even though the elf file is created. |
| 373 | # The solution is to suppress the error if we find that the elf file was created. |
| 374 | def build_first(version, platform, skip_build): |
| 375 | sdk_dir = get_sdk_dir(version, platform) |
| 376 | if verbose: |
| 377 | print(f"Using SDK at {sdk_dir}") |
| 378 | os.environ["TACTILITY_SDK_PATH"] = sdk_dir |
| 379 | sdkconfig_path = os.path.join(ttbuild_path, f"sdkconfig.app.{platform}") |
| 380 | shutil.copy(sdkconfig_path, "sdkconfig") |
| 381 | elf_path = find_elf_file(platform) |
| 382 | # Remove previous elf file: re-creation of the file is used to measure if the build succeeded, |
| 383 | # as the actual build job will always fail due to technical issues with the elf cmake script |
| 384 | if elf_path is not None: |
| 385 | os.remove(elf_path) |
| 386 | if skip_build: |
| 387 | return True |
| 388 | print(f"Building first {platform} build") |
| 389 | cmake_path = get_cmake_path(platform) |
| 390 | print_status_busy(f"Building {platform} ELF") |
| 391 | shell_needed = sys.platform == "win32" |
| 392 | build_command = ["idf.py", "-B", cmake_path, "build"] |
| 393 | if verbose: |
| 394 | print(f"Running command: {' '.join(build_command)}") |
| 395 | with subprocess.Popen(build_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=shell_needed) as process: |
| 396 | build_output = wait_for_process(process) |
| 397 | # The return code is never expected to be 0 due to a bug in the elf cmake script, but we keep it just in case |
| 398 | if process.returncode == 0: |
| 399 | print(f"{shell_color_green}Building for {platform} ✅{shell_color_reset}") |
| 400 | return True |
| 401 | else: |
| 402 | if find_elf_file(platform) is None: |
| 403 | for line in build_output: |
| 404 | print(line, end="") |
| 405 | print_status_error(f"Building {platform} ELF") |
| 406 | return False |
| 407 | else: |
| 408 | print_status_success(f"Building {platform} ELF") |
| 409 | return True |
| 410 | |
| 411 | def build_consecutively(version, platform, skip_build): |
| 412 | sdk_dir = get_sdk_dir(version, platform) |
no test coverage detected