Revert of Add creation of v14 compatible resources to process_resources.py (https://codereview.chromium.org/321453002/)

Reason for revert:
This is causing instrumentation-yakju-clankium-tot and clang-clankium-tot-builder (downstream) to fail with the following error message:

FAILED: cd ../../clank/native/framework; python ../../../build/android/gyp/process_resources.py --android-sdk /b/build/slave/instrumentation-yakju-clankium-tot/build/src/third_party/android_tools/sdk//platforms/android-19 --android-sdk-tools /b/build/slave/instrumentation-yakju-clankium-tot/build/src/third_party/android_tools/sdk//build-tools/19.0.0 --android-manifest ../../../clank/java/apps/deviceextras/AndroidManifest.xml --dependencies-res-dirs "" --extra-res-packages "" --extra-r-text-files "" --proguard-file ../../../out/Debug/device_extras_apk/proguard.txt --resource-dir ../../../clank/java/apps/deviceextras/res --res-v14-compatibility-dir ../../../out/Debug/device_extras_apk/res_v14_compatibility --crunch-output-dir ../../../out/Debug/device_extras_apk/res --R-dir ../../../out/Debug/device_extras_apk/gen --stamp ../../../out/Debug/device_extras_apk/codegen.stamp
Traceback (most recent call last):
  File "../../../build/android/gyp/process_resources.py", line 217, in <module>
    main()
  File "../../../build/android/gyp/process_resources.py", line 166, in main
    options.v14_verify_only)
  File "/b/build/slave/instrumentation-yakju-clankium-tot/build/src/build/android/gyp/generate_v14_compatible_resources.py", line 335, in GenerateV14Resources
    ErrorIfStyleResourceExistsInDir(input_dir)
  File "/b/build/slave/instrumentation-yakju-clankium-tot/build/src/build/android/gyp/generate_v14_compatible_resources.py", line 107, in ErrorIfStyleResourceExistsInDir
    '-v17 directory. Please refer to '
Exception: error: style file /b/build/slave/instrumentation-yakju-clankium-tot/build/src/clank/java/apps/deviceextras/res/values/styles.xml should be under /b/build/slave/instrumentation-yakju-clankium-tot/build/src/clank/java/apps/deviceextras/res/values-v17 directory. Please refer to http://crbug.com/243952 for the details.

I don't know resource loading well enough to tell if that's a legitimate issue or not; so for now reverting this to fix the build bots, and if it is a legitimate issue then ideally it could be fixed before relanding this?

Original issue's description:
> Add creation of v14 compatible resources to process_resources.py
> 
> There are a lot of steps in processing resources and preparing them for
> packaging. It will be easier if these are all done by the same script.
> 
> BUG=375431,359249
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=275401

TBR=newt@chromium.org,cjhopman@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=375431,359249

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

git-svn-id: http://src.chromium.org/svn/trunk/src/build@275436 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
johnme@chromium.org 2014-06-06 14:23:28 +00:00
Родитель 8795e5b881
Коммит 3a21696293
5 изменённых файлов: 53 добавлений и 56 удалений

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

@ -280,12 +280,15 @@ def ParseArgs():
build_utils.CheckOptions(options, parser, required=required_options)
return options
def GenerateV14Resources(res_dir, res_v14_dir, verify_only):
build_utils.DeleteDirectory(res_v14_dir)
build_utils.MakeDirectory(res_v14_dir)
for name in os.listdir(res_dir):
if not os.path.isdir(os.path.join(res_dir, name)):
def main():
options = ParseArgs()
build_utils.DeleteDirectory(options.res_v14_compatibility_dir)
build_utils.MakeDirectory(options.res_v14_compatibility_dir)
for name in os.listdir(options.res_dir):
if not os.path.isdir(os.path.join(options.res_dir, name)):
continue
dir_pieces = name.split('-')
@ -304,9 +307,9 @@ def GenerateV14Resources(res_dir, res_v14_dir, verify_only):
if 'ldrtl' in qualifiers:
continue
input_dir = os.path.abspath(os.path.join(res_dir, name))
input_dir = os.path.abspath(os.path.join(options.res_dir, name))
if verify_only:
if options.verify_only:
if not api_level_qualifier or int(api_level_qualifier[1:]) < 17:
VerifyV14ResourcesInDir(input_dir, resource_type)
else:
@ -314,8 +317,9 @@ def GenerateV14Resources(res_dir, res_v14_dir, verify_only):
else:
# We also need to copy the original v17 resource to *-v17 directory
# because the generated v14 resource will hide the original resource.
output_v14_dir = os.path.join(res_v14_dir, name)
output_v17_dir = os.path.join(res_v14_dir, name + '-v17')
output_v14_dir = os.path.join(options.res_v14_compatibility_dir, name)
output_v17_dir = os.path.join(options.res_v14_compatibility_dir, name +
'-v17')
# We only convert layout resources under layout*/, xml*/,
# and style resources under values*/.
@ -327,19 +331,13 @@ def GenerateV14Resources(res_dir, res_v14_dir, verify_only):
if api_level_qualifier == 'v17':
output_qualifiers = qualifiers[:]
del output_qualifiers[api_level_qualifier_index]
output_v14_dir = os.path.join(res_v14_dir,
output_v14_dir = os.path.join(options.res_v14_compatibility_dir,
'-'.join([resource_type] +
output_qualifiers))
GenerateV14StyleResourcesInDir(input_dir, output_v14_dir)
elif not api_level_qualifier:
ErrorIfStyleResourceExistsInDir(input_dir)
def main():
options = ParseArgs()
GenerateV14Resources(
options.res_dir, options.res_v14_compatibility_dir, options.verify_only)
if options.stamp:
build_utils.Touch(options.stamp)

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

@ -4,11 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Process Android resources to generate R.java, and prepare for packaging.
This will crunch images and generate v14 compatible resources
(see generate_v14_compatible_resources.py).
"""
"""Process Android library resources to generate R.java and crunched images."""
import optparse
import os
@ -16,8 +12,6 @@ import re
import shlex
import shutil
import generate_v14_compatible_resources
from util import build_utils
def ParseArgs():
@ -42,16 +36,7 @@ def ParseArgs():
parser.add_option('--android-manifest', help='AndroidManifest.xml path')
parser.add_option('--proguard-file',
help='Path to proguard.txt generated file')
parser.add_option('--res-v14-compatibility-dir',
help='output directory into which '
'v14 compatible resources will be generated')
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('--stamp', help='File to touch on success')
parser.add_option(
'--extra-res-packages',
@ -62,8 +47,6 @@ def ParseArgs():
'list of resources to be included in the R.java file in the format '
'generated by aapt')
parser.add_option('--stamp', help='File to touch on success')
(options, args) = parser.parse_args()
if args:
@ -78,7 +61,6 @@ def ParseArgs():
'resource_dir',
'crunch_output_dir',
'R_dir',
'res_v14_compatibility_dir',
)
build_utils.CheckOptions(options, parser, required=required_options)
@ -160,11 +142,6 @@ def main():
build_utils.DeleteDirectory(options.R_dir)
build_utils.MakeDirectory(options.R_dir)
generate_v14_compatible_resources.GenerateV14Resources(
options.resource_dir,
options.res_v14_compatibility_dir,
options.v14_verify_only)
# Generate R.java. This R.java contains non-final constants and is used only
# while compiling the library jar (e.g. chromium_content.jar). When building
# an apk, a new R.java file with the correct resource -> ID mappings will be

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

@ -10,7 +10,7 @@
# It would be really nice to do this with a rule instead of actions, but it
# would need to determine inputs and outputs via grit_info on a per-file
# basis. GYP rules don't currently support that. They could be extended to
# basis. GYP rules dont currently support that. They could be extended to
# do this, but then every generator would need to be updated to handle this.
{

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

@ -111,6 +111,7 @@
'variables': {
'res_dir': '<(java_in_dir)/res',
'res_crunched_dir': '<(intermediate_dir)/res_crunched',
'res_v14_compatibility_stamp': '<(intermediate_dir)/res_v14_compatibility.stamp',
'res_v14_compatibility_dir': '<(intermediate_dir)/res_v14_compatibility',
'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'],
'resource_input_paths': ['<!@(find <(res_dir) -type f)'],
@ -118,7 +119,8 @@
'R_text_file': '<(R_dir)/R.txt',
'R_stamp': '<(intermediate_dir)/resources.stamp',
'generated_src_dirs': ['<(R_dir)'],
'additional_input_paths': ['<(R_stamp)', ],
'additional_input_paths': ['<(R_stamp)',
'<(res_v14_compatibility_stamp)',],
'additional_res_dirs': [],
'dependencies_res_input_dirs': [],
'dependencies_res_files': [],
@ -129,7 +131,8 @@
# generated_R_dirs and include its resources via
# dependencies_res_files.
'generated_R_dirs': ['<(R_dir)'],
'additional_input_paths': ['<(R_stamp)', ],
'additional_input_paths': ['<(R_stamp)',
'<(res_v14_compatibility_stamp)',],
'dependencies_res_files': ['<@(resource_input_paths)'],
'dependencies_res_input_dirs': ['<@(res_input_dirs)'],
@ -162,18 +165,11 @@
'>@(dependencies_res_input_dirs)',],
# Write the inputs list to a file, so that its mtime is updated when
# the list of inputs changes.
'inputs_list_file': '>|(java_resources.<(_target_name).gypcmd >@(resource_input_paths) >@(dependencies_res_files))',
'process_resources_options': [],
'conditions': [
['res_v14_verify_only == 1', {
'process_resources_options': ['--v14-verify-only']
}],
],
'inputs_list_file': '>|(java_resources.<(_target_name).gypcmd >@(resource_input_paths) >@(dependencies_res_files))'
},
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/process_resources.py',
'<(DEPTH)/build/android/gyp/generate_v14_compatible_resources.py',
'>@(resource_input_paths)',
'>@(dependencies_res_files)',
'>(inputs_list_file)',
@ -188,15 +184,43 @@
'--R-dir', '<(R_dir)',
'--dependencies-res-dirs', '>(dependencies_res_dirs)',
'--resource-dir', '<(res_dir)',
'--res-v14-compatibility-dir', '<(res_v14_compatibility_dir)',
'--crunch-output-dir', '<(res_crunched_dir)',
'--android-manifest', '<(android_manifest)',
'--non-constant-id',
'--custom-package', '<(R_package)',
'--stamp', '<(R_stamp)',
'<@(process_resources_options)',
],
},
# Generate API 14 resources.
{
'action_name': 'generate_api_14_resources_<(_target_name)',
'message': 'Generating Android API 14 resources <(_target_name)',
'variables' : {
'res_v14_additional_options': [],
},
'conditions': [
['res_v14_verify_only == 1', {
'variables': {
'res_v14_additional_options': ['--verify-only']
},
}],
],
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/generate_v14_compatible_resources.py',
'>@(resource_input_paths)',
],
'outputs': [
'<(res_v14_compatibility_stamp)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/generate_v14_compatible_resources.py',
'--res-dir=<(res_dir)',
'--res-v14-compatibility-dir=<(res_v14_compatibility_dir)',
'--stamp', '<(res_v14_compatibility_stamp)',
'<@(res_v14_additional_options)',
]
},
],
}],
['proguard_preprocess == 1', {

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

@ -65,7 +65,6 @@
'proguard_flags_paths': ['<(generated_proguard_file)'],
'jar_name': 'chromium_apk_<(_target_name).jar',
'resource_dir%':'<(DEPTH)/build/android/ant/empty/res',
'res_v14_compatibility_dir': '<(intermediate_dir)/res_v14_compatibility',
'R_package%':'',
'additional_R_text_files': [],
'additional_res_dirs': [],
@ -480,7 +479,6 @@
'--proguard-file', '<(generated_proguard_file)',
'--resource-dir', '<(resource_dir)',
'--res-v14-compatibility-dir', '<(res_v14_compatibility_dir)',
'--crunch-output-dir', '<(crunch_output_dir)',
'--R-dir', '<(intermediate_dir)/gen',