mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Tools: allow specification of AUTOBUILD_TARGETS in hwdef files
This commit is contained in:
parent
11f7cce978
commit
cb6f9ea6a1
@ -14,6 +14,14 @@ class Board(object):
|
|||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.is_ap_periph = False
|
self.is_ap_periph = False
|
||||||
|
self.autobuild_targets = [
|
||||||
|
'AntennaTracker',
|
||||||
|
'Blimp',
|
||||||
|
'Copter',
|
||||||
|
'Heli',
|
||||||
|
'Plane',
|
||||||
|
'Rover',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class BoardList(object):
|
class BoardList(object):
|
||||||
@ -77,6 +85,13 @@ class BoardList(object):
|
|||||||
if re.match(r"^\s*env AP_PERIPH_HEAVY 1", line):
|
if re.match(r"^\s*env AP_PERIPH_HEAVY 1", line):
|
||||||
board.is_ap_periph = 1
|
board.is_ap_periph = 1
|
||||||
|
|
||||||
|
# a hwdef can specify which vehicles this target is valid for:
|
||||||
|
match = re.match(r"AUTOBUILD_TARGETS\s*(.*)", line)
|
||||||
|
if match is not None:
|
||||||
|
board.autobuild_targets = [
|
||||||
|
x.rstrip().lstrip().lower() for x in match.group(1).split(",")
|
||||||
|
]
|
||||||
|
|
||||||
def read_hwdef(self, filepath):
|
def read_hwdef(self, filepath):
|
||||||
fh = open(filepath)
|
fh = open(filepath)
|
||||||
ret = []
|
ret = []
|
||||||
@ -89,7 +104,7 @@ class BoardList(object):
|
|||||||
ret += [line]
|
ret += [line]
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def find_autobuild_boards(self):
|
def find_autobuild_boards(self, build_target=None):
|
||||||
ret = []
|
ret = []
|
||||||
for board in self.boards:
|
for board in self.boards:
|
||||||
if board.is_ap_periph:
|
if board.is_ap_periph:
|
||||||
@ -136,7 +151,20 @@ class BoardList(object):
|
|||||||
|
|
||||||
ret = filter(lambda x : x not in blacklist, ret)
|
ret = filter(lambda x : x not in blacklist, ret)
|
||||||
|
|
||||||
return list(ret)
|
# if the caller has supplied a vehicle to limit to then we do that here:
|
||||||
|
if build_target is not None:
|
||||||
|
# Slow down: n^2 algorithm ahead
|
||||||
|
newret = []
|
||||||
|
for x in ret:
|
||||||
|
for b in self.boards:
|
||||||
|
if b.name.lower() != x.lower():
|
||||||
|
continue
|
||||||
|
if build_target.lower() not in [y.lower() for y in b.autobuild_targets]:
|
||||||
|
continue
|
||||||
|
newret.append(x)
|
||||||
|
ret = newret
|
||||||
|
|
||||||
|
return sorted(list(ret))
|
||||||
|
|
||||||
def find_ap_periph_boards(self):
|
def find_ap_periph_boards(self):
|
||||||
blacklist = [
|
blacklist = [
|
||||||
@ -159,7 +187,7 @@ class BoardList(object):
|
|||||||
if x.name in blacklist:
|
if x.name in blacklist:
|
||||||
continue
|
continue
|
||||||
ret.append(x.name)
|
ret.append(x.name)
|
||||||
return list(ret)
|
return sorted(list(ret))
|
||||||
|
|
||||||
|
|
||||||
AUTOBUILD_BOARDS = BoardList().find_autobuild_boards()
|
AUTOBUILD_BOARDS = BoardList().find_autobuild_boards()
|
||||||
|
@ -27,7 +27,8 @@ import generate_manifest
|
|||||||
import gen_stable
|
import gen_stable
|
||||||
import build_binaries_history
|
import build_binaries_history
|
||||||
|
|
||||||
from board_list import AUTOBUILD_BOARDS, AP_PERIPH_BOARDS
|
import board_list
|
||||||
|
from board_list import AP_PERIPH_BOARDS
|
||||||
|
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
running_python3 = False
|
running_python3 = False
|
||||||
@ -67,6 +68,7 @@ class build_binaries(object):
|
|||||||
def __init__(self, tags):
|
def __init__(self, tags):
|
||||||
self.tags = tags
|
self.tags = tags
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
|
self.board_list = board_list.BoardList()
|
||||||
|
|
||||||
def progress(self, string):
|
def progress(self, string):
|
||||||
'''pretty-print progress'''
|
'''pretty-print progress'''
|
||||||
@ -535,18 +537,15 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
self.progress("Exception caught: %s" %
|
self.progress("Exception caught: %s" %
|
||||||
self.get_exception_stacktrace(e))
|
self.get_exception_stacktrace(e))
|
||||||
|
|
||||||
def common_boards(self):
|
|
||||||
'''returns list of boards common to all vehicles'''
|
|
||||||
return AUTOBUILD_BOARDS
|
|
||||||
|
|
||||||
def AP_Periph_boards(self):
|
def AP_Periph_boards(self):
|
||||||
return AP_PERIPH_BOARDS
|
return AP_PERIPH_BOARDS
|
||||||
|
|
||||||
def build_arducopter(self, tag):
|
def build_arducopter(self, tag):
|
||||||
'''build Copter binaries'''
|
'''build Copter binaries'''
|
||||||
|
|
||||||
boards = []
|
boards = []
|
||||||
boards.extend(["skyviper-v2450", "aerofc-v1", "bebop", "CubeSolo", "CubeGreen-solo", "skyviper-journey"])
|
boards.extend(["aerofc-v1", "bebop"])
|
||||||
boards.extend(self.common_boards()[:])
|
boards.extend(self.board_list.find_autobuild_boards('Copter'))
|
||||||
self.build_vehicle(tag,
|
self.build_vehicle(tag,
|
||||||
"ArduCopter",
|
"ArduCopter",
|
||||||
boards,
|
boards,
|
||||||
@ -556,7 +555,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
|
|
||||||
def build_arduplane(self, tag):
|
def build_arduplane(self, tag):
|
||||||
'''build Plane binaries'''
|
'''build Plane binaries'''
|
||||||
boards = self.common_boards()[:]
|
boards = self.board_list.find_autobuild_boards('Plane')[:]
|
||||||
boards.append("disco")
|
boards.append("disco")
|
||||||
self.build_vehicle(tag,
|
self.build_vehicle(tag,
|
||||||
"ArduPlane",
|
"ArduPlane",
|
||||||
@ -566,19 +565,17 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
|
|
||||||
def build_antennatracker(self, tag):
|
def build_antennatracker(self, tag):
|
||||||
'''build Tracker binaries'''
|
'''build Tracker binaries'''
|
||||||
boards = self.common_boards()[:]
|
|
||||||
self.build_vehicle(tag,
|
self.build_vehicle(tag,
|
||||||
"AntennaTracker",
|
"AntennaTracker",
|
||||||
boards,
|
self.board_list.find_autobuild_boards('Tracker')[:],
|
||||||
"AntennaTracker",
|
"AntennaTracker",
|
||||||
"antennatracker")
|
"antennatracker")
|
||||||
|
|
||||||
def build_rover(self, tag):
|
def build_rover(self, tag):
|
||||||
'''build Rover binaries'''
|
'''build Rover binaries'''
|
||||||
boards = self.common_boards()
|
|
||||||
self.build_vehicle(tag,
|
self.build_vehicle(tag,
|
||||||
"Rover",
|
"Rover",
|
||||||
boards,
|
self.board_list.find_autobuild_boards('Rover')[:],
|
||||||
"Rover",
|
"Rover",
|
||||||
"ardurover")
|
"ardurover")
|
||||||
|
|
||||||
@ -586,7 +583,7 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
'''build Sub binaries'''
|
'''build Sub binaries'''
|
||||||
self.build_vehicle(tag,
|
self.build_vehicle(tag,
|
||||||
"ArduSub",
|
"ArduSub",
|
||||||
self.common_boards(),
|
self.board_list.find_autobuild_boards('Sub')[:],
|
||||||
"Sub",
|
"Sub",
|
||||||
"ardusub")
|
"ardusub")
|
||||||
|
|
||||||
@ -601,10 +598,9 @@ is bob we will attempt to checkout bob-AVR'''
|
|||||||
|
|
||||||
def build_blimp(self, tag):
|
def build_blimp(self, tag):
|
||||||
'''build Blimp binaries'''
|
'''build Blimp binaries'''
|
||||||
boards = self.common_boards()
|
|
||||||
self.build_vehicle(tag,
|
self.build_vehicle(tag,
|
||||||
"Blimp",
|
"Blimp",
|
||||||
boards,
|
self.board_list.find_autobuild_boards('Blimp')[:],
|
||||||
"Blimp",
|
"Blimp",
|
||||||
"blimp")
|
"blimp")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user