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.