Analyze platform build information from build_info.json files.
(
arguments: dict[str, Any], project_root: Path
)
| 1736 | |
| 1737 | |
| 1738 | async def build_info_analysis( |
| 1739 | arguments: dict[str, Any], project_root: Path |
| 1740 | ) -> CallToolResult: |
| 1741 | """Analyze platform build information from build_info.json files.""" |
| 1742 | board = arguments.get("board", "list") |
| 1743 | show_defines = arguments.get("show_defines", True) |
| 1744 | show_compiler = arguments.get("show_compiler", False) |
| 1745 | show_toolchain = arguments.get("show_toolchain", False) |
| 1746 | show_all = arguments.get("show_all", False) |
| 1747 | compare_with = arguments.get("compare_with") |
| 1748 | output_json = arguments.get("output_json", False) |
| 1749 | |
| 1750 | # Import our build info analyzer |
| 1751 | |
| 1752 | analyzer = BuildInfoAnalyzer(str(project_root / ".build")) |
| 1753 | |
| 1754 | # Handle board listing |
| 1755 | if board == "list" or not board: |
| 1756 | boards = analyzer.list_available_boards() |
| 1757 | if not boards: |
| 1758 | result_text = ( |
| 1759 | "[ERROR] No boards with build_info.json found in .build directory\n" |
| 1760 | ) |
| 1761 | result_text += " Try running a compilation first:\n" |
| 1762 | result_text += " uv run python -m ci.ci-compile uno --examples Blink\n" |
| 1763 | result_text += ( |
| 1764 | " uv run python -m ci.ci-compile esp32dev --examples Blink\n" |
| 1765 | ) |
| 1766 | return CallToolResult(content=[TextContent(type="text", text=result_text)]) |
| 1767 | |
| 1768 | result_text = f"📋 Available boards with build_info.json ({len(boards)}):\n" |
| 1769 | for board_name in boards: |
| 1770 | result_text += f" [OK] {board_name}\n" |
| 1771 | result_text += "\nUsage: Use 'board' parameter with any of these names to analyze platform information.\n" |
| 1772 | result_text += "Example: board='uno', show_defines=True\n" |
| 1773 | |
| 1774 | return CallToolResult(content=[TextContent(type="text", text=result_text)]) |
| 1775 | |
| 1776 | # Handle board comparison |
| 1777 | if compare_with: |
| 1778 | compare_result = analyzer.compare_defines(board, compare_with) |
| 1779 | if not compare_result.ok: |
| 1780 | return CallToolResult( |
| 1781 | content=[ |
| 1782 | TextContent( |
| 1783 | type="text", text=f"[ERROR] Error: {compare_result.error}" |
| 1784 | ) |
| 1785 | ], |
| 1786 | isError=True, |
| 1787 | ) |
| 1788 | |
| 1789 | if output_json: |
| 1790 | import json |
| 1791 | |
| 1792 | result_text = json.dumps(compare_result.comparison, indent=2) |
| 1793 | else: |
| 1794 | comparison = compare_result.comparison |
| 1795 | board1 = comparison["board1"] |
no test coverage detected