Potentially compute settings of fewer boards

.. when the file is within ports, just get the settings for boards
within the port
This commit is contained in:
Jeff Epler 2022-10-14 11:19:54 -05:00
parent ad130e87f0
commit 3b600ac9b3
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

19
tools/ci_set_matrix.py Normal file → Executable file
View File

@ -91,19 +91,19 @@ def set_boards_to_build(build_all):
port_to_boards[port].add(board_id) port_to_boards[port].add(board_id)
board_to_port[board_id] = port board_to_port[board_id] = port
def compute_board_settings(): def compute_board_settings(boards):
if board_settings: need = set(boards) - set(board_settings.keys())
if not need:
return return
def get_settings(arg): def get_settings(board):
board = arg[1].name
return ( return (
board, board,
get_settings_from_makefile(str(top_dir / "ports" / board_to_port[board]), board), get_settings_from_makefile(str(top_dir / "ports" / board_to_port[board]), board),
) )
with ThreadPoolExecutor(max_workers=os.cpu_count()) as ex: with ThreadPoolExecutor(max_workers=os.cpu_count()) as ex:
board_settings.update(ex.map(get_settings, all_ports_all_boards())) board_settings.update(ex.map(get_settings, need))
boards_to_build = all_board_ids boards_to_build = all_board_ids
@ -142,8 +142,13 @@ def set_boards_to_build(build_all):
# As a (nearly) last resort, for some certain files, we compute the settings from the # As a (nearly) last resort, for some certain files, we compute the settings from the
# makefile for each board and determine whether to build them that way. # makefile for each board and determine whether to build them that way.
if p.startswith("frozen") or p.startswith("supervisor") or module_matches: if p.startswith("frozen") or p.startswith("supervisor") or module_matches:
compute_board_settings() if port_matches:
for board in all_board_ids: port = port_matches.group(1)
board_ids = port_to_boards[port]
else:
board_ids = all_board_ids
compute_board_settings(board_ids)
for board in board_ids:
settings = board_settings[board] settings = board_settings[board]
# Check frozen files to see if they are in each board. # Check frozen files to see if they are in each board.