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:
ret = []
for apk_path, _, compress, alignment in native_libs + assets:
generated_output.write('apk_path=%s, compress=%s, alignment=%s\n' %
ret.append('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)
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,
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 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)
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,7 +1089,8 @@ def main(args):
options = _ParseArgs(args)
if options.expected_file:
_VerifyExpectations(options)
actual_data = _CreateNormalizedManifest(options)
diff_utils.CheckExpectations(actual_data, options)
if options.only_verify_expectations:
return
......@@ -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,27 +465,14 @@ 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.expected_file:
diff_utils.CheckExpectations(merged_configs, options)
if options.only_verify_expectations:
_MaybeWriteStampAndDepFile(options, options.proguard_configs)
build_utils.WriteDepfile(options.depfile,
options.actual_file,
inputs=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)
_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)
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)
......@@ -1206,15 +1206,6 @@ if (enable_java_templates) {
]
}
if (defined(invoker.config_output_path)) {
# Do not add as an explicit output since it's only for debugging.
_config_output_path = invoker.config_output_path
_args += [
"--output-config",
rebase_path(_config_output_path, root_build_dir),
]
}
if (_enable_jdk_library_desugaring) {
_args += [
"--desugar-jdk-libs-json",
......@@ -1264,22 +1255,29 @@ if (enable_java_templates) {
invoker.build_config,
invoker.expected_proguard_config,
]
_actual_file = "$target_gen_dir/$target_name.proguard_configs"
_failure_file =
"$android_configuration_failure_dir/" +
string_replace(invoker.expected_proguard_config, "/", "_")
_expectation_stamp = "$target_gen_dir/$target_name.stamp"
outputs = [ _expectation_stamp ]
outputs = [ _actual_file ]
args = _args + [
"--depfile",
rebase_path(depfile, root_build_dir),
"--proguard-expectations-failure-file",
"--failure-file",
rebase_path(_failure_file, root_build_dir),
"--expected-configs-file",
"--expected-file",
rebase_path(invoker.expected_proguard_config, root_build_dir),
"--stamp",
rebase_path(_expectation_stamp, root_build_dir),
"--actual-file",
rebase_path(_actual_file, root_build_dir),
"--only-verify-expectations",
]
if (defined(invoker.expected_proguard_config_base)) {
inputs += [ invoker.expected_proguard_config_base ]
args += [
"--expected-file-base",
rebase_path(invoker.expected_proguard_config_base, root_build_dir),
]
}
if (fail_on_android_expectations) {
args += [ "--fail-on-expectations" ]
}
......@@ -1405,9 +1403,6 @@ if (enable_java_templates) {
}
if (_proguard_enabled) {
if (defined(invoker.output)) {
_proguard_output_path = invoker.output
}
_proguard_target_name = target_name
proguard(_proguard_target_name) {
......@@ -1420,6 +1415,7 @@ if (enable_java_templates) {
"disable_checkdiscard",
"disable_r8_outlining",
"expected_proguard_config",
"expected_proguard_config_base",
"is_static_library",
"modules",
"proguard_mapping_path",
......@@ -1487,12 +1483,10 @@ if (enable_java_templates) {
inputs += [ _main_dex_rules ]
}
if (defined(_proguard_output_path)) {
output_path = _proguard_output_path
config_output_path = "$_proguard_output_path.proguard_flags"
if (defined(invoker.output)) {
output_path = invoker.output
} else {
mapping_path = "$target_out_dir/$target_name.mapping"
config_output_path = "$target_out_dir/$target_name.proguard_flags"
}
}
} else { # !_proguard_enabled
......@@ -2637,7 +2631,7 @@ if (enable_java_templates) {
_expectations_target =
"${invoker.top_target_name}_validate_android_manifest"
action_with_pydeps(_expectations_target) {
_normalized_output = "${invoker.android_manifest}.normalized"
_actual_file = "${invoker.android_manifest}.normalized"
_failure_file =
"$android_configuration_failure_dir/" +
string_replace(invoker.expected_android_manifest, "/", "_")
......@@ -2646,18 +2640,7 @@ if (enable_java_templates) {
invoker.build_config,
invoker.expected_android_manifest,
]
if (defined(invoker.expected_android_manifest_base)) {
_args += [
"--expected-manifest-base-expectation",
rebase_path(invoker.expected_android_manifest_base, root_build_dir),
]
inputs += [ invoker.expected_android_manifest_base ]
}
if (fail_on_android_expectations) {
_args += [ "--fail-on-expectations" ]
}
outputs = [ _normalized_output ]
outputs = [ _actual_file ]
deps = [
invoker.android_manifest_dep,
invoker.build_config_dep,
......@@ -2666,12 +2649,22 @@ if (enable_java_templates) {
args = _args + [
"--expected-file",
rebase_path(invoker.expected_android_manifest, root_build_dir),
"--android-manifest-normalized",
rebase_path(_normalized_output, root_build_dir),
"--android-manifest-expectations-failure-file",
"--actual-file",
rebase_path(_actual_file, root_build_dir),
"--failure-file",
rebase_path(_failure_file, root_build_dir),
"--only-verify-expectations",
]
if (defined(invoker.expected_android_manifest_base)) {
args += [
"--expected-file-base",
rebase_path(invoker.expected_android_manifest_base, root_build_dir),
]
inputs += [ invoker.expected_android_manifest_base ]
}
if (fail_on_android_expectations) {
args += [ "--fail-on-expectations" ]
}
}
_deps += [ ":$_expectations_target" ]
}
......@@ -2765,6 +2758,10 @@ if (enable_java_templates) {
# asset information.
# deps: Specifies the dependencies of this target.
# dex_path: Path to classes.dex file to include (optional).
# 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.
# jdk_libs_dex: Path to classes.dex for desugar_jdk_libs.
# packaged_resources_path: Path to .ap_ to use.
# output_apk_path: Output path for the generated .apk.
......@@ -2784,8 +2781,6 @@ if (enable_java_templates) {
# keystore_password: Keystore password.
# uncompress_shared_libraries: (optional, default false) Whether to store
# native libraries inside the APK uncompressed and page-aligned.
# expected_libs_and_assets: (optional): Verify the list of included native
# libraries and assets is consistent with the given expectation file.
template("package_apk") {
forward_variables_from(invoker,
[
......@@ -2915,7 +2910,7 @@ if (enable_java_templates) {
_expectations_target =
"${invoker.top_target_name}_validate_libs_and_assets"
action_with_pydeps(_expectations_target) {
_stamp = "$target_gen_dir/$target_name.stamp"
_actual_file = "$target_gen_dir/$target_name.libs_and_assets"
_failure_file =
"$android_configuration_failure_dir/" +
string_replace(invoker.expected_libs_and_assets, "/", "_")
......@@ -2924,17 +2919,24 @@ if (enable_java_templates) {
invoker.expected_libs_and_assets,
]
deps = [ invoker.build_config_dep ]
outputs = [ _stamp ]
outputs = [ _actual_file ]
script = _script
args = _args + [
"--expected-native-libs-and-assets",
"--expected-file",
rebase_path(invoker.expected_libs_and_assets, root_build_dir),
"--native-libs-and-assets-expectation-failure-file",
"--actual-file",
rebase_path(_actual_file, root_build_dir),
"--failure-file",
rebase_path(_failure_file, root_build_dir),
"--stamp",
rebase_path(_stamp, root_build_dir),
"--only-verify-expectations",
]
if (defined(invoker.expected_libs_and_assets_base)) {
inputs += [ invoker.expected_libs_and_assets_base ]
args += [
"--expected-file-base",
rebase_path(invoker.expected_libs_and_assets_base, root_build_dir),
]
}
if (fail_on_android_expectations) {
args += [ "--fail-on-expectations" ]
}
......@@ -4024,13 +4026,15 @@ if (enable_java_templates) {
# is the path to its dex file and is passed directly to the creation script.
# Otherwise, dex_path is undefined and we retrieve the module's dex file
# using its build_config.
# 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.
# 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.
# module_name: The module's name.
# native_libraries_config: Path to file listing native libraries to be
# packaged into each module.
# 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.
# proguard_enabled: Optional. True if proguarding is enabled for this
# bundle. Default is to enable this only for release builds. Note that
# this will always perform synchronized proguarding.
......@@ -4127,7 +4131,7 @@ template("create_android_app_bundle_module") {
if (defined(invoker.expected_libs_and_assets)) {
_expectations_target = "${invoker.top_target_name}_validate_libs_and_assets"
action_with_pydeps(_expectations_target) {
_stamp = "$target_gen_dir/$target_name.stamp"
_actual_file = "$target_gen_dir/$target_name.libs_and_assets"
_failure_file = "$android_configuration_failure_dir/" +
string_replace(invoker.expected_libs_and_assets, "/", "_")
inputs = [
......@@ -4143,17 +4147,24 @@ template("create_android_app_bundle_module") {
inputs += [ invoker.secondary_abi_native_libraries_config ]
deps += [ invoker.secondary_abi_native_libraries_config_target ]
}
outputs = [ _stamp ]
outputs = [ _actual_file ]
script = _script
args = _args + [
"--expected-native-libs-and-assets",
"--expected-file",
rebase_path(invoker.expected_libs_and_assets, root_build_dir),
"--native-libs-and-assets-expectation-failure-file",
"--actual-file",
rebase_path(_actual_file, root_build_dir),
"--failure-file",
rebase_path(_failure_file, root_build_dir),
"--stamp",
rebase_path(_stamp, root_build_dir),
"--only-verify-expectations",
]
if (defined(invoker.expected_libs_and_assets_base)) {
inputs += [ invoker.expected_libs_and_assets_base ]
args += [
"--expected-file-base",
rebase_path(invoker.expected_libs_and_assets_base, root_build_dir),
]
}
if (fail_on_android_expectations) {
args += [ "--fail-on-expectations" ]
}
......
......@@ -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,8 +3243,9 @@ 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") {
# 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 += [
......@@ -3264,4 +3265,5 @@ group("validate_expectations") {
"//android_webview:trichrome_webview_base_bundle_module_validate_android_manifest",
]
}
}
}
################################################################################
# ../../android_webview/nonembedded/java/proguard.flags
################################################################################
# Copyright 2016 The Chromium Authors. All rights reserved.
# File: ../../third_party/android_deps/androidx_mediarouter.flags
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-keepclassmembers class org.chromium.android_webview.AwPdfExporter {
android.view.ViewGroup mContainerView;
}
# Keep the factory and its public members; it's the main entry point used by the
# framework.
-keep class com.android.webview.chromium.WebViewChromiumFactoryProvider {
public *;
}
-keep class * implements android.webkit.WebViewFactoryProvider$Statics {
*;
}
-keep class com.android.webview.chromium.ContentSettingsAdapter {
public *;
}
-keep class com.android.webview.chromium.WebViewChromiumFactoryProviderFor* {
public *;
}
-keep class com.android.webview.chromium.WebViewDatabaseAdapter {
public *;
}
# This is the main entry point for APIs. It is kept to make developing with
# unreleased Android easier.
-keep class com.android.webview.chromium.WebViewChromium {
public *;
}
# Functor classes with native methods implemented in Android.
-keep class com.android.webview.chromium.DrawFunctor
-keep class com.android.webview.chromium.DrawGLFunctor
-keep class com.android.webview.chromium.GraphicsUtils
# The lock file object must be kept explicitly to avoid it being optimized
# away and the lock released by the object's finalizer.
-keep class org.chromium.android_webview.AwDataDirLock {
java.nio.channels.FileLock sExclusiveFileLock;
java.io.RandomAccessFile sLockFile;
}
# Help R8 to remove debug related coded. All of these static constants are
# initialized to: Log.isLoggable(DEBUG, TAG).
# Workaround for crbug/1002847. Methods of BaseGmsClient are incorrectly
# removed even though they are required for the derived class GmsClient
# to correctly implement Api$Client.
# TODO: remove once crbug/1002847 resolved.
-keep public class com.google.android.gms.common.internal.BaseGmsClient {
public void disconnect();
public void dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[]);
public int getMinApkVersion();
public boolean requiresSignIn();
-assumevalues class androidx.mediarouter.** {
static boolean DEBUG return false;
}
################################################################################
# ../../android_webview/support_library/boundary_interfaces/proguard.flags
################################################################################
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# We need to avoid obfuscating the support library boundary interface because
# this API is shared with the Android Support Library.
# Note that we only 'keep' the package org.chromium.support_lib_boundary itself,
# any sub-packages of that package can still be obfuscated.
-keep public class org.chromium.support_lib_boundary.* { public *; }
################################################################################
# ../../base/android/proguard/chromium_apk.flags
################################################################################
# File: ../../base/android/proguard/chromium_apk.flags
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -162,9 +97,7 @@
public boolean requiresSignIn();
}
################################################################################
# ../../base/android/proguard/chromium_code.flags
################################################################################
# File: ../../base/android/proguard/chromium_code.flags
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -265,20 +198,7 @@
public static **[] values();
}
################################################################################
# ../../base/android/proguard/enable_obfuscation.flags
################################################################################
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# As of August 11, 2016, obfuscation was found to save 660kb on our .dex size
# and 53kb memory/process (through shrinking method/string counts).
-repackageclasses ''
################################################################################
# ../../build/android/dcheck_is_off.flags
################################################################################
# File: ../../build/android/dcheck_is_off.flags
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -297,42 +217,16 @@
@org.chromium.base.annotations.RemovableInRelease *;
}
################################################################################
# ../../chrome/android/features/start_surface/internal/proguard.flags
################################################################################
# Copyright 2019 The Chromium Authors. All rights reserved.
# File: ../../base/android/proguard/enable_obfuscation.flags
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# To fix crbug/1017396. This is because AppBarLayout$ScrollingViewBehavior
# is instantiated via java.lang.reflect.Constructor in CoordinatorLayout.java.
# Note that AppBarLayout$Behavior is needed to keep the scrolling behavior.
# TODO(bjoyce): Remove the android support library keep after verifying
# AndroidX migration is sound.
-keep class android.support.design.widget.AppBarLayout$Behavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
-keep class android.support.design.widget.AppBarLayout$ScrollingViewBehavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
# To fix crbug/1017396. This is because AppBarLayout$ScrollingViewBehavior
# is instantiated via java.lang.reflect.Constructor in CoordinatorLayout.java.
# Note that AppBarLayout$Behavior is needed to keep the scrolling behavior.
-keep class com.google.android.material.appbar.AppBarLayout$Behavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
-keep class com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
# As of August 11, 2016, obfuscation was found to save 660kb on our .dex size
# and 53kb memory/process (through shrinking method/string counts).
-repackageclasses ''
################################################################################
# ../../chrome/android/proguard/main.flags
################################################################################
# File: ../../chrome/android/proguard/main.flags
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -393,80 +287,11 @@
*** build() return null;
}
################################################################################
# ../../third_party/android_deps/androidx_mediarouter.flags
################################################################################
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Help R8 to remove debug related coded. All of these static constants are
# initialized to: Log.isLoggable(DEBUG, TAG).
-assumevalues class androidx.mediarouter.** {
static boolean DEBUG return false;
}
################################################################################
# ../../third_party/arcore-android-sdk-client/proguard.txt
################################################################################
# Keep ARCore public-facing classes
# This line from the ARCore SDK's .aar should not be needed when consuming ARCore SDK:
# -keepparameternames
# These are part of the Java <-> native interfaces for ARCore.
-keepclasseswithmembernames,includedescriptorclasses class !com.google.ar.core.viewer.**, !com.google.ar.core.services.logging.**, !com.google.ar.sceneform.**, com.google.ar.** {
native <methods>;
}
# This line from the ARCore SDK's .aar should not be needed when consuming ARCore SDK:
# -keep public class !com.google.ar.core.viewer.**, !com.google.ar.core**.R$*, !com.google.ar.core.services.logging.**, com.google.ar.core.** {*;}
# If you need to build a library on top of arcore_client, and use this library for your project
# Please un-comment this line below.
# -keepattributes *Annotation*
-keep class com.google.ar.core.annotations.UsedByNative
-keep @com.google.ar.core.annotations.UsedByNative class *
-keepclassmembers class * {
@com.google.ar.core.annotations.UsedByNative *;
}
-keep class com.google.ar.core.annotations.UsedByReflection
-keep @com.google.ar.core.annotations.UsedByReflection class *
-keepclassmembers class * {
@com.google.ar.core.annotations.UsedByReflection *;
}
# Keep Dynamite classes
# .aidl file will be proguarded, we should keep all Aidls.
# These lines from the ARCore SDK's .aar should not be needed when consuming ARCore SDK:
# -keep class com.google.vr.dynamite.client.IObjectWrapper { *; }
# -keep class com.google.vr.dynamite.client.ILoadedInstanceCreator { *; }
# -keep class com.google.vr.dynamite.client.INativeLibraryLoader { *; }
# Keep annotation files and the file got annotated.
-keep class com.google.vr.dynamite.client.UsedByNative
-keep @com.google.vr.dynamite.client.UsedByNative class *
-keepclassmembers class * {
@com.google.vr.dynamite.client.UsedByNative *;
}
-keep class com.google.vr.dynamite.client.UsedByReflection
-keep @com.google.vr.dynamite.client.UsedByReflection class *
-keepclassmembers class * {
@com.google.vr.dynamite.client.UsedByReflection *;
}
################################################################################
# ../../third_party/gvr-android-sdk/proguard-gvr-chromium.txt
################################################################################
# File: ../../third_party/gvr-android-sdk/proguard-gvr-chromium.txt
-dontwarn com.google.common.logging.nano.Vr$**
-dontwarn com.google.vr.**
################################################################################
# ../../third_party/gvr-android-sdk/src/proguard-gvr.txt
################################################################################
# File: ../../third_party/gvr-android-sdk/src/proguard-gvr.txt
# Don't obfuscate any NDK/SDK code. This makes the debugging of stack traces
# in release builds easier.
-keepnames class com.google.vr.ndk.** { *; }
......@@ -502,9 +327,109 @@
-dontwarn com.google.protobuf.nano.NanoEnumValue
################################################################################
# obj/third_party/android_deps/androidx_appcompat_appcompat_java/proguard.txt
################################################################################
# File: ../../android_webview/support_library/boundary_interfaces/proguard.flags
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# We need to avoid obfuscating the support library boundary interface because
# this API is shared with the Android Support Library.
# Note that we only 'keep' the package org.chromium.support_lib_boundary itself,
# any sub-packages of that package can still be obfuscated.
-keep public class org.chromium.support_lib_boundary.* { public *; }
# File: ../../chrome/android/features/start_surface/internal/proguard.flags
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# To fix crbug/1017396. This is because AppBarLayout$ScrollingViewBehavior
# is instantiated via java.lang.reflect.Constructor in CoordinatorLayout.java.
# Note that AppBarLayout$Behavior is needed to keep the scrolling behavior.
# TODO(bjoyce): Remove the android support library keep after verifying
# AndroidX migration is sound.
-keep class android.support.design.widget.AppBarLayout$Behavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
-keep class android.support.design.widget.AppBarLayout$ScrollingViewBehavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
# To fix crbug/1017396. This is because AppBarLayout$ScrollingViewBehavior
# is instantiated via java.lang.reflect.Constructor in CoordinatorLayout.java.
# Note that AppBarLayout$Behavior is needed to keep the scrolling behavior.
-keep class com.google.android.material.appbar.AppBarLayout$Behavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
-keep class com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior {
public <init>(android.content.Context, android.util.AttributeSet);
public <init>();
}
# File: ../../android_webview/nonembedded/java/proguard.flags
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-keepclassmembers class org.chromium.android_webview.AwPdfExporter {
android.view.ViewGroup mContainerView;
}
# Keep the factory and its public members; it's the main entry point used by the
# framework.
-keep class com.android.webview.chromium.WebViewChromiumFactoryProvider {
public *;
}
-keep class * implements android.webkit.WebViewFactoryProvider$Statics {
*;
}
-keep class com.android.webview.chromium.ContentSettingsAdapter {
public *;
}
-keep class com.android.webview.chromium.WebViewChromiumFactoryProviderFor* {
public *;
}
-keep class com.android.webview.chromium.WebViewDatabaseAdapter {
public *;
}
# This is the main entry point for APIs. It is kept to make developing with
# unreleased Android easier.
-keep class com.android.webview.chromium.WebViewChromium {
public *;
}
# Functor classes with native methods implemented in Android.
-keep class com.android.webview.chromium.DrawFunctor
-keep class com.android.webview.chromium.DrawGLFunctor
-keep class com.android.webview.chromium.GraphicsUtils
# The lock file object must be kept explicitly to avoid it being optimized
# away and the lock released by the object's finalizer.
-keep class org.chromium.android_webview.AwDataDirLock {
java.nio.channels.FileLock sExclusiveFileLock;
java.io.RandomAccessFile sLockFile;
}
# Workaround for crbug/1002847. Methods of BaseGmsClient are incorrectly
# removed even though they are required for the derived class GmsClient
# to correctly implement Api$Client.
# TODO: remove once crbug/1002847 resolved.
-keep public class com.google.android.gms.common.internal.BaseGmsClient {
public void disconnect();
public void dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[]);
public int getMinApkVersion();
public boolean requiresSignIn();
}
# File: obj/third_party/android_deps/androidx_appcompat_appcompat_java/proguard.txt
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -528,9 +453,7 @@
<methods>;
}
################################################################################
# obj/third_party/android_deps/androidx_lifecycle_lifecycle_viewmodel_savedstate_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/androidx_lifecycle_lifecycle_viewmodel_savedstate_java/proguard.txt
-keepclassmembers,allowobfuscation class * extends androidx.lifecycle.ViewModel {
<init>(androidx.lifecycle.SavedStateHandle);
}
......@@ -539,9 +462,7 @@
<init>(android.app.Application,androidx.lifecycle.SavedStateHandle);
}
################################################################################
# obj/third_party/android_deps/androidx_media_media_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/androidx_media_media_java/proguard.txt
# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -566,9 +487,7 @@
public static final android.os.Parcelable$Creator *;
}
################################################################################
# obj/third_party/android_deps/androidx_recyclerview_recyclerview_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/androidx_recyclerview_recyclerview_java/proguard.txt
# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -595,9 +514,7 @@
public boolean isLayoutSuppressed();
}
################################################################################
# obj/third_party/android_deps/androidx_savedstate_savedstate_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/androidx_savedstate_savedstate_java/proguard.txt
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -616,9 +533,7 @@
<init>();
}
################################################################################
# obj/third_party/android_deps/androidx_transition_transition_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/androidx_transition_transition_java/proguard.txt
# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -638,9 +553,7 @@
androidx.transition.ChangeBounds$ViewBounds mViewBounds;
}
################################################################################
# obj/third_party/android_deps/androidx_vectordrawable_vectordrawable_animated_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/androidx_vectordrawable_vectordrawable_animated_java/proguard.txt
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -661,25 +574,68 @@
*** get*();
}
################################################################################
# obj/third_party/android_deps/androidx_versionedparcelable_versionedparcelable_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/androidx_versionedparcelable_versionedparcelable_java/proguard.txt
-keep public class * implements androidx.versionedparcelable.VersionedParcelable
-keep public class android.support.**Parcelizer { *; }
-keep public class androidx.**Parcelizer { *; }
-keep public class androidx.versionedparcelable.ParcelImpl
################################################################################
# obj/third_party/android_deps/google_play_services_base_java/proguard.txt
################################################################################
# File: ../../third_party/arcore-android-sdk-client/proguard.txt
# Keep ARCore public-facing classes
# This line from the ARCore SDK's .aar should not be needed when consuming ARCore SDK:
# -keepparameternames
# These are part of the Java <-> native interfaces for ARCore.
-keepclasseswithmembernames,includedescriptorclasses class !com.google.ar.core.viewer.**, !com.google.ar.core.services.logging.**, !com.google.ar.sceneform.**, com.google.ar.** {
native <methods>;
}
# This line from the ARCore SDK's .aar should not be needed when consuming ARCore SDK:
# -keep public class !com.google.ar.core.viewer.**, !com.google.ar.core**.R$*, !com.google.ar.core.services.logging.**, com.google.ar.core.** {*;}
# If you need to build a library on top of arcore_client, and use this library for your project
# Please un-comment this line below.
# -keepattributes *Annotation*
-keep class com.google.ar.core.annotations.UsedByNative
-keep @com.google.ar.core.annotations.UsedByNative class *
-keepclassmembers class * {
@com.google.ar.core.annotations.UsedByNative *;
}
-keep class com.google.ar.core.annotations.UsedByReflection
-keep @com.google.ar.core.annotations.UsedByReflection class *
-keepclassmembers class * {
@com.google.ar.core.annotations.UsedByReflection *;
}
# Keep Dynamite classes
# .aidl file will be proguarded, we should keep all Aidls.
# These lines from the ARCore SDK's .aar should not be needed when consuming ARCore SDK:
# -keep class com.google.vr.dynamite.client.IObjectWrapper { *; }
# -keep class com.google.vr.dynamite.client.ILoadedInstanceCreator { *; }
# -keep class com.google.vr.dynamite.client.INativeLibraryLoader { *; }
# Keep annotation files and the file got annotated.
-keep class com.google.vr.dynamite.client.UsedByNative
-keep @com.google.vr.dynamite.client.UsedByNative class *
-keepclassmembers class * {
@com.google.vr.dynamite.client.UsedByNative *;
}
-keep class com.google.vr.dynamite.client.UsedByReflection
-keep @com.google.vr.dynamite.client.UsedByReflection class *
-keepclassmembers class * {
@com.google.vr.dynamite.client.UsedByReflection *;
}
# File: obj/third_party/android_deps/google_play_services_base_java/proguard.txt
# b/35135904 Ensure that proguard will not strip the mResultGuardian.
-keepclassmembers class com.google.android.gms.common.api.internal.BasePendingResult {
com.google.android.gms.common.api.internal.BasePendingResult$ReleasableResultGuardian mResultGuardian;
}
################################################################################
# obj/third_party/android_deps/google_play_services_basement_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/google_play_services_basement_java/proguard.txt
# Proguard flags for consumers of the Google Play services SDK
# https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project
......@@ -738,14 +694,10 @@
-dontwarn javax.annotation.**
-dontwarn org.checkerframework.**
################################################################################
# obj/third_party/android_deps/google_play_services_cast_framework_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/google_play_services_cast_framework_java/proguard.txt
-keep public class * implements com.google.android.gms.cast.framework.OptionsProvider
################################################################################
# obj/third_party/android_deps/google_play_services_clearcut_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/google_play_services_clearcut_java/proguard.txt
# We keep all fields for every generated proto file as the runtime uses
# reflection over them that ProGuard cannot detect. Without this keep
# rule, fields may be removed that would cause runtime failures.
......@@ -753,24 +705,18 @@
<fields>;
}
################################################################################
# obj/third_party/android_deps/google_play_services_fido_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/google_play_services_fido_java/proguard.txt
# Methods enable and disable in this class are complained as unresolved
# references, but they are system APIs and are not used by Fido client apps.
-dontwarn android.nfc.NfcAdapter
################################################################################
# obj/third_party/android_deps/google_play_services_gcm_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/google_play_services_gcm_java/proguard.txt
# Ensure that proguard will not strip the handleIntent method.
-keepclassmembers class com.google.android.gms.gcm.GcmListenerService {
public void handleIntent(android.content.Intent);
}
################################################################################
# obj/third_party/android_deps/google_play_services_vision_common_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/google_play_services_vision_common_java/proguard.txt
# We keep all fields for every generated proto file as the runtime uses
# reflection over them that ProGuard cannot detect. Without this keep
# rule, fields may be removed that would cause runtime failures.
......@@ -778,9 +724,7 @@
<fields>;
}
################################################################################
# obj/third_party/android_deps/google_play_services_vision_java/proguard.txt
################################################################################
# File: obj/third_party/android_deps/google_play_services_vision_java/proguard.txt
# We keep all fields for every generated proto file as the runtime uses
# reflection over them that ProGuard cannot detect. Without this keep
# rule, fields may be removed that would cause runtime failures.
......@@ -788,9 +732,7 @@
<fields>;
}
################################################################################
# Dynamically generated from build/android/gyp/proguard.py
################################################################################
# File: //build/android/gyp/proguard.py (generated rules)
# THIS LINE WAS OMITTED
-keep @interface org.chromium.base.annotations.VerifiesOnNMR1
-if @org.chromium.base.annotations.VerifiesOnNMR1 class * {
......
......@@ -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