From debb5c24b393071d36c8aea7b1387fcd4ed7d3ef Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 15 Feb 2023 22:20:52 +1100 Subject: [PATCH] Tools: add waf argument to get consistent builds --- Tools/ardupilotwaf/boards.py | 10 ++++++++++ Tools/scripts/size_compare_branches.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index d03ff8cf4b..bf82397912 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -456,6 +456,16 @@ class Board: if cfg.options.ekf_single: 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 custom_dir = 'ROMFS_custom' if os.path.exists(custom_dir): diff --git a/Tools/scripts/size_compare_branches.py b/Tools/scripts/size_compare_branches.py index 5d9328cf03..90cc8d9e10 100755 --- a/Tools/scripts/size_compare_branches.py +++ b/Tools/scripts/size_compare_branches.py @@ -56,6 +56,7 @@ class SizeCompareBranches(object): all_vehicles=False, all_boards=False, use_merge_base=True, + waf_consistent_builds=True, extra_hwdef=[], extra_hwdef_branch=[], extra_hwdef_master=[]): @@ -74,6 +75,7 @@ class SizeCompareBranches(object): self.all_vehicles = all_vehicles self.all_boards = all_boards self.use_merge_base = use_merge_base + self.waf_consistent_builds = waf_consistent_builds if self.bin_dir is None: self.bin_dir = self.find_bin_dir() @@ -220,6 +222,8 @@ class SizeCompareBranches(object): self.run_git(["submodule", "update", "--recursive"]) shutil.rmtree("build", ignore_errors=True) waf_configure_args = ["configure", "--board", board] + if self.waf_consistent_builds: + waf_configure_args.append("--consistent-builds") if extra_hwdef is not None: waf_configure_args.extend(["--extra-hwdef", extra_hwdef]) @@ -425,6 +429,11 @@ if __name__ == '__main__': action="store_true", default=False, 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("", "--branch", type="string", @@ -491,5 +500,6 @@ if __name__ == '__main__': all_vehicles=cmd_opts.all_vehicles, all_boards=cmd_opts.all_boards, use_merge_base=not cmd_opts.no_merge_base, + waf_consistent_builds=not cmd_opts.no_waf_consistent_builds, ) x.run()