Tools: add waf argument to get consistent builds

This commit is contained in:
Peter Barker 2023-02-15 22:20:52 +11:00 committed by Peter Barker
parent ddf62cc060
commit debb5c24b3
2 changed files with 20 additions and 0 deletions

View File

@ -456,6 +456,16 @@ class Board:
if cfg.options.ekf_single: if cfg.options.ekf_single:
env.CXXFLAGS += ['-DHAL_WITH_EKF_DOUBLE=0'] env.CXXFLAGS += ['-DHAL_WITH_EKF_DOUBLE=0']
if cfg.options.consistent_builds:
# squash all line numbers to be the number 17
env.CXXFLAGS += [
"-D__AP_LINE__=17",
]
else:
env.CXXFLAGS += [
"-D__AP_LINE__=__LINE__",
]
# add files from ROMFS_custom # add files from ROMFS_custom
custom_dir = 'ROMFS_custom' custom_dir = 'ROMFS_custom'
if os.path.exists(custom_dir): if os.path.exists(custom_dir):

View File

@ -56,6 +56,7 @@ class SizeCompareBranches(object):
all_vehicles=False, all_vehicles=False,
all_boards=False, all_boards=False,
use_merge_base=True, use_merge_base=True,
waf_consistent_builds=True,
extra_hwdef=[], extra_hwdef=[],
extra_hwdef_branch=[], extra_hwdef_branch=[],
extra_hwdef_master=[]): extra_hwdef_master=[]):
@ -74,6 +75,7 @@ class SizeCompareBranches(object):
self.all_vehicles = all_vehicles self.all_vehicles = all_vehicles
self.all_boards = all_boards self.all_boards = all_boards
self.use_merge_base = use_merge_base self.use_merge_base = use_merge_base
self.waf_consistent_builds = waf_consistent_builds
if self.bin_dir is None: if self.bin_dir is None:
self.bin_dir = self.find_bin_dir() self.bin_dir = self.find_bin_dir()
@ -220,6 +222,8 @@ class SizeCompareBranches(object):
self.run_git(["submodule", "update", "--recursive"]) self.run_git(["submodule", "update", "--recursive"])
shutil.rmtree("build", ignore_errors=True) shutil.rmtree("build", ignore_errors=True)
waf_configure_args = ["configure", "--board", board] waf_configure_args = ["configure", "--board", board]
if self.waf_consistent_builds:
waf_configure_args.append("--consistent-builds")
if extra_hwdef is not None: if extra_hwdef is not None:
waf_configure_args.extend(["--extra-hwdef", extra_hwdef]) waf_configure_args.extend(["--extra-hwdef", extra_hwdef])
@ -425,6 +429,11 @@ if __name__ == '__main__':
action="store_true", action="store_true",
default=False, default=False,
help="do not use the merge-base for testing, do a direct comparison between branches") help="do not use the merge-base for testing, do a direct comparison between branches")
parser.add_option("",
"--no-waf-consistent-builds",
action="store_true",
default=False,
help="do not use the --consistent-builds waf command-line option (for older branches)")
parser.add_option("", parser.add_option("",
"--branch", "--branch",
type="string", type="string",
@ -491,5 +500,6 @@ if __name__ == '__main__':
all_vehicles=cmd_opts.all_vehicles, all_vehicles=cmd_opts.all_vehicles,
all_boards=cmd_opts.all_boards, all_boards=cmd_opts.all_boards,
use_merge_base=not cmd_opts.no_merge_base, use_merge_base=not cmd_opts.no_merge_base,
waf_consistent_builds=not cmd_opts.no_waf_consistent_builds,
) )
x.run() x.run()