Skip to content

Commit

Permalink
waf: Detect board class by inheritance instead of naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy Protas authored and peterbarker committed Apr 5, 2024
1 parent e4a2794 commit f5b4d45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Tools/ardupilotwaf/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@ def get_boards_names():

return sorted(list(_board_classes.keys()), key=str.lower)

def is_board_based(board, cls):
return issubclass(_board_classes[board], cls)

def get_ap_periph_boards():
'''Add AP_Periph boards based on existance of periph keywork in hwdef.dat or board name'''
list_ap = [s for s in list(_board_classes.keys()) if "periph" in s]
Expand Down
4 changes: 2 additions & 2 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,9 @@ def generate_tasklist(ctx, do_print=True):
elif 'iofirmware' in board:
task['targets'] = ['iofirmware', 'bootloader']
else:
if 'sitl' in board or 'SITL' in board:
if boards.is_board_based(board, boards.sitl):
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'replay']
elif 'linux' in board:
elif boards.is_board_based(board, boards.linux):
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub']
else:
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'bootloader']
Expand Down

0 comments on commit f5b4d45

Please sign in to comment.