mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
common: add --force-rebuild option to build scripts
This commit is contained in:
24
common.py
24
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.
|
||||
|
||||
Reference in New Issue
Block a user