Skip to content

Commit

Permalink
Make the WebView apk build in the Chrome tree
Browse files Browse the repository at this point in the history
We checkout the Android WebView glue layer (frameworks/webview)
into a new third_party directory (android_webview_glue)
which is checked out via gclient.

This is built against a jar containing frameworks/base
(in android_platform/webview/frameworks.jar).

We have to work around a few other issues:
    - Change build/java_apk.gypi to bypass the hardcoded
      'src' path.
    - Move libwebviewchromium to an include so we can make both
      the prefixed and un-prefixed version in the same build.

BUG=391488
R=mkosiba@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#293921}
  • Loading branch information
chromy authored and Commit bot committed Sep 9, 2014
1 parent b73e078 commit aefb279
Show file tree
Hide file tree
Showing 13 changed files with 391 additions and 71 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ v8.log
/third_party/android_protobuf/src
/third_party/android_tools/
/third_party/android_tools_internal/
/third_party/android_webview_glue/src
/third_party/angle
/third_party/angle_dx11
/third_party/aosp
Expand Down
5 changes: 5 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@ deps_os = {
'src/third_party/android_protobuf/src':
Var('chromium_git') + '/external/android_protobuf.git' + '@' + '94f522f907e3f34f70d9e7816b947e62fddbb267',

# Whenever you roll this please also change frameworks/webview in
# src/android_webview/buildbot/aosp_manifest.xml to point to the same revision.
'src/third_party/android_webview_glue/src':
Var('chromium_git') + '/external/android_webview_glue.git' + '@' + 'e73e669ac73b2ddc042e380cd784ba8bd39ebb95',

'src/third_party/android_tools':
Var('chromium_git') + '/android_tools.git' + '@' + '7fc902d157a9aed7a2b68adc9c69181b3a43cd58',

Expand Down
2 changes: 1 addition & 1 deletion android_webview/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $(R_file_stamp): $(android_webview_resources_stamp)
include $(CLEAR_VARS)
LOCAL_MODULE := webviewchromium_pak
LOCAL_MODULE_STEM := webviewchromium
LOCAL_BUILT_MODULE_STEM := android_webview_apk/assets/webviewchromium.pak
LOCAL_BUILT_MODULE_STEM := android_webview_assets/webviewchromium.pak
include $(LOCAL_PATH)/webview_pak.mk

include $(CLEAR_VARS)
Expand Down
74 changes: 9 additions & 65 deletions android_webview/android_webview.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,6 @@
'chromium_code': 1,
},
'targets': [
{
'target_name': 'libwebviewchromium',
'type': 'shared_library',
'android_unmangled_name': 1,
'dependencies': [
'android_webview_common',
],
'conditions': [
# Avoid clashes between the versions of this library built with
# android_webview_build==1 by using a different name prefix.
[ 'android_webview_build==0', {
'product_prefix': 'libstandalone',
}],
[ 'android_webview_build==1', {
# When building inside the android tree we also need to depend on all
# the java sources generated from templates which will be needed by
# android_webview_java in android_webview/java_library_common.mk.
'dependencies': [
'../base/base.gyp:base_java_application_state',
'../base/base.gyp:base_java_memory_pressure_level_list',
'../content/content.gyp:content_gamepad_mapping',
'../content/content.gyp:gesture_event_type_java',
'../content/content.gyp:page_transition_types_java',
'../content/content.gyp:popup_item_type_java',
'../content/content.gyp:result_codes_java',
'../content/content.gyp:screen_orientation_values_java',
'../content/content.gyp:selection_event_type_java',
'../content/content.gyp:speech_recognition_error_java',
'../media/media.gyp:media_android_imageformat_list',
'../net/net.gyp:cert_verify_status_android_java',
'../net/net.gyp:certificate_mime_types_java',
'../net/net.gyp:net_errors_java',
'../net/net.gyp:private_key_types_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', {
# When not using the system skia there are linker warnings about
# overriden hidden symbols which there's no easy way to eliminate;
# disable them. http://crbug.com/157326
'ldflags': [
'-Wl,--no-fatal-warnings',
],
'ldflags!': [
'-Wl,--fatal-warnings',
],
}],
['android_webview_build==1 and use_system_stlport==1', {
# ICU requires RTTI, which is not present in the system's stlport, so
# we have to include gabi++. We can't include it in icu.gyp because
# link_settings cannot be used inside target_conditions. This will be
# removed once we stop using the system stlport.
# http://crbug.com/409851
'libraries': [
'-lgabi++',
],
}],
],
'sources': [
'lib/main/webview_entry_point.cc',
],
},
{
'target_name': 'android_webview_pak',
'type': 'none',
Expand All @@ -89,15 +26,15 @@
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak',
],
'pak_output': '<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
'pak_output': '<(PRODUCT_DIR)/android_webview_assets/webviewchromium.pak',
},
'includes': [ '../build/repack_action.gypi' ],
},
{
'action_name': 'add_en_US_pak_locale',
'variables': {
'pak_inputs': ['<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_en-US.pak'],
'pak_output': '<(PRODUCT_DIR)/android_webview_apk/assets/en-US.pak',
'pak_output': '<(PRODUCT_DIR)/android_webview_assets/en-US.pak',
},
'includes': [ '../build/repack_action.gypi' ],
}
Expand Down Expand Up @@ -277,11 +214,18 @@
'renderer/print_render_frame_observer.h',
],
},
{
'target_name': 'libwebviewchromium',
'includes': [
'libwebviewchromium.gypi',
],
}
],
'conditions': [
['android_webview_build==0', {
'includes': [
'android_webview_tests.gypi',
'../third_party/android_webview_glue/android_webview_glue.gypi',
],
'targets': [
{
Expand Down
14 changes: 11 additions & 3 deletions android_webview/android_webview_tests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'target_name': 'android_webview_apk',
'type': 'none',
'dependencies': [
'libwebviewchromium',
'libstandalonelibwebviewchromium',
'android_webview_java',
'android_webview_pak',
'libdrawgl',
Expand All @@ -20,8 +20,8 @@
'extensions_to_not_compress': 'pak',
'extra_native_libs': ['<(SHARED_LIB_DIR)/libdrawgl.>(android_product_extension)'],
'additional_input_paths': [
'<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
'<(PRODUCT_DIR)/android_webview_apk/assets/en-US.pak',
'<(PRODUCT_DIR)/android_webview_assets/webviewchromium.pak',
'<(PRODUCT_DIR)/android_webview_assets/en-US.pak',
'<(PRODUCT_DIR)/android_webview_apk/assets/asset_file.html',
'<(PRODUCT_DIR)/android_webview_apk/assets/cookie_test.html',
'<(PRODUCT_DIR)/android_webview_apk/assets/asset_icon.png',
Expand All @@ -39,6 +39,8 @@
{
'destination': '<(PRODUCT_DIR)/android_webview_apk/assets',
'files': [
'<(PRODUCT_DIR)/android_webview_assets/webviewchromium.pak',
'<(PRODUCT_DIR)/android_webview_assets/en-US.pak',
'<(java_in_dir)/assets/asset_file.html',
'<(java_in_dir)/assets/asset_icon.png',
'<(java_in_dir)/assets/cookie_test.html',
Expand Down Expand Up @@ -176,5 +178,11 @@
'../android_webview/test/shell/src/draw_gl/draw_gl.cc',
],
},
{
'target_name': 'libstandalonelibwebviewchromium',
'includes': [
'libwebviewchromium.gypi',
],
},
],
}
2 changes: 2 additions & 0 deletions android_webview/buildbot/aosp_manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<default remote="aosp"
sync-j="6" />

<!-- Whenever you roll this please also change frameworks/webview in DEPS to point to the
same revision. -->
<project name="platform/frameworks/webview" path="frameworks/webview" revision="8dc9a9d1217f84a7f9b0554f22a826394eabc856"/>

<project groups="device,flo" name="device/asus/deb" revision="0ce3a783d549d023ddc553a04fed717ffb2ff533"/>
Expand Down
61 changes: 61 additions & 0 deletions android_webview/libwebviewchromium.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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.
{
'type': 'shared_library',
'android_unmangled_name': 1,
'dependencies': [
'android_webview_common',
],
'conditions': [
[ 'android_webview_build==1', {
# When building inside the android tree we also need to depend on all
# the java sources generated from templates which will be needed by
# android_webview_java in android_webview/java_library_common.mk.
'dependencies': [
'../base/base.gyp:base_java_application_state',
'../base/base.gyp:base_java_memory_pressure_level_list',
'../content/content.gyp:content_gamepad_mapping',
'../content/content.gyp:gesture_event_type_java',
'../content/content.gyp:page_transition_types_java',
'../content/content.gyp:popup_item_type_java',
'../content/content.gyp:result_codes_java',
'../content/content.gyp:screen_orientation_values_java',
'../content/content.gyp:selection_event_type_java',
'../content/content.gyp:speech_recognition_error_java',
'../media/media.gyp:media_android_imageformat_list',
'../net/net.gyp:cert_verify_status_android_java',
'../net/net.gyp:certificate_mime_types_java',
'../net/net.gyp:net_errors_java',
'../net/net.gyp:private_key_types_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', {
# When not using the system skia there are linker warnings about
# overriden hidden symbols which there's no easy way to eliminate;
# disable them. http://crbug.com/157326
'ldflags': [
'-Wl,--no-fatal-warnings',
],
'ldflags!': [
'-Wl,--fatal-warnings',
],
}],
['android_webview_build==1 and use_system_stlport==1', {
# ICU requires RTTI, which is not present in the system's stlport, so
# we have to include gabi++. We can't include it in icu.gyp because
# link_settings cannot be used inside target_conditions. This will be
# removed once we stop using the system stlport.
# http://crbug.com/409851
'libraries': [
'-lgabi++',
],
}],
],
'sources': [
'lib/main/webview_entry_point.cc',
],
}

1 change: 1 addition & 0 deletions build/all.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'<@(android_app_targets)',
'android_builder_tests',
'../android_webview/android_webview.gyp:android_webview_apk',
'../android_webview/android_webview.gyp:system_webview_apk',
'../android_webview/android_webview_telemetry_shell.gyp:android_webview_telemetry_shell_apk',
'../chrome/chrome.gyp:chrome_shell_apk',
'../chrome/chrome.gyp:chrome_sync_shell_apk',
Expand Down
8 changes: 6 additions & 2 deletions build/java_apk.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
# code. This allows a test APK to inject a Linker.TestRunner instance at
# runtime. Should only be used by the chromium_linker_test_apk target!!
# never_lint - Set to 1 to not run lint on this target.
# java_in_dir_suffix - To override the /src suffix on java_in_dir.
# app_manifest_version_name - set the apps 'human readable' version number.
# app_manifest_version_code - set the apps version number.
{
'variables': {
'tested_apk_obfuscated_jar_path%': '/',
Expand Down Expand Up @@ -99,6 +102,7 @@
'lint_result': '<(intermediate_dir)/lint_result.xml',
'lint_config': '<(intermediate_dir)/lint_config.xml',
'never_lint%': 0,
'java_in_dir_suffix%': '/src',
'instr_stamp': '<(intermediate_dir)/instr.stamp',
'jar_stamp': '<(intermediate_dir)/jar.stamp',
'obfuscate_stamp': '<(intermediate_dir)/obfuscate.stamp',
Expand Down Expand Up @@ -605,7 +609,7 @@
# Java files instead of using find. (As is, this will be broken if two
# targets use the same java_in_dir and both use java_apk.gypi or
# both use java.gypi.)
'java_sources': ['>!@(find >(java_in_dir)/src >(additional_src_dirs) -name "*.java" # apk)'],
'java_sources': ['>!@(find >(java_in_dir)>(java_in_dir_suffix) >(additional_src_dirs) -name "*.java" # apk)'],

},
'inputs': [
Expand Down Expand Up @@ -657,7 +661,7 @@
{
'variables': {
'src_dirs': [
'<(java_in_dir)/src',
'<(java_in_dir)<(java_in_dir_suffix)',
'>@(additional_src_dirs)',
],
'lint_jar_path': '<(jar_path)',
Expand Down
Loading

0 comments on commit aefb279

Please sign in to comment.