Commit 5b72f4a3 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Add support for proguard and asset/lib expectation diffs

* Refactors more common logic for the three expectation file types
  into diff_utils.py
* Changes sort order for proguard expectations so that they diff better
* Output "actual_data" rather than .stamp files for expectation targets
* Stop writing out .proguard_configs for all proguard runs
  * I don't think these files have been referenced for a long time, and
    the expectations file largely serves their purpose in a more
    discoverable way.
* Don't define validate_expectations GN group unless it will
  have deps (to prevent thinking your GN args are correct when
  they are not).

Bug: 1064151
Change-Id: I5394471e7defd2c2f7e2f2173097a11d830cde65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314265Reviewed-by: default avatarMohamed Heikal <mheikal@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791342}
parent e8a7d2db
......@@ -111,25 +111,6 @@ def _ParseArgs(args):
'--best-compression',
action='store_true',
help='Use zip -9 rather than zip -1')
parser.add_argument(
'--stamp', help='If passed, the script touches the passed in stamp file.')
parser.add_argument(
'--expected-native-libs-and-assets',
help='Expected list of native libraries and assets.')
parser.add_argument(
'--native-libs-and-assets-expectation-failure-file',
help='Write to this file if the expected list of native libraries and '
'assets does not match the actual list.')
parser.add_argument(
'--only-verify-expectations',
action="store_true",
help='When passed, the script ends execution after verifying '
'expectations.')
parser.add_argument(
'--fail-on-expectations',
action="store_true",
help='When passed, fails the build on libraries and assets expectation '
'mismatches.')
parser.add_argument(
'--library-always-compress',
action='append',
......@@ -138,6 +119,7 @@ def _ParseArgs(args):
'--library-renames',
action='append',
help='The list of library files that we prepend crazy. to their names.')
diff_utils.AddCommandLineFlags(parser)
options = parser.parse_args(args)
options.assets = build_utils.ParseGnList(options.assets)
options.uncompressed_assets = build_utils.ParseGnList(
......@@ -179,9 +161,6 @@ def _ParseArgs(args):
and options.secondary_android_abi):
raise Exception('Must specify --is-multi-abi with both --android-abi '
'and --secondary-android-abi.')
if options.only_verify_expectations and not options.stamp:
raise Exception('Must specify --stamp when using '
'--only-verify-expectations.')
return options
......@@ -310,56 +289,16 @@ def _GetNativeLibrariesToAdd(native_libs, android_abi, uncompress, fast_align,
return libraries_to_add
def _VerifyNativeLibsAndAssets(
native_libs, assets, expectation_file_path,
unexpected_native_libs_and_assets_failure_file_path, fail_on_mismatch):
"""Verifies the native libraries and assets are as expected.
Check that the native libraries and assets being added are consistent with
the expectation file.
"""
def _CreateExpectationsData(native_libs, assets):
"""Creates list of native libraries and assets."""
native_libs = sorted(native_libs)
assets = sorted(assets)
with tempfile.NamedTemporaryFile() as generated_output:
for apk_path, _, compress, alignment in native_libs + assets:
generated_output.write('apk_path=%s, compress=%s, alignment=%s\n' %
(apk_path, compress, alignment))
generated_output.flush()
msg = diff_utils.DiffFileContents(
expectation_file_path, generated_output.name, show_files_compared=False)
if not msg:
return
msg_header = """\
Native Libraries and Assets expectations file needs updating. For details see:
https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/android/java/README.md
"""
sys.stderr.write(msg_header)
sys.stderr.write(msg)
if unexpected_native_libs_and_assets_failure_file_path:
build_utils.MakeDirectory(
os.path.dirname(unexpected_native_libs_and_assets_failure_file_path))
with open(unexpected_native_libs_and_assets_failure_file_path, 'w') as f:
f.write(msg_header)
f.write(msg)
if fail_on_mismatch:
sys.exit(1)
def _MaybeWriteDepAndStampFiles(options, depfile_deps):
if options.stamp:
build_utils.Touch(options.stamp)
if options.depfile:
if options.only_verify_expectations:
output = options.stamp
else:
output = options.output_apk
build_utils.WriteDepfile(options.depfile, output, inputs=depfile_deps)
ret = []
for apk_path, _, compress, alignment in native_libs + assets:
ret.append('apk_path=%s, compress=%s, alignment=%s\n' %
(apk_path, compress, alignment))
return ''.join(ret)
def main(args):
......@@ -430,22 +369,16 @@ def main(args):
apk_dex_dir = ''
def _GetAssetDetails(assets, uncompressed_assets, fast_align, allow_reads):
asset_details = _GetAssetsToAdd(
assets, fast_align, disable_compression=False, allow_reads=allow_reads)
asset_details.extend(
_GetAssetsToAdd(
uncompressed_assets,
fast_align,
disable_compression=True,
allow_reads=allow_reads))
return asset_details
# We compute expectations without reading the files. This allows us to check
# expectations for different targets by just generating their build_configs
# and not have to first generate all the actual files and all their
# dependencies (for example by just passing --only-verify-expectations).
expectation_asset_details = _GetAssetDetails(
assets, uncompressed_assets, fast_align, allow_reads=False)
ret = _GetAssetsToAdd(assets,
fast_align,
disable_compression=False,
allow_reads=allow_reads)
ret.extend(
_GetAssetsToAdd(uncompressed_assets,
fast_align,
disable_compression=True,
allow_reads=allow_reads))
return ret
libs_to_add = _GetNativeLibrariesToAdd(
native_libs, options.android_abi, options.uncompress_shared_libraries,
......@@ -457,14 +390,24 @@ def main(args):
options.uncompress_shared_libraries, fast_align,
options.library_always_compress, options.library_renames))
if options.expected_native_libs_and_assets:
_VerifyNativeLibsAndAssets(
libs_to_add, expectation_asset_details,
options.expected_native_libs_and_assets,
options.native_libs_and_assets_expectation_failure_file,
options.fail_on_expectations)
if options.expected_file:
# We compute expectations without reading the files. This allows us to check
# expectations for different targets by just generating their build_configs
# and not have to first generate all the actual files and all their
# dependencies (for example by just passing --only-verify-expectations).
asset_details = _GetAssetDetails(assets,
uncompressed_assets,
fast_align,
allow_reads=False)
actual_data = _CreateExpectationsData(libs_to_add, asset_details)
diff_utils.CheckExpectations(actual_data, options)
if options.only_verify_expectations:
_MaybeWriteDepAndStampFiles(options, depfile_deps)
if options.depfile:
build_utils.WriteDepfile(options.depfile,
options.actual_file,
inputs=depfile_deps)
return
# If we are past this point, we are going to actually create the final apk so
......@@ -598,7 +541,10 @@ def main(args):
options.key_name, int(options.min_sdk_version))
logging.debug('Moving file into place')
_MaybeWriteDepAndStampFiles(options, depfile_deps)
if options.depfile:
build_utils.WriteDepfile(options.depfile,
options.output_apk,
inputs=depfile_deps)
if __name__ == '__main__':
......
......@@ -60,31 +60,6 @@ def _ParseArgs(args):
'--aapt2-path', required=True, help='Path to the Android aapt2 tool.')
input_opts.add_argument(
'--android-manifest', required=True, help='AndroidManifest.xml path.')
input_opts.add_argument(
'--expected-file',
help='Expected contents for the check. If'
'--android-manifest-verify-diff-base is set, this is a diff file. If'
'not, this is a AndroidManifest file.')
input_opts.add_argument(
'--android-manifest-normalized', help='Normalized manifest.')
input_opts.add_argument(
'--android-manifest-expectations-failure-file',
help='Write to this file if expected manifest contents do not match '
'final manifest contents.')
input_opts.add_argument(
'--fail-on-expectations',
action="store_true",
help='When passed, fails the build on AndroidManifest expectation '
'mismatches.')
input_opts.add_argument(
'--expected-manifest-base-expectation',
help='When we expect the actual normalized manifest is different from'
'the file from --android-manifest-expected, this file specifies the'
'difference.')
input_opts.add_argument(
'--only-verify-expectations',
action='store_true',
help='If passed, only verify the android manifest expectation and exit.')
input_opts.add_argument(
'--r-java-root-package-name',
default='base',
......@@ -255,6 +230,7 @@ def _ParseArgs(args):
action='store_true',
help='Whether resources are being generated for a bundle module.')
diff_utils.AddCommandLineFlags(parser)
options = parser.parse_args(args)
resource_utils.HandleCommonOptions(options)
......@@ -485,41 +461,6 @@ def _FixManifest(options, temp_dir):
return debug_manifest_path, orig_package
def _VerifyManifest(actual_manifest, expected_file, normalized_manifest,
expected_manifest_base_expectation,
unexpected_manifest_failure_file, fail_on_mismatch):
with build_utils.AtomicOutput(normalized_manifest) as normalized_output:
normalized_output.write(manifest_utils.NormalizeManifest(actual_manifest))
if expected_manifest_base_expectation:
with tempfile.NamedTemporaryFile() as generated_diff:
actual_diff_content = diff_utils.GenerateDiffWithOnlyAdditons(
expected_manifest_base_expectation, normalized_manifest)
generated_diff.write(actual_diff_content)
generated_diff.flush()
msg = diff_utils.DiffFileContents(expected_file, generated_diff.name)
else:
msg = diff_utils.DiffFileContents(expected_file, normalized_manifest)
if not msg:
return
msg_header = """\
AndroidManifest.xml expectations file needs updating. For details see:
https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/android/java/README.md
"""
sys.stderr.write(msg_header)
sys.stderr.write(msg)
if unexpected_manifest_failure_file:
build_utils.MakeDirectory(os.path.dirname(unexpected_manifest_failure_file))
with open(unexpected_manifest_failure_file, 'w') as f:
f.write(msg_header)
f.write(msg)
if fail_on_mismatch:
sys.exit(1)
def _CreateKeepPredicate(resource_exclusion_regex,
resource_exclusion_exceptions):
"""Return a predicate lambda to determine which resource files to keep.
......@@ -1048,14 +989,10 @@ def _WriteOutputs(options, build):
shutil.move(temp, final)
def _VerifyExpectations(options):
def _CreateNormalizedManifest(options):
with build_utils.TempDir() as tempdir:
fixed_manifest, _ = _FixManifest(options, tempdir)
_VerifyManifest(fixed_manifest, options.expected_file,
options.android_manifest_normalized,
options.expected_manifest_base_expectation,
options.android_manifest_expectations_failure_file,
options.fail_on_expectations)
return manifest_utils.NormalizeManifest(fixed_manifest)
def _OnStaleMd5(options):
......@@ -1152,9 +1089,10 @@ def main(args):
options = _ParseArgs(args)
if options.expected_file:
_VerifyExpectations(options)
if options.only_verify_expectations:
return
actual_data = _CreateNormalizedManifest(options)
diff_utils.CheckExpectations(actual_data, options)
if options.only_verify_expectations:
return
depfile_deps = (options.dependencies_res_zips +
options.extra_main_r_text_files + options.include_resources)
......@@ -1163,7 +1101,7 @@ def main(args):
options.aapt2_path,
options.android_manifest,
options.expected_file,
options.expected_manifest_base_expectation,
options.expected_file_base,
options.resources_config_path,
options.shared_resources_allowlist,
options.use_resource_ids_path,
......@@ -1171,11 +1109,11 @@ def main(args):
]
input_paths = [p for p in possible_input_paths if p]
input_strings = [
options.android_manifest_expectations_failure_file,
options.app_as_shared_lib,
options.arsc_package_name,
options.debuggable,
options.extra_res_packages,
options.failure_file,
options.include_resources,
options.locale_allowlist,
options.manifest_package,
......@@ -1202,7 +1140,7 @@ def main(args):
]
output_paths = [options.srcjar_out]
possible_output_paths = [
options.android_manifest_normalized,
options.actual_file,
options.arsc_path,
options.emit_ids_out,
options.info_path,
......
......@@ -93,26 +93,6 @@ def _ParseOptions():
parser.add_argument(
'--extra-mapping-output-paths',
help='GN-list of additional paths to copy output mapping file to.')
parser.add_argument(
'--output-config',
help='Path to write the merged ProGuard config file to.')
parser.add_argument(
'--expected-configs-file',
help='Path to a file containing the expected merged ProGuard configs')
parser.add_argument(
'--proguard-expectations-failure-file',
help='Path to file written to if the expected merged ProGuard configs '
'differ from the generated merged ProGuard configs.')
parser.add_argument(
'--fail-on-expectations',
action="store_true",
help='When passed fails the build on proguard config expectation '
'mismatches.')
parser.add_argument(
'--only-verify-expectations',
action='store_true',
help='If passed only verifies that the proguard configs match '
'expectations but does not do any optimization with proguard/R8.')
parser.add_argument(
'--classpath',
action='append',
......@@ -167,12 +147,13 @@ def _ParseOptions():
parser.add_argument('--desugared-library-keep-rule-output',
help='Path to desugared library keep rule output file.')
diff_utils.AddCommandLineFlags(parser)
options = parser.parse_args(args)
if options.feature_names:
if options.output_path:
parser.error('Feature splits cannot specify an output in GN.')
if not options.stamp:
if not options.actual_file and not options.stamp:
parser.error('Feature splits require a stamp file as output.')
elif not options.output_path:
parser.error('Output path required when feature splits aren\'t used')
......@@ -180,12 +161,6 @@ def _ParseOptions():
if options.main_dex_rules_path and not options.r8_path:
parser.error('R8 must be enabled to pass main dex rules.')
if options.expected_configs_file and not options.output_config:
parser.error('--expected-configs-file requires --output-config')
if options.only_verify_expectations and not options.stamp:
parser.error('--only-verify-expectations requires --stamp')
options.classpath = build_utils.ParseGnList(options.classpath)
options.proguard_configs = build_utils.ParseGnList(options.proguard_configs)
options.input_paths = build_utils.ParseGnList(options.input_paths)
......@@ -206,27 +181,6 @@ def _ParseOptions():
return options
def _VerifyExpectedConfigs(expected_path, actual_path, failure_file_path,
fail_on_mismatch):
msg = diff_utils.DiffFileContents(expected_path, actual_path)
if not msg:
return
msg_header = """\
ProGuard flag expectations file needs updating. For details see:
https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/android/java/README.md
"""
sys.stderr.write(msg_header)
sys.stderr.write(msg)
if failure_file_path:
build_utils.MakeDirectory(os.path.dirname(failure_file_path))
with open(failure_file_path, 'w') as f:
f.write(msg_header)
f.write(msg)
if fail_on_mismatch:
sys.exit(1)
class _DexPathContext(object):
def __init__(self, name, output_path, input_jars, work_dir):
self.name = name
......@@ -388,16 +342,16 @@ def _OptimizeWithR8(options,
def _CombineConfigs(configs, dynamic_config_data, exclude_generated=False):
ret = []
def add_header(name):
ret.append('#' * 80)
ret.append('# ' + name)
ret.append('#' * 80)
# Sort in this way so //clank versions of the same libraries will sort
# to the same spot in the file.
def sort_key(path):
return tuple(reversed(path.split(os.path.sep)))
for config in sorted(configs):
for config in sorted(configs, key=sort_key):
if exclude_generated and config.endswith('.resources.proguard.txt'):
continue
add_header(config)
ret.append('# File: ' + config)
with open(config) as config_file:
contents = config_file.read().rstrip()
......@@ -410,7 +364,7 @@ def _CombineConfigs(configs, dynamic_config_data, exclude_generated=False):
ret.append('')
if dynamic_config_data:
add_header('Dynamically generated from build/android/gyp/proguard.py')
ret.append('# File: //build/android/gyp/proguard.py (generated rules)')
ret.append(dynamic_config_data)
ret.append('')
return '\n'.join(ret)
......@@ -511,26 +465,13 @@ def main():
proguard_configs, dynamic_config_data, exclude_generated=True)
print_stdout = _ContainsDebuggingConfig(merged_configs) or options.verbose
if options.expected_configs_file:
with tempfile.NamedTemporaryFile() as f:
f.write(merged_configs)
f.flush()
_VerifyExpectedConfigs(options.expected_configs_file, f.name,
options.proguard_expectations_failure_file,
options.fail_on_expectations)
if options.only_verify_expectations:
_MaybeWriteStampAndDepFile(options, options.proguard_configs)
return
# Writing the config output before we know ProGuard is going to succeed isn't
# great, since then a failure will result in one of the outputs being updated.
# We do it anyways though because the error message prints out the path to the
# config. Ninja will still know to re-run the command because of the other
# stale outputs.
if options.output_config:
with open(options.output_config, 'w') as f:
f.write(merged_configs)
if options.expected_file:
diff_utils.CheckExpectations(merged_configs, options)
if options.only_verify_expectations:
build_utils.WriteDepfile(options.depfile,
options.actual_file,
inputs=options.proguard_configs)
return
_OptimizeWithR8(options, proguard_configs, libraries, dynamic_config_data,
print_stdout)
......
......@@ -5,6 +5,7 @@
# found in the LICENSE file.
import os
import sys
import difflib
from util import build_utils
......@@ -23,28 +24,29 @@ def _SkipOmitted(line):
return line
def GenerateDiffWithOnlyAdditons(expected_path, actual_path):
def _GenerateDiffWithOnlyAdditons(expected_path, actual_data):
"""Generate a diff that only contains additions"""
with open(expected_path) as expected, open(actual_path) as actual:
expected_lines = expected.readlines()
actual_lines = actual.readlines()
# Ignore blank lines when creating the diff to cut down on whitespace-only
# lines in the diff.
with open(expected_path) as expected:
expected_lines = [l for l in expected.readlines() if l.strip()]
actual_lines = [l for l in actual_data.splitlines(True) if l.strip()]
diff = difflib.ndiff(expected_lines, actual_lines)
filtered_diff = (line for line in diff if line.startswith('+'))
return ''.join(filtered_diff)
diff = difflib.ndiff(expected_lines, actual_lines)
filtered_diff = (line for line in diff if line.startswith('+'))
return ''.join(filtered_diff)
def DiffFileContents(expected_path, actual_path, show_files_compared=True):
def _DiffFileContents(expected_path, actual_data):
"""Check file contents for equality and return the diff or None."""
with open(expected_path) as f_expected, open(actual_path) as f_actual:
with open(expected_path) as f_expected:
expected_lines = f_expected.readlines()
actual_lines = [_SkipOmitted(line) for line in f_actual]
actual_lines = [_SkipOmitted(line) for line in actual_data.splitlines(True)]
if expected_lines == actual_lines:
return None
expected_path = os.path.relpath(expected_path, build_utils.DIR_SOURCE_ROOT)
actual_path = os.path.relpath(actual_path, build_utils.DIR_SOURCE_ROOT)
diff = difflib.unified_diff(
expected_lines,
......@@ -53,22 +55,60 @@ def DiffFileContents(expected_path, actual_path, show_files_compared=True):
tofile=os.path.join('after', expected_path),
n=0)
files_compared_msg = """\
Files Compared:
* {}
* {}
""".format(expected_path, actual_path)
patch_msg = """\
If you are looking at this through LogDog, click "Raw log" before copying.
See https://bugs.chromium.org/p/chromium/issues/detail?id=984616.
To update the file, run:
return ''.join(diff).rstrip()
def AddCommandLineFlags(parser):
group = parser.add_argument_group('Expectations')
group.add_argument(
'--expected-file',
help='Expected contents for the check. If --expected-file-base is set, '
'this is a diff of --actual-file and --expected-file-base.')
group.add_argument(
'--expected-file-base',
help='File to diff against before comparing to --expected-file.')
group.add_argument('--actual-file',
help='Path to write actual file (for reference).')
group.add_argument('--failure-file',
help='Write to this file if expectations fail.')
group.add_argument('--fail-on-expectations',
action="store_true",
help='Fail on expectation mismatches.')
group.add_argument('--only-verify-expectations',
action='store_true',
help='Verify the expectation and exit.')
def CheckExpectations(actual_data, options):
with build_utils.AtomicOutput(options.actual_file) as f:
f.write(actual_data)
if options.expected_file_base:
actual_data = _GenerateDiffWithOnlyAdditons(options.expected_file_base,
actual_data)
diff_text = _DiffFileContents(options.expected_file, actual_data)
if not diff_text:
return
fail_msg = """
Expectations need updating:
https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/android/expecations/README.md
LogDog tip: Use "Raw log" or "Switch to lite mode" before copying:
https://bugs.chromium.org/p/chromium/issues/detail?id=984616
To update expectations, run:
########### START ###########
patch -p1 <<'END_DIFF'
{}
END_DIFF
############ END ############
""".format(''.join(diff).rstrip())
return files_compared_msg + patch_msg if show_files_compared else patch_msg
""".format(diff_text)
sys.stderr.write(fail_msg)
if options.failure_file:
build_utils.MakeDirectory(os.path.dirname(options.failure_file))
with open(options.failure_file, 'w') as f:
f.write(fail_msg)
if options.fail_on_expectations:
sys.exit(1)
This diff is collapsed.
......@@ -2130,9 +2130,14 @@ if (enable_java_templates) {
# main_component_library: Specifies the name of the base component's library
# in a component build. If given, the system will find dependent native
# libraries at runtime by inspecting this library (optional).
# expected_libs_and_assets: (optional): Verify the list
# of included native libraries and assets is consistent with the given
# expectation file.
# expected_libs_and_assets: Verify the list of included native libraries
# and assets is consistent with the given expectation file.
# expected_libs_and_assets_base: Treat expected_libs_and_assets as a diff
# with this file as the base.
# expected_proguard_config: Checks that the merged set of proguard flags
# matches the given config.
# expected_proguard_config_base: Treat expected_proguard_config as a diff
# with this file as the base.
template("android_apk_or_module") {
forward_variables_from(invoker, [ "testonly" ])
assert(defined(invoker.android_manifest))
......@@ -3130,6 +3135,7 @@ if (enable_java_templates) {
forward_variables_from(invoker,
[
"expected_libs_and_assets",
"expected_libs_and_assets_base",
"native_lib_placeholders",
"secondary_abi_loadable_modules",
"secondary_native_lib_placeholders",
......@@ -3453,6 +3459,10 @@ if (enable_java_templates) {
"enable_jetify",
"enable_multidex",
"enable_native_mocks",
"expected_android_manifest",
"expected_android_manifest_base",
"expected_libs_and_assets",
"expected_libs_and_assets_base",
"generate_buildconfig_java",
"generate_final_jni",
"input_jars_paths",
......@@ -3514,9 +3524,6 @@ if (enable_java_templates) {
"library_always_compress",
"library_renames",
"use_chromium_linker",
"expected_android_manifest",
"expected_android_manifest_base",
"expected_libs_and_assets",
"version_code",
"version_name",
])
......@@ -3588,6 +3595,8 @@ if (enable_java_templates) {
"data_deps",
"deps",
"enable_multidex",
"expected_android_manifest",
"expected_android_manifest_base",
"generate_buildconfig_java",
"generate_final_jni",
"input_jars_paths",
......@@ -3639,8 +3648,6 @@ if (enable_java_templates) {
"library_renames",
"use_chromium_linker",
"use_modern_linker",
"expected_android_manifest",
"expected_android_manifest_base",
"version_code",
"version_name",
])
......@@ -4469,18 +4476,20 @@ if (enable_java_templates) {
# avoid library duplication. Effectively, the static library will be
# treated as the parent of the base module.
#
# expected_libs_and_assets: Verify the list of included native libraries
# and assets is consistent with the given expectation file.
# expected_libs_and_assets_base: Treat expected_libs_and_assets as a diff
# with this file as the base.
# expected_proguard_config: Checks that the merged set of proguard flags
# matches the given config.
# expected_proguard_config_base: Treat expected_proguard_config as a diff
# with this file as the base.
#
# version_code: Optional. Version code of the target.
#
# is_multi_abi: If true will add a library placeholder for the missing ABI
# if either the primary or the secondary ABI has no native libraries set.
#
# expected_libs_and_assets: (optional): Verify the list
# of included native libraries and assets is consistent with the given
# expectation file.
#
# default_modules_for_testing: (optional): A list of DFM that the wrapper
# script should install. This is for local testing only, and does not
# affect the actual DFM in production.
......@@ -4704,6 +4713,7 @@ if (enable_java_templates) {
forward_variables_from(invoker,
[
"expected_proguard_config",
"expected_proguard_config_base",
"min_sdk_version",
])
if (defined(expected_proguard_config)) {
......@@ -4758,8 +4768,12 @@ if (enable_java_templates) {
if (module_name == "base" &&
defined(invoker.expected_libs_and_assets)) {
forward_variables_from(invoker,
[
"expected_libs_and_assets",
"expected_libs_and_assets_base",
])
top_target_name = _target_name
expected_libs_and_assets = invoker.expected_libs_and_assets
build_config_target = _module_build_config_target
native_libraries_config_target = ":$_native_libraries_config_target"
if (defined(android_app_secondary_abi)) {
......
......@@ -3243,25 +3243,27 @@ generate_jni("native_j_unittests_jni_headers") {
feature_list_file = "//chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java"
}
# Used by android-binary-size trybot to know which expectations to validate.
group("validate_expectations") {
deps = []
if (_enable_libs_and_assets_verification) {
deps += [
":chrome_modern_public_bundle_validate_libs_and_assets",
":monochrome_public_bundle_validate_libs_and_assets",
":trichrome_chrome_bundle_validate_libs_and_assets",
":trichrome_library_apk_validate_libs_and_assets",
]
}
if (_enable_manifest_verification) {
deps += [
":monochrome_public_bundle__base_bundle_module_validate_android_manifest",
":monochrome_public_bundle_validate_proguard_config",
":trichrome_chrome_bundle__base_bundle_module_validate_android_manifest",
":trichrome_library_apk_validate_android_manifest",
"//android_webview:system_webview_base_bundle_module_validate_android_manifest",
"//android_webview:trichrome_webview_base_bundle_module_validate_android_manifest",
]
# Used by android-binary-size trybot to validate expectations.
if (_enable_libs_and_assets_verification || _enable_manifest_verification) {
group("validate_expectations") {
deps = []
if (_enable_libs_and_assets_verification) {
deps += [
":chrome_modern_public_bundle_validate_libs_and_assets",
":monochrome_public_bundle_validate_libs_and_assets",
":trichrome_chrome_bundle_validate_libs_and_assets",
":trichrome_library_apk_validate_libs_and_assets",
]
}
if (_enable_manifest_verification) {
deps += [
":monochrome_public_bundle__base_bundle_module_validate_android_manifest",
":monochrome_public_bundle_validate_proguard_config",
":trichrome_chrome_bundle__base_bundle_module_validate_android_manifest",
":trichrome_library_apk_validate_android_manifest",
"//android_webview:system_webview_base_bundle_module_validate_android_manifest",
"//android_webview:trichrome_webview_base_bundle_module_validate_android_manifest",
]
}
}
}
......@@ -77,7 +77,10 @@ template("chrome_bundle") {
"base_module_target",
"bundle_name",
"compress_shared_libraries",
"expected_libs_and_assets",
"expected_libs_and_assets_base",
"expected_proguard_config",
"expected_proguard_config_base",
"keystore_name",
"keystore_password",
"keystore_path",
......@@ -89,7 +92,6 @@ template("chrome_bundle") {
"sign_bundle",
"static_library_provider",
"static_library_synchronized_proguard",
"expected_libs_and_assets",
"version_code",
])
command_line_flags_file = "chrome-command-line"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment