Chromium Code Reviews| 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 81041ef2f9bf6843e0e00dbbc779db05a34ff5c6..4e8f13378500567c0769cc143fb9f88792d1ac61 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__), |
| @@ -400,3 +401,44 @@ def ExpandFileArgs(args): |
| return new_args |
| + |
| +def CallAndRecordIfStale(function, options, record_path=None, input_paths=None, |
|
jbudorick
2015/09/18 18:19:38
curious: why'd you put this in here rather than in
agrieve
2015/09/18 18:46:19
My reasoning:
- md5_check felt a bit like a generi
jbudorick
2015/09/23 14:56:37
I'm concerned about:
- having two identically-nam
|
| + 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| arguemnt. 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: |
|
jbudorick
2015/09/18 18:19:38
I'm not crazy about locking option names across sc
agrieve
2015/09/18 18:46:19
All scripts already use build_utils.AddDepfileOpti
|
| + 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) |
| + |