Reland "Move build_utils.CallAndWriteDepfileIfStale -> md5_utils"

This reverts commit afa5effef1cca146d06d8791b9a57e4930100760.

Reason for reland: Removed downstream usage.

It's not commonly used, and this allow build_utils to not import
md5_check (removing it from many pydeps files).

Original change's description:
> Revert "Move build_utils.CallAndWriteDepfileIfStale -> md5_utils"
> 
> This reverts commit e155679938272b9394edf1240ccf1ace3108fcf7.
> 
> Reason for revert: Broke downstream bots

TBR=wnwen@chromium.org,agrieve@chromium.org,bsazonov@chromium.org

Change-Id: Ic3cc21fea8e41e5a00bdbf50dcc334fcff3d0750
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1965477
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#724323}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 599596de69beda3196ed32dd960f55e62a2bdf43
This commit is contained in:
Andrew Grieve 2019-12-12 20:47:03 +00:00 коммит произвёл Commit Bot
Родитель 62ed6f7e4e
Коммит cdbb36ae7e
37 изменённых файлов: 57 добавлений и 89 удалений

Просмотреть файл

@ -4,4 +4,3 @@
aidl.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
allot_native_libraries.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -5,5 +5,4 @@ apkbuilder.py
finalize_apk.py
util/__init__.py
util/build_utils.py
util/md5_check.py
util/zipalign.py

Просмотреть файл

@ -4,4 +4,3 @@
assert_static_initializers.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
bytecode_processor.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -27,5 +27,4 @@ util/__init__.py
util/build_utils.py
util/diff_utils.py
util/manifest_utils.py
util/md5_check.py
util/resource_utils.py

Просмотреть файл

@ -4,4 +4,3 @@
copy_ex.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -26,5 +26,4 @@ bundletool.py
create_app_bundle.py
util/__init__.py
util/build_utils.py
util/md5_check.py
util/resource_utils.py

Просмотреть файл

@ -4,4 +4,3 @@
create_java_binary_script.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
desugar.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -14,6 +14,7 @@ import tempfile
import zipfile
from util import build_utils
from util import md5_check
from util import zipalign
sys.path.insert(1, os.path.join(os.path.dirname(__file__), os.path.pardir))
@ -423,7 +424,7 @@ def main(args):
if options.min_api:
dex_cmd += ['--min-api', options.min_api]
build_utils.CallAndWriteDepfileIfStale(
md5_check.CallAndWriteDepfileIfStale(
lambda changes: _OnStaleMd5(changes, options, final_dex_inputs, dex_cmd),
options,
depfile_deps=options.class_inputs_filearg + options.dex_inputs_filearg,

Просмотреть файл

@ -4,4 +4,3 @@
dexsplitter.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -5,4 +5,3 @@ dist_aar.py
filter_zip.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
filter_zip.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
gcc_preprocess.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
generate_linker_version_script.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
ijar.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -4,4 +4,3 @@
jacoco_instr.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -5,4 +5,3 @@ java_cpp_enum.py
util/__init__.py
util/build_utils.py
util/java_cpp_utils.py
util/md5_check.py

Просмотреть файл

@ -5,4 +5,3 @@ java_cpp_strings.py
util/__init__.py
util/build_utils.py
util/java_cpp_utils.py
util/md5_check.py

Просмотреть файл

@ -598,7 +598,7 @@ def main(argv):
input_strings = javac_cmd + options.classpath + java_files
if options.jar_info_exclude_globs:
input_strings.append(options.jar_info_exclude_globs)
build_utils.CallAndWriteDepfileIfStale(
md5_check.CallAndWriteDepfileIfStale(
lambda: _OnStaleMd5(options, javac_cmd, java_files, options.classpath),
options,
depfile_deps=depfile_deps,

Просмотреть файл

@ -37,5 +37,4 @@
jinja_template.py
util/__init__.py
util/build_utils.py
util/md5_check.py
util/resource_utils.py

Просмотреть файл

@ -19,6 +19,7 @@ from xml.etree import ElementTree
from util import build_utils
from util import manifest_utils
from util import md5_check
_LINT_MD_URL = 'https://chromium.googlesource.com/chromium/src/+/master/build/android/docs/lint.md' # pylint: disable=line-too-long
@ -417,7 +418,7 @@ def main():
output_paths = [args.result_path, args.processed_config_path]
build_utils.CallAndWriteDepfileIfStale(
md5_check.CallAndWriteDepfileIfStale(
lambda: _OnStaleMd5(args.lint_path,
args.config_path,
args.processed_config_path,

Просмотреть файл

@ -4,4 +4,3 @@
main_dex_list.py
util/__init__.py
util/build_utils.py
util/md5_check.py

Просмотреть файл

@ -5,4 +5,3 @@ merge_manifest.py
util/__init__.py
util/build_utils.py
util/manifest_utils.py
util/md5_check.py

Просмотреть файл

@ -17,6 +17,7 @@ import zipfile
from util import build_utils
from util import manifest_utils
from util import md5_check
from util import resource_utils
_AAPT_IGNORE_PATTERN = ':'.join([
@ -301,7 +302,7 @@ def main(args):
# This matters if a file is renamed but not changed (http://crbug.com/597126).
input_strings.extend(sorted(resource_names))
build_utils.CallAndWriteDepfileIfStale(
md5_check.CallAndWriteDepfileIfStale(
lambda: _OnStaleMd5(options),
options,
input_paths=input_paths,

Просмотреть файл

@ -5,4 +5,3 @@ proguard.py
util/__init__.py
util/build_utils.py
util/diff_utils.py
util/md5_check.py

Просмотреть файл

@ -19,11 +19,6 @@ import sys
import tempfile
import zipfile
# Any new non-system import must be added to:
# //build/config/android/internal_rules.gni
from util import md5_check
sys.path.append(os.path.join(os.path.dirname(__file__),
os.pardir, os.pardir, os.pardir))
import gn_helpers
@ -528,7 +523,7 @@ def GetSortedTransitiveDependencies(top, deps_func):
return list(deps_map)
def _ComputePythonDependencies():
def ComputePythonDependencies():
"""Gets the paths of imported non-system python modules.
A path is assumed to be a "system" import if it is outside of chromium's
@ -584,7 +579,7 @@ def WriteDepfile(depfile_path, first_gn_output, inputs=None, add_pydeps=True):
assert not isinstance(inputs, string_types) # Easy mistake to make
inputs = inputs or []
if add_pydeps:
inputs = _ComputePythonDependencies() + inputs
inputs = ComputePythonDependencies() + inputs
MakeDirectory(os.path.dirname(depfile_path))
# Ninja does not support multiple outputs in depfiles.
with open(depfile_path, 'w') as depfile:
@ -656,50 +651,3 @@ def ReadSourcesList(sources_list_file_name):
"""
with open(sources_list_file_name) as f:
return [file_name.strip() for file_name in f]
def CallAndWriteDepfileIfStale(on_stale_md5,
options,
record_path=None,
input_paths=None,
input_strings=None,
output_paths=None,
force=False,
pass_changes=False,
track_subpaths_whitelist=None,
depfile_deps=None):
"""Wraps md5_check.CallAndRecordIfStale() and writes a depfile if applicable.
Depfiles are automatically added to output_paths when present in the |options|
argument. They are then created after |on_stale_md5| is called.
By default, only python dependencies are added to the depfile. If there are
other input paths that are not captured by GN deps, then they should be listed
in depfile_deps. It's important to write paths to the depfile that are already
captured by GN deps since GN args can cause GN deps to change, and such
changes are not immediately reflected in depfiles (http://crbug.com/589311).
"""
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 [])
input_paths += _ComputePythonDependencies()
md5_check.CallAndRecordIfStale(
on_stale_md5,
record_path=record_path,
input_paths=input_paths,
input_strings=input_strings,
output_paths=output_paths,
force=force,
pass_changes=pass_changes,
track_subpaths_whitelist=track_subpaths_whitelist)
# Write depfile even when inputs have not changed to ensure build correctness
# on bots that build with & without patch, and the patch changes the depfile
# location.
if hasattr(options, 'depfile') and options.depfile:
WriteDepfile(
options.depfile, output_paths[0], depfile_deps, add_pydeps=False)

Просмотреть файл

@ -12,6 +12,7 @@ import os
import sys
import zipfile
from util import build_utils
# When set and a difference is detected, a diff of what changed is printed.
PRINT_EXPLANATIONS = int(os.environ.get('PRINT_BUILD_EXPLANATIONS', 0))
@ -20,6 +21,53 @@ PRINT_EXPLANATIONS = int(os.environ.get('PRINT_BUILD_EXPLANATIONS', 0))
_FORCE_REBUILD = int(os.environ.get('FORCE_REBUILD', 0))
def CallAndWriteDepfileIfStale(on_stale_md5,
options,
record_path=None,
input_paths=None,
input_strings=None,
output_paths=None,
force=False,
pass_changes=False,
track_subpaths_whitelist=None,
depfile_deps=None):
"""Wraps CallAndRecordIfStale() and writes a depfile if applicable.
Depfiles are automatically added to output_paths when present in the |options|
argument. They are then created after |on_stale_md5| is called.
By default, only python dependencies are added to the depfile. If there are
other input paths that are not captured by GN deps, then they should be listed
in depfile_deps. It's important to write paths to the depfile that are already
captured by GN deps since GN args can cause GN deps to change, and such
changes are not immediately reflected in depfiles (http://crbug.com/589311).
"""
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 [])
input_paths += build_utils.ComputePythonDependencies()
CallAndRecordIfStale(
on_stale_md5,
record_path=record_path,
input_paths=input_paths,
input_strings=input_strings,
output_paths=output_paths,
force=force,
pass_changes=pass_changes,
track_subpaths_whitelist=track_subpaths_whitelist)
# Write depfile even when inputs have not changed to ensure build correctness
# on bots that build with & without patch, and the patch changes the depfile
# location.
if hasattr(options, 'depfile') and options.depfile:
build_utils.WriteDepfile(
options.depfile, output_paths[0], depfile_deps, add_pydeps=False)
def CallAndRecordIfStale(function,
record_path=None,
input_paths=None,

Просмотреть файл

@ -6,5 +6,4 @@
../pylib/dex/dex_parser.py
util/__init__.py
util/build_utils.py
util/md5_check.py
validate_static_library_dex_references.py

Просмотреть файл

@ -24,6 +24,5 @@
../../gn_helpers.py
util/__init__.py
util/build_utils.py
util/md5_check.py
util/resource_utils.py
write_build_config.py

Просмотреть файл

@ -4,5 +4,4 @@
native_libraries_template.py
util/__init__.py
util/build_utils.py
util/md5_check.py
write_native_libraries_java.py

Просмотреть файл

@ -3,5 +3,4 @@
../../gn_helpers.py
util/__init__.py
util/build_utils.py
util/md5_check.py
zip.py

Просмотреть файл

@ -25,6 +25,5 @@
../gyp/util/__init__.py
../gyp/util/build_utils.py
../gyp/util/manifest_utils.py
../gyp/util/md5_check.py
../gyp/util/resource_utils.py
generate_android_manifest.py

Просмотреть файл

@ -3,5 +3,4 @@
../../gn_helpers.py
../gyp/util/__init__.py
../gyp/util/build_utils.py
../gyp/util/md5_check.py
write_installer_json.py

Просмотреть файл

@ -54,7 +54,6 @@ binary_size/apk_downloader.py
devil_chromium.py
gyp/util/__init__.py
gyp/util/build_utils.py
gyp/util/md5_check.py
gyp/util/zipalign.py
method_count.py
pylib/__init__.py

Просмотреть файл

@ -2,6 +2,5 @@
# build/print_python_deps.py --root build --output build/protoc_java.pydeps build/protoc_java.py
android/gyp/util/__init__.py
android/gyp/util/build_utils.py
android/gyp/util/md5_check.py
gn_helpers.py
protoc_java.py