From bb28e260c58c7c5408baf0e1e7eb574974cde654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Wed, 13 Mar 2019 00:00:00 +0000 Subject: [PATCH] common: add --force-rebuild option to build scripts --- common.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/common.py b/common.py index dbd3173..ffb4507 100644 --- a/common.py +++ b/common.py @@ -1042,15 +1042,6 @@ lunch aosp_{}-eng os.makedirs(self.env['p9_dir'], exist_ok=True) os.makedirs(self.env['qemu_run_dir'], exist_ok=True) - @staticmethod - def need_rebuild(srcs, dst): - if not os.path.exists(dst): - return True - for src in srcs: - if os.path.getmtime(src) > os.path.getmtime(dst): - return True - return False - @staticmethod def seconds_to_hms(seconds): ''' @@ -1175,6 +1166,11 @@ class BuildCliFunction(LkmcCliFunction): default=False, help='Clean the build instead of building.', ), + self.add_argument( + '--force-rebuild', + default=False, + help="Force rebuild even if sources didn't chage", + ) self.add_argument( '-j', '--nproc', @@ -1198,6 +1194,16 @@ class BuildCliFunction(LkmcCliFunction): def get_build_dir(self): return None + def need_rebuild(self, srcs, dst): + if self.env['force_rebuild']: + return True + if not os.path.exists(dst): + return True + for src in srcs: + if os.path.getmtime(src) > os.path.getmtime(dst): + return True + return False + def timed_main(self): ''' Parse CLI, and to the build based on it.