Commit e8b5abf6 authored by mkosiba@chromium.org's avatar mkosiba@chromium.org

[android] Generate strings.xml for android_webview.

This makes it possible for the android_webview component to generate
strings.xml files from .grd files in the android_webview_build
configuration.

BUG=internal b/11505352
TESTS=compile
TBR=jochen@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269779 0039d316-1c4b-4281-b951-d872f2087c98
parent f9573ec9
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
'../content/content.gyp:screen_orientation_values_java', '../content/content.gyp:screen_orientation_values_java',
'../content/content.gyp:speech_recognition_error_java', '../content/content.gyp:speech_recognition_error_java',
'../media/media.gyp:media_android_imageformat_list', '../media/media.gyp:media_android_imageformat_list',
'../net/net.gyp:certificate_mime_types_java',
'../net/net.gyp:cert_verify_status_android_java', '../net/net.gyp:cert_verify_status_android_java',
'../net/net.gyp:certificate_mime_types_java',
'../net/net.gyp:net_errors_java', '../net/net.gyp:net_errors_java',
'../net/net.gyp:private_key_types_java', '../net/net.gyp:private_key_types_java',
'../ui/android/ui_android.gyp:window_open_disposition_java',
'../ui/android/ui_android.gyp:bitmap_format_java', '../ui/android/ui_android.gyp:bitmap_format_java',
'../ui/android/ui_android.gyp:window_open_disposition_java',
], ],
}], }],
[ 'android_webview_build==1 and use_system_skia==0', { [ 'android_webview_build==1 and use_system_skia==0', {
...@@ -256,6 +256,18 @@ ...@@ -256,6 +256,18 @@
'includes': [ '../build/java.gypi' ], 'includes': [ '../build/java.gypi' ],
}, },
], ],
}, { # android_webview_build==1
'targets': [
{
'target_name': 'android_webview_strings',
'type': 'none',
'android_unmangled_name': 1,
'dependencies': [
'../content/content.gyp:content_strings_grd',
'../ui/android/ui_android.gyp:ui_strings_grd',
],
},
],
}], }],
], ],
} }
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
# R_package - The java package in which the R class (which maps resources to # R_package - The java package in which the R class (which maps resources to
# integer IDs) should be generated, e.g. org.chromium.content. # integer IDs) should be generated, e.g. org.chromium.content.
# R_package_relpath - Same as R_package, but replace each '.' with '/'. # R_package_relpath - Same as R_package, but replace each '.' with '/'.
# java_strings_grd - The name of the grd file from which to generate localized
# strings.xml files, if any.
# res_extra_dirs - A list of extra directories containing Android resources. # res_extra_dirs - A list of extra directories containing Android resources.
# These directories may be generated at build time. # These directories may be generated at build time.
# res_extra_files - A list of the files in res_extra_dirs. # res_extra_files - A list of the files in res_extra_dirs.
...@@ -66,7 +64,6 @@ ...@@ -66,7 +64,6 @@
'generated_src_dirs': ['>@(generated_R_dirs)'], 'generated_src_dirs': ['>@(generated_R_dirs)'],
'generated_R_dirs': [], 'generated_R_dirs': [],
'has_java_resources%': 0, 'has_java_resources%': 0,
'java_strings_grd%': '',
'res_extra_dirs': [], 'res_extra_dirs': [],
'res_extra_files': [], 'res_extra_files': [],
'res_v14_verify_only%': 0, 'res_v14_verify_only%': 0,
...@@ -150,28 +147,6 @@ ...@@ -150,28 +147,6 @@
'additional_R_text_files': ['<(R_text_file)'], 'additional_R_text_files': ['<(R_text_file)'],
}, },
}, },
'conditions': [
['java_strings_grd != ""', {
'variables': {
'res_grit_dir': '<(intermediate_dir)/res_grit',
'res_input_dirs': ['<(res_grit_dir)'],
'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)',
'resource_input_paths': ['<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))'],
},
'actions': [
{
'action_name': 'generate_localized_strings_xml',
'variables': {
'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'],
'grit_out_dir': '<(res_grit_dir)',
# resource_ids is unneeded since we don't generate .h headers.
'grit_resource_ids': '',
},
'includes': ['../build/grit_action.gypi'],
},
],
}],
],
'actions': [ 'actions': [
# Generate R.java and crunch image resources. # Generate R.java and crunch image resources.
{ {
......
...@@ -44,8 +44,6 @@ ...@@ -44,8 +44,6 @@
# resource_dir - The directory for resources. # resource_dir - The directory for resources.
# R_package - A custom Java package to generate the resource file R.java in. # R_package - A custom Java package to generate the resource file R.java in.
# By default, the package given in AndroidManifest.xml will be used. # By default, the package given in AndroidManifest.xml will be used.
# java_strings_grd - The name of the grd file from which to generate localized
# strings.xml files, if any.
# use_chromium_linker - Enable the content dynamic linker that allows sharing the # use_chromium_linker - Enable the content dynamic linker that allows sharing the
# RELRO section of the native libraries between the different processes. # RELRO section of the native libraries between the different processes.
# enable_chromium_linker_tests - Enable the content dynamic linker test support # enable_chromium_linker_tests - Enable the content dynamic linker test support
...@@ -70,7 +68,6 @@ ...@@ -70,7 +68,6 @@
'additional_res_dirs': [], 'additional_res_dirs': [],
'additional_res_packages': [], 'additional_res_packages': [],
'is_test_apk%': 0, 'is_test_apk%': 0,
'java_strings_grd%': '',
'resource_input_paths': [], 'resource_input_paths': [],
'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)', 'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
'asset_location%': '<(intermediate_dir)/assets', 'asset_location%': '<(intermediate_dir)/assets',
...@@ -393,29 +390,6 @@ ...@@ -393,29 +390,6 @@
}, },
], ],
}], }],
['java_strings_grd != ""', {
'variables': {
'res_grit_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)_apk/res_grit',
'additional_res_dirs': ['<(res_grit_dir)'],
# grit_grd_file is used by grit_action.gypi, included below.
'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)',
'resource_input_paths': [
'<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))'
],
},
'actions': [
{
'action_name': 'generate_localized_strings_xml',
'variables': {
'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'],
'grit_out_dir': '<(res_grit_dir)',
# resource_ids is unneeded since we don't generate .h headers.
'grit_resource_ids': '',
},
'includes': ['../build/grit_action.gypi'],
},
],
}],
['gyp_managed_install == 1', { ['gyp_managed_install == 1', {
'actions': [ 'actions': [
{ {
......
# Copyright 2014 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.
# This file is meant to be included into a target to provide a rule
# to generate localized strings.xml from a grd file.
#
# To use this, create a gyp target with the following form:
# {
# 'target_name': 'my-package_strings_grd',
# 'type': 'none',
# 'variables': {
# 'grd_file': 'path/to/grd/file',
# },
# 'includes': ['path/to/this/gypi/file'],
# }
#
# Required variables:
# grd_file - The path to the grd file to use.
{
'variables': {
'intermediate_dir': '<(PRODUCT_DIR)/<(_target_name)',
'res_grit_dir': '<(intermediate_dir)/res_grit',
'grit_grd_file': '<(grd_file)',
'resource_input_paths': [
'<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grd_file))'
],
},
'all_dependent_settings': {
'variables': {
'additional_res_dirs': ['<@(res_grit_dir)'],
'dependencies_res_files': ['<@(resource_input_paths)'],
'dependencies_res_input_dirs': ['<@(res_grit_dir)'],
},
},
'actions': [
{
'action_name': 'generate_localized_strings_xml',
'variables': {
'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'],
'grit_out_dir': '<(res_grit_dir)',
# resource_ids is unneeded since we don't generate .h headers.
'grit_resource_ids': '',
},
'includes': ['../build/grit_action.gypi'],
},
],
}
...@@ -726,6 +726,7 @@ ...@@ -726,6 +726,7 @@
'activity_type_ids_java', 'activity_type_ids_java',
'app_banner_metrics_ids_java', 'app_banner_metrics_ids_java',
'chrome_resources.gyp:chrome_strings', 'chrome_resources.gyp:chrome_strings',
'chrome_strings_grd',
'profile_sync_service_model_type_selection_java', 'profile_sync_service_model_type_selection_java',
'resource_id_java', 'resource_id_java',
'toolbar_model_security_levels_java', 'toolbar_model_security_levels_java',
...@@ -747,7 +748,6 @@ ...@@ -747,7 +748,6 @@
'has_java_resources': 1, 'has_java_resources': 1,
'R_package': 'org.chromium.chrome', 'R_package': 'org.chromium.chrome',
'R_package_relpath': 'org/chromium/chrome', 'R_package_relpath': 'org/chromium/chrome',
'java_strings_grd': 'android_chrome_strings.grd',
# Include xml string files generated from generated_resources.grd # Include xml string files generated from generated_resources.grd
'res_extra_dirs': ['<(SHARED_INTERMEDIATE_DIR)/chrome/java/res'], 'res_extra_dirs': ['<(SHARED_INTERMEDIATE_DIR)/chrome/java/res'],
'res_extra_files': ['<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(SHARED_INTERMEDIATE_DIR)/chrome" app/generated_resources.grd)'], 'res_extra_files': ['<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(SHARED_INTERMEDIATE_DIR)/chrome" app/generated_resources.grd)'],
...@@ -756,6 +756,16 @@ ...@@ -756,6 +756,16 @@
'../build/java.gypi', '../build/java.gypi',
], ],
}, },
{
'target_name': 'chrome_strings_grd',
'type': 'none',
'variables': {
'grd_file': '../chrome/android/java/strings/android_chrome_strings.grd',
},
'includes': [
'../build/java_strings_grd.gypi',
],
},
], # 'targets' ], # 'targets'
'includes': [ 'includes': [
'chrome_android.gypi', 'chrome_android.gypi',
......
...@@ -421,6 +421,7 @@ ...@@ -421,6 +421,7 @@
'../ui/android/ui_android.gyp:ui_java', '../ui/android/ui_android.gyp:ui_java',
'common_aidl', 'common_aidl',
'content_common', 'content_common',
'content_strings_grd',
'gesture_event_type_java', 'gesture_event_type_java',
'page_transition_types_java', 'page_transition_types_java',
'popup_item_type_java', 'popup_item_type_java',
...@@ -434,7 +435,6 @@ ...@@ -434,7 +435,6 @@
'has_java_resources': 1, 'has_java_resources': 1,
'R_package': 'org.chromium.content', 'R_package': 'org.chromium.content',
'R_package_relpath': 'org/chromium/content', 'R_package_relpath': 'org/chromium/content',
'java_strings_grd': 'android_content_strings.grd',
}, },
'conditions': [ 'conditions': [
['android_webview_build == 0', { ['android_webview_build == 0', {
...@@ -446,6 +446,16 @@ ...@@ -446,6 +446,16 @@
], ],
'includes': [ '../build/java.gypi' ], 'includes': [ '../build/java.gypi' ],
}, },
{
'target_name': 'content_strings_grd',
'type': 'none',
'variables': {
'grd_file': '../content/public/android/java/strings/android_content_strings.grd',
},
'includes': [
'../build/java_strings_grd.gypi',
],
},
{ {
'target_name': 'gesture_event_type_java', 'target_name': 'gesture_event_type_java',
'type': 'none', 'type': 'none',
......
...@@ -39,14 +39,24 @@ ...@@ -39,14 +39,24 @@
'has_java_resources': 1, 'has_java_resources': 1,
'R_package': 'org.chromium.ui', 'R_package': 'org.chromium.ui',
'R_package_relpath': 'org/chromium/ui', 'R_package_relpath': 'org/chromium/ui',
'java_strings_grd': 'android_ui_strings.grd',
}, },
'dependencies': [ 'dependencies': [
'../../base/base.gyp:base_java', '../../base/base.gyp:base_java',
'window_open_disposition_java',
'bitmap_format_java', 'bitmap_format_java',
'ui_strings_grd',
'window_open_disposition_java',
], ],
'includes': [ '../../build/java.gypi' ], 'includes': [ '../../build/java.gypi' ],
}, },
{
'target_name': 'ui_strings_grd',
'type': 'none',
'variables': {
'grd_file': '../../ui/android/java/strings/android_ui_strings.grd',
},
'includes': [
'../../build/java_strings_grd.gypi',
],
},
], ],
} }
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