diff options
author | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 05:31:24 +0000 |
---|---|---|
committer | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 05:31:24 +0000 |
commit | a45bdf098663951021653a3c7b483b8e713b3da6 (patch) | |
tree | 8228fc9637fb6d30a4c67e58932c0d68003a07a5 /build | |
parent | 147938bf063cdc44cdffd3481182d81e820c6a88 (diff) | |
download | chromium_src-a45bdf098663951021653a3c7b483b8e713b3da6.zip chromium_src-a45bdf098663951021653a3c7b483b8e713b3da6.tar.gz chromium_src-a45bdf098663951021653a3c7b483b8e713b3da6.tar.bz2 |
[Android] Only write the ordered libraries file when it changes
This action is triggered whenever the top-level library is re-linked. This file
being touched then triggers generating a Java file, and then
rebuilding/installing the APK. This is all unnecessary.
Instead, only write this file if the output has changed. Then, since the ninja
generator uses restat=1, dependent actions will only be retriggered when this
actual changes (almost never).
BUG=158821
Review URL: https://chromiumcodereview.appspot.com/13891010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/android/gyp/util/build_utils.py | 11 | ||||
-rwxr-xr-x | build/android/gyp/write_ordered_libraries.py | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py index 1fac120..b8b9462 100644 --- a/build/android/gyp/util/build_utils.py +++ b/build/android/gyp/util/build_utils.py @@ -61,6 +61,17 @@ def CheckOptions(options, parser, required=[]): if not getattr(options, option_name): parser.error('--%s is required' % option_name.replace('_', '-')) +def WriteJson(obj, path, only_if_changed=False): + old_dump = None + if os.path.exists(path): + with open(path, 'r') as oldfile: + old_dump = oldfile.read() + + new_dump = json.dumps(obj) + + if not only_if_changed or old_dump != new_dump: + with open(path, 'w') as outfile: + outfile.write(new_dump) def ReadJson(path): with open(path, 'r') as jsonfile: diff --git a/build/android/gyp/write_ordered_libraries.py b/build/android/gyp/write_ordered_libraries.py index 338090f..dfa7d20 100755 --- a/build/android/gyp/write_ordered_libraries.py +++ b/build/android/gyp/write_ordered_libraries.py @@ -107,8 +107,7 @@ def main(argv): libraries = GetSortedTransitiveDependencies(libraries) - with open(_options.output, 'w') as outfile: - json.dump(libraries, outfile) + build_utils.WriteJson(libraries, _options.output, only_if_changed=True) if _options.stamp: build_utils.Touch(_options.stamp) |