|
20 | 20 | import json
|
21 | 21 | import yaml
|
22 | 22 | import pathlib
|
| 23 | +from concurrent.futures import ThreadPoolExecutor |
23 | 24 |
|
24 | 25 | tools_dir = pathlib.Path(__file__).resolve().parent
|
25 | 26 | top_dir = tools_dir.parent
|
|
28 | 29 | sys.path.insert(0, str(top_dir / "docs"))
|
29 | 30 |
|
30 | 31 | import build_board_info
|
31 |
| -from shared_bindings_matrix import get_settings_from_makefile |
| 32 | +from shared_bindings_matrix import ( |
| 33 | + get_settings_from_makefile, |
| 34 | + SUPPORTED_PORTS, |
| 35 | + all_ports_all_boards, |
| 36 | +) |
32 | 37 |
|
33 | 38 | PORT_TO_ARCH = {
|
34 | 39 | "atmel-samd": "arm",
|
@@ -86,6 +91,20 @@ def set_boards_to_build(build_all):
|
86 | 91 | port_to_boards[port].add(board_id)
|
87 | 92 | board_to_port[board_id] = port
|
88 | 93 |
|
| 94 | + def compute_board_settings(): |
| 95 | + if board_settings: |
| 96 | + return |
| 97 | + |
| 98 | + def get_settings(arg): |
| 99 | + board = arg[1].name |
| 100 | + return ( |
| 101 | + board, |
| 102 | + get_settings_from_makefile(str(top_dir / "ports" / board_to_port[board]), board), |
| 103 | + ) |
| 104 | + |
| 105 | + with ThreadPoolExecutor(max_workers=os.cpu_count()) as ex: |
| 106 | + board_settings.update(ex.map(get_settings, all_ports_all_boards())) |
| 107 | + |
89 | 108 | boards_to_build = all_board_ids
|
90 | 109 |
|
91 | 110 | if not build_all:
|
@@ -123,11 +142,8 @@ def set_boards_to_build(build_all):
|
123 | 142 | # As a (nearly) last resort, for some certain files, we compute the settings from the
|
124 | 143 | # makefile for each board and determine whether to build them that way.
|
125 | 144 | if p.startswith("frozen") or p.startswith("supervisor") or module_matches:
|
| 145 | + compute_board_settings() |
126 | 146 | for board in all_board_ids:
|
127 |
| - if board not in board_settings: |
128 |
| - board_settings[board] = get_settings_from_makefile( |
129 |
| - str(top_dir / "ports" / board_to_port[board]), board |
130 |
| - ) |
131 | 147 | settings = board_settings[board]
|
132 | 148 |
|
133 | 149 | # Check frozen files to see if they are in each board.
|
|
0 commit comments