Skip to content

Commit

Permalink
Try clean.cordio on BLE project failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Carter committed Aug 23, 2024
1 parent 3e2bd49 commit f02e028
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,25 @@
console = Console(emoji=False, color_system="standard")

def build_project(project:Path, target, board, maxim_path:Path, distclean=False, extra_args=None) -> Tuple[int, tuple]:
clean_cmd = "make clean" if not distclean else "make distclean"
# NOTE: Disabled Cordio re-builds as of 8/23/2024 now that the library files should
# account for basic changes across projects like trace levels and hard/softfp
# if "Bluetooth" in project.as_posix() or "BLE" in project.as_posix():
# # Clean cordio lib for BLE projects
# clean_cmd += "&& make clean.cordio"
clean_cmd = "make clean" if not distclean else "make distclean"
res = run(clean_cmd, cwd=project, shell=True, capture_output=True, encoding="utf-8")

# Test build
build_cmd = f"make -r -j 8 TARGET={target} MAXIM_PATH={maxim_path.as_posix()} BOARD={board} FORCE_COLOR=1"
if extra_args:
build_cmd += f" {str(extra_args)}"
res = run(build_cmd, cwd=project, shell=True, capture_output=True, encoding="utf-8")

if res.returncode != 0 and ("Bluetooth" in project.as_posix() or "BLE" in project.as_posix()):
# NOTE: Special case is required to handle some Cordio re-builds.
# TODO: Track Cordio options better across library re-builds
console.print(f"[red]BLE project {project} failed.[/red]")
console.print("[yellow]Trying a clean.cordio and rebuild...[/yellow]")
clean_cmd += "&& make clean.cordio"
run(clean_cmd, cwd=project, shell=True, capture_output=True, encoding="utf-8")
res = run(build_cmd, cwd=project, shell=True, capture_output=True, encoding="utf-8")
if res.returncode == 0:
console.print("[green]Pass[/green] after rebuild.")

project_info = {
"target":target,
Expand Down Expand Up @@ -222,6 +228,8 @@ def test(maxim_path : Path = None, targets=None, boards=None, projects=None, cha
# Remove the periphdrivers build directory
console.print("Cleaning PeriphDrivers build directories...")
shutil.rmtree(Path(maxim_path) / "Libraries" / "PeriphDrivers" / "bin", ignore_errors=True)
console.print("Cleaning Cordio build directories...")
shutil.rmtree(Path(maxim_path) / "Libraries" / "Cordio" / "bin", ignore_errors=True)

# Get list of target micros if none is specified
if targets is None:
Expand Down

0 comments on commit f02e028

Please sign in to comment.