Add modified time checking to strip_library_for_apk.py
Often this action is triggered and only actually needs to strip few/no native libraries (i.e if only base.so changes there is no need to strip all the other libraries). Add modified time checking to this action. Since the input files are very large, using md5 checking is too slow (i.e. it is not much, if any, faster than just doing the strip). BUG=158821 Review URL: https://chromiumcodereview.appspot.com/13504003 git-svn-id: http://src.chromium.org/svn/trunk/src/build@193003 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
1bccb640d1
Коммит
aa5f147971
|
@ -13,10 +13,12 @@ from util import build_utils
|
|||
|
||||
|
||||
def StripLibrary(android_strip, android_strip_args, library_path, output_path):
|
||||
strip_cmd = ([android_strip] +
|
||||
android_strip_args +
|
||||
['-o', output_path, library_path])
|
||||
build_utils.CheckCallDie(strip_cmd)
|
||||
if build_utils.IsTimeStale(output_path, [library_path]):
|
||||
strip_cmd = ([android_strip] +
|
||||
android_strip_args +
|
||||
['-o', output_path, library_path])
|
||||
build_utils.CheckCallDie(strip_cmd)
|
||||
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
|
|
@ -101,3 +101,19 @@ def CheckCallDie(args, suppress_output=False, cwd=None):
|
|||
print stdout,
|
||||
return stdout
|
||||
|
||||
|
||||
def GetModifiedTime(path):
|
||||
# For a symlink, the modified time should be the greater of the link's
|
||||
# modified time and the modified time of the target.
|
||||
return max(os.lstat(path).st_mtime, os.stat(path).st_mtime)
|
||||
|
||||
|
||||
def IsTimeStale(output, inputs):
|
||||
if not os.path.exists(output):
|
||||
return True
|
||||
|
||||
output_time = GetModifiedTime(output)
|
||||
for input in inputs:
|
||||
if GetModifiedTime(input) > output_time:
|
||||
return True
|
||||
return False
|
||||
|
|
Загрузка…
Ссылка в новой задаче