Commit 6edecc8c authored by kkimlabs's avatar kkimlabs Committed by Commit bot

[Android] Remove v14 resource verification entirely.

BUG=487391

Review URL: https://codereview.chromium.org/1136273003

Cr-Commit-Position: refs/heads/master@{#330439}
parent e2ed8aaf
...@@ -231,36 +231,6 @@ def GenerateV14StyleResourcesInDir(input_dir, output_v14_dir): ...@@ -231,36 +231,6 @@ def GenerateV14StyleResourcesInDir(input_dir, output_v14_dir):
GenerateV14StyleResource(input_filename, output_v14_filename) GenerateV14StyleResource(input_filename, output_v14_filename)
def VerifyV14ResourcesInDir(input_dir, resource_type):
"""Verify that the resources in input_dir is compatible with v14, i.e., they
don't use attributes that cause crashes on certain devices. Print an error if
they have."""
for input_filename in build_utils.FindInDirectory(input_dir, '*.xml'):
exception_message = ('error : ' + input_filename + ' has an RTL attribute, '
'i.e., attribute that has "start" or "end" in its name.'
' Pre-v17 resources should not include it because it '
'can cause crashes on certain devices. Please refer to '
'http://crbug.com/243952 for the details.')
dom = ParseAndReportErrors(input_filename)
if resource_type in ('layout', 'xml'):
if GenerateV14LayoutResourceDom(dom, input_filename, False):
raise Exception(exception_message)
elif resource_type == 'values':
if GenerateV14StyleResourceDom(dom, input_filename, False):
raise Exception(exception_message)
def AssertNoDeprecatedAttributesInDir(input_dir, resource_type):
"""Raises an exception if resources in input_dir have deprecated attributes,
e.g., paddingLeft, paddingRight"""
for input_filename in build_utils.FindInDirectory(input_dir, '*.xml'):
dom = ParseAndReportErrors(input_filename)
if resource_type in ('layout', 'xml'):
GenerateV14LayoutResourceDom(dom, input_filename)
elif resource_type == 'values':
GenerateV14StyleResourceDom(dom, input_filename)
def ParseArgs(): def ParseArgs():
"""Parses command line options. """Parses command line options.
...@@ -275,10 +245,6 @@ def ParseArgs(): ...@@ -275,10 +245,6 @@ def ParseArgs():
help='output directory into which ' help='output directory into which '
'v14 compatible resources will be generated') 'v14 compatible resources will be generated')
parser.add_option('--stamp', help='File to touch on success') parser.add_option('--stamp', help='File to touch on success')
parser.add_option('--verify-only', action="store_true", help='Do not generate'
' v14 resources. Instead, just verify that the resources are already '
"compatible with v14, i.e. they don't use attributes that cause crashes "
'on certain devices.')
options, args = parser.parse_args() options, args = parser.parse_args()
...@@ -290,7 +256,7 @@ def ParseArgs(): ...@@ -290,7 +256,7 @@ def ParseArgs():
build_utils.CheckOptions(options, parser, required=required_options) build_utils.CheckOptions(options, parser, required=required_options)
return options return options
def GenerateV14Resources(res_dir, res_v14_dir, verify_only): def GenerateV14Resources(res_dir, res_v14_dir):
for name in os.listdir(res_dir): for name in os.listdir(res_dir):
if not os.path.isdir(os.path.join(res_dir, name)): if not os.path.isdir(os.path.join(res_dir, name)):
continue continue
...@@ -313,33 +279,27 @@ def GenerateV14Resources(res_dir, res_v14_dir, verify_only): ...@@ -313,33 +279,27 @@ def GenerateV14Resources(res_dir, res_v14_dir, verify_only):
input_dir = os.path.abspath(os.path.join(res_dir, name)) input_dir = os.path.abspath(os.path.join(res_dir, name))
if verify_only: # We also need to copy the original v17 resource to *-v17 directory
if not api_level_qualifier or int(api_level_qualifier[1:]) < 17: # because the generated v14 resource will hide the original resource.
VerifyV14ResourcesInDir(input_dir, resource_type) output_v14_dir = os.path.join(res_v14_dir, name)
else: output_v17_dir = os.path.join(res_v14_dir, name + '-v17')
AssertNoDeprecatedAttributesInDir(input_dir, resource_type)
else: # We only convert layout resources under layout*/, xml*/,
# We also need to copy the original v17 resource to *-v17 directory # and style resources under values*/.
# because the generated v14 resource will hide the original resource. if resource_type in ('layout', 'xml'):
output_v14_dir = os.path.join(res_v14_dir, name) if not api_level_qualifier:
output_v17_dir = os.path.join(res_v14_dir, name + '-v17') GenerateV14LayoutResourcesInDir(input_dir, output_v14_dir,
output_v17_dir)
# We only convert layout resources under layout*/, xml*/, elif resource_type == 'values':
# and style resources under values*/. if api_level_qualifier == 'v17':
if resource_type in ('layout', 'xml'): output_qualifiers = qualifiers[:]
if not api_level_qualifier: del output_qualifiers[api_level_qualifier_index]
GenerateV14LayoutResourcesInDir(input_dir, output_v14_dir, output_v14_dir = os.path.join(res_v14_dir,
output_v17_dir) '-'.join([resource_type] +
elif resource_type == 'values': output_qualifiers))
if api_level_qualifier == 'v17': GenerateV14StyleResourcesInDir(input_dir, output_v14_dir)
output_qualifiers = qualifiers[:] elif not api_level_qualifier:
del output_qualifiers[api_level_qualifier_index] ErrorIfStyleResourceExistsInDir(input_dir)
output_v14_dir = os.path.join(res_v14_dir,
'-'.join([resource_type] +
output_qualifiers))
GenerateV14StyleResourcesInDir(input_dir, output_v14_dir)
elif not api_level_qualifier:
ErrorIfStyleResourceExistsInDir(input_dir)
def main(): def main():
options = ParseArgs() options = ParseArgs()
...@@ -349,7 +309,7 @@ def main(): ...@@ -349,7 +309,7 @@ def main():
build_utils.DeleteDirectory(res_v14_dir) build_utils.DeleteDirectory(res_v14_dir)
build_utils.MakeDirectory(res_v14_dir) build_utils.MakeDirectory(res_v14_dir)
GenerateV14Resources(options.res_dir, res_v14_dir, options.verify_only) GenerateV14Resources(options.res_dir, res_v14_dir)
if options.stamp: if options.stamp:
build_utils.Touch(options.stamp) build_utils.Touch(options.stamp)
......
...@@ -68,12 +68,6 @@ def ParseArgs(args): ...@@ -68,12 +68,6 @@ def ParseArgs(args):
parser.add_option('--proguard-file', parser.add_option('--proguard-file',
help='Path to proguard.txt generated file') help='Path to proguard.txt generated file')
parser.add_option(
'--v14-verify-only',
action='store_true',
help='Do not generate v14 resources. Instead, just verify that the '
'resources are already compatible with v14, i.e. they don\'t use '
'attributes that cause crashes on certain devices.')
parser.add_option( parser.add_option(
'--v14-skip', '--v14-skip',
action="store_true", action="store_true",
...@@ -328,8 +322,7 @@ def main(): ...@@ -328,8 +322,7 @@ def main():
for resource_dir in input_resource_dirs: for resource_dir in input_resource_dirs:
generate_v14_compatible_resources.GenerateV14Resources( generate_v14_compatible_resources.GenerateV14Resources(
resource_dir, resource_dir,
v14_dir, v14_dir)
options.v14_verify_only)
dep_zips = build_utils.ParseGypList(options.dependencies_res_zips) dep_zips = build_utils.ParseGypList(options.dependencies_res_zips)
input_files += dep_zips input_files += dep_zips
......
...@@ -1100,10 +1100,6 @@ template("process_resources") { ...@@ -1100,10 +1100,6 @@ template("process_resources") {
] ]
} }
if (defined(invoker.v14_verify_only) && invoker.v14_verify_only) {
args += [ "--v14-verify-only" ]
}
if (defined(invoker.v14_skip) && invoker.v14_skip) { if (defined(invoker.v14_skip) && invoker.v14_skip) {
args += [ "--v14-skip" ] args += [ "--v14-skip" ]
} }
......
...@@ -523,10 +523,9 @@ template("jinja_template_resources") { ...@@ -523,10 +523,9 @@ template("jinja_template_resources") {
# android_manifest: AndroidManifest.xml for this target. Defaults to # android_manifest: AndroidManifest.xml for this target. Defaults to
# //build/android/AndroidManifest.xml. # //build/android/AndroidManifest.xml.
# custom_package: java package for generated .java files. # custom_package: java package for generated .java files.
# v14_verify_only: If true, don't generate v14/v17 resources and just verify # v14_skip: If true, don't run v14 resource generator on this. Defaults to
# that the resources are v14-compliant (see # false. (see build/android/gyp/generate_v14_compatible_resources.py)
# build/android/gyp/generate_v14_compatible_resources.py). Defaults to #
# false.
# shared_resources: If true make a resource package that can be loaded by a # shared_resources: If true make a resource package that can be loaded by a
# different application at runtime to access the package's resources. # different application at runtime to access the package's resources.
# #
...@@ -579,10 +578,6 @@ template("android_resources") { ...@@ -579,10 +578,6 @@ template("android_resources") {
custom_package = invoker.custom_package custom_package = invoker.custom_package
} }
if (defined(invoker.v14_verify_only)) {
v14_verify_only = invoker.v14_verify_only
}
if (defined(invoker.v14_skip)) { if (defined(invoker.v14_skip)) {
v14_skip = invoker.v14_skip v14_skip = invoker.v14_skip
} }
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
'res_extra_dirs': [], 'res_extra_dirs': [],
'res_extra_files': [], 'res_extra_files': [],
'res_v14_skip%': 0, 'res_v14_skip%': 0,
'res_v14_verify_only%': 0,
'resource_input_paths': ['>@(res_extra_files)'], 'resource_input_paths': ['>@(res_extra_files)'],
'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', 'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)',
'compile_stamp': '<(intermediate_dir)/compile.stamp', 'compile_stamp': '<(intermediate_dir)/compile.stamp',
...@@ -161,9 +160,6 @@ ...@@ -161,9 +160,6 @@
['res_v14_skip == 1', { ['res_v14_skip == 1', {
'process_resources_options': ['--v14-skip'] 'process_resources_options': ['--v14-skip']
}], }],
['res_v14_verify_only == 1', {
'process_resources_options': ['--v14-verify-only']
}],
], ],
}, },
'inputs': [ 'inputs': [
......
...@@ -139,7 +139,6 @@ ...@@ -139,7 +139,6 @@
'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh', 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh',
'create_standalone_apk%': 1, 'create_standalone_apk%': 1,
'res_v14_skip%': 0, 'res_v14_skip%': 0,
'res_v14_verify_only%': 0,
'variables': { 'variables': {
'variables': { 'variables': {
'native_lib_target%': '', 'native_lib_target%': '',
...@@ -608,9 +607,6 @@ ...@@ -608,9 +607,6 @@
['res_v14_skip == 1', { ['res_v14_skip == 1', {
'process_resources_options+': ['--v14-skip'] 'process_resources_options+': ['--v14-skip']
}], }],
['res_v14_verify_only == 1', {
'process_resources_options+': ['--v14-verify-only']
}],
['shared_resources == 1', { ['shared_resources == 1', {
'process_resources_options+': ['--shared-resources'] 'process_resources_options+': ['--shared-resources']
}], }],
......
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