()
| 15 | |
| 16 | |
| 17 | def main(): |
| 18 | parser = argparse.ArgumentParser( |
| 19 | description="Run symbol analysis for any platform with GitHub Actions support" |
| 20 | ) |
| 21 | parser.add_argument("--board", required=True, help="Board name being analyzed") |
| 22 | parser.add_argument("--example", default="Blink", help="Example that was compiled") |
| 23 | parser.add_argument( |
| 24 | "--skip-on-failure", |
| 25 | action="store_true", |
| 26 | help="Don't fail the build if symbol analysis fails", |
| 27 | ) |
| 28 | args = parser.parse_args() |
| 29 | |
| 30 | print(f"Symbol Analysis Runner - Board: {args.board}, Example: {args.example}") |
| 31 | |
| 32 | # Build list of all paths to check (in priority order) |
| 33 | build_info_filename = f"build_info_{args.example}.json" |
| 34 | paths_to_check = [ |
| 35 | Path(".build") / args.board / build_info_filename, |
| 36 | Path(".build") / "pio" / args.board / build_info_filename, |
| 37 | Path(".build") / args.board / "build_info.json", |
| 38 | Path(".build") / "pio" / args.board / "build_info.json", |
| 39 | ] |
| 40 | |
| 41 | # Find first existing path |
| 42 | build_info_path = None |
| 43 | for path in paths_to_check: |
| 44 | if path.exists(): |
| 45 | build_info_path = path |
| 46 | break |
| 47 | |
| 48 | if build_info_path is None: |
| 49 | # Show all paths that were checked |
| 50 | checked_paths = "\n - ".join(str(p) for p in paths_to_check) |
| 51 | message = ( |
| 52 | f"Build info not found. Checked the following paths:\n - {checked_paths}\n" |
| 53 | f"This may indicate the compilation did not complete successfully. " |
| 54 | f"Check the compilation logs for warnings about build_info generation." |
| 55 | ) |
| 56 | if args.skip_on_failure: |
| 57 | print(f"Warning: {message}") |
| 58 | return 0 |
| 59 | else: |
| 60 | print(f"Error: {message}") |
| 61 | return 1 |
| 62 | |
| 63 | try: |
| 64 | # Import and run the generic symbol analysis |
| 65 | print("Running symbol analysis...") |
| 66 | |
| 67 | # Override sys.argv to pass the board and example arguments to the symbol analysis script |
| 68 | original_argv = sys.argv |
| 69 | sys.argv = [ |
| 70 | "symbol_analysis.py", |
| 71 | "--board", |
| 72 | args.board, |
| 73 | "--example", |
| 74 | args.example, |
no test coverage detected