Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: build/android/gyp/util/build_utils.py

Issue 1356873003: CallAndRecordIfStale(): Add knownledge of output_files, depfiles, stamp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@incremental-script-dep
Patch Set: add assert and remove map() Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/gyp/proguard.py ('k') | build/android/gyp/util/md5_check.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/util/build_utils.py
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
index e8729ec8f720829bd8393061620e0b5baef31ed7..f95053f7d26c998fac868d43361cf91d760647a8 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -16,6 +16,7 @@ import sys
import tempfile
import zipfile
+from util import md5_check
CHROMIUM_SRC = os.path.normpath(
os.path.join(os.path.dirname(__file__),
@@ -399,3 +400,45 @@ def ExpandFileArgs(args):
return new_args
+
+def CallAndWriteDepfileIfStale(function, options, record_path=None,
+ input_paths=None, input_strings=None,
+ output_paths=None, force=False):
+ """Wraps md5_check.CallAndRecordIfStale() and also writes dep & stamp files.
+
+ Depfiles and stamp files are automatically added to output_paths when present
+ in the |options| argument. They are then created after |function| is called.
+ """
+ if not output_paths:
+ raise Exception('At least one output_path must be specified.')
+ input_paths = list(input_paths or [])
+ input_strings = list(input_strings or [])
+ output_paths = list(output_paths or [])
+
+ python_deps = None
+ if hasattr(options, 'depfile') and options.depfile:
+ python_deps = GetPythonDependencies()
+ # List python deps in input_strings rather than input_paths since the
+ # contents of them does not change what gets written to the depfile.
+ input_strings += python_deps
+ output_paths += [options.depfile]
+
+ stamp_file = hasattr(options, 'stamp') and options.stamp
+ if stamp_file:
+ output_paths += [stamp_file]
+
+ def on_stale_md5():
+ function()
+ if python_deps is not None:
+ WriteDepfile(options.depfile, python_deps + input_paths)
+ if stamp_file:
+ Touch(stamp_file)
+
+ md5_check.CallAndRecordIfStale(
+ on_stale_md5,
+ record_path=record_path,
+ input_paths=input_paths,
+ input_strings=input_strings,
+ output_paths=output_paths,
+ force=force)
+
« no previous file with comments | « build/android/gyp/proguard.py ('k') | build/android/gyp/util/md5_check.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698