Commit bef92b91 authored by Torne (Richard Coles)'s avatar Torne (Richard Coles) Committed by Commit Bot

Define basic Trichrome build targets.

This defines basic build targets for a Trichrome build using the
upstream package names/configuration. The shared library APK contains
the 32-bit version of libmonochrome.so and a few autogenerated Java
pieces only at this stage, which means the total size of the three APKs
is significantly larger than Monochrome at present.

Bug: 887078
Change-Id: I3fcdfd6d7f717665a15c05dbb53602deda526b73
Reviewed-on: https://chromium-review.googlesource.com/1135546Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarTobias Sargeant <tobiasjs@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avataragrieve <agrieve@chromium.org>
Commit-Queue: Richard Coles <torne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594394}
parent ca79b4a5
......@@ -9,6 +9,7 @@ import("//build/config/android/chrome_version.gni")
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//chrome/android/trichrome.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
import("//tools/grit/repack.gni")
import("//tools/resources/generate_resource_whitelist.gni")
......@@ -109,6 +110,15 @@ jinja_template("system_webview_manifest") {
variables = [ "manifest_package=$system_webview_package_name" ]
}
jinja_template("trichrome_webview_manifest") {
input = "apk/java/AndroidManifest.xml"
output = trichrome_webview_android_manifest
variables = trichrome_jinja_variables + [
"manifest_package=$system_webview_package_name",
"library=libmonochrome.so",
]
}
webview_repack_locales("repack_locales") {
input_locales = locales
output_locales = locales
......@@ -1085,4 +1095,13 @@ if (public_android_sdk) {
deps = upstream_only_webview_deps
apk_name = "SystemWebView"
}
system_webview_apk_tmpl("trichrome_webview_apk") {
version_name = chrome_version_name
android_manifest = trichrome_webview_android_manifest
android_manifest_dep = ":trichrome_webview_manifest"
deps = upstream_only_webview_deps
apk_name = "TrichromeWebView"
use_trichrome_library = true
}
}
......@@ -80,5 +80,11 @@
{% endfor %}
<meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
android:value="0" />
{% if trichrome_library is defined %}
<uses-static-library
android:name="{{ trichrome_library }}"
android:version="{{ trichrome_version }}"
android:certDigest="{{ trichrome_certdigest }}" />
{% endif %}
</application>
</manifest>
......@@ -71,3 +71,7 @@
# We strip some unused resources when preprocessing the GMS client libs.
-dontwarn com.google.android.gms.R**
# Trichrome builds don't include a native library list in the main APK; it's
# picked up from the library APK at runtime.
-dontwarn org.chromium.base.library_loader.NativeLibraries
......@@ -25,14 +25,35 @@ template("system_webview_apk_tmpl") {
}
shared_resources = true
if (!defined(use_trichrome_library) || !use_trichrome_library) {
shared_libraries = [ "//android_webview:libwebviewchromium" ]
if (build_apk_secondary_abi && android_64bit_target_cpu) {
secondary_abi_shared_libraries = [ "//android_webview:libwebviewchromium($android_secondary_abi_toolchain)" ]
}
} else {
# Include placeholder libraries to ensure we are treated as the desired
# architecture.
if (android_64bit_target_cpu) {
shared_libraries = [ "//android_webview:monochrome" ]
if (build_apk_secondary_abi) {
secondary_native_lib_placeholders = [ "libdummy.so" ]
}
} else {
native_lib_placeholders = [ "libdummy.so" ]
}
}
if (!defined(use_trichrome_library) || !use_trichrome_library ||
android_64bit_target_cpu) {
# 32-bit TrichromeWebView doesn't have a native library, so only do this
# for other configs.
native_lib_version_rule = "//build/util:chrome_version_json"
_native_lib_file =
rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
if (build_apk_secondary_abi && android_64bit_target_cpu) {
secondary_abi_shared_libraries = [ "//android_webview:libwebviewchromium($android_secondary_abi_toolchain)" ]
}
aapt_locale_whitelist = locales
resource_blacklist_regex = "[/-]xxxhdpi[/-]"
......
......@@ -4,6 +4,8 @@
system_webview_android_manifest =
"$root_gen_dir/android_webview/system_webview_apk/AndroidManifest.xml"
trichrome_webview_android_manifest =
"$root_gen_dir/android_webview/trichrome_webview_apk/AndroidManifest.xml"
upstream_only_webview_deps = [
"//android_webview:platform_service_bridge_upstream_implementation_java",
......
......@@ -22,6 +22,8 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("channel.gni")
import("java_sources.gni")
import("static_initializers.gni")
import("trichrome.gni")
if (modularize_ar) {
import("//chrome/android/modules/ar/ar_module_tmpl.gni")
}
......@@ -41,6 +43,10 @@ chrome_sync_shell_android_manifest =
"$target_gen_dir/chrome_sync_shell_apk/AndroidManifest.xml"
monochrome_public_android_manifest =
"$target_gen_dir/monochrome_public_apk/AndroidManifest.xml"
trichrome_library_android_manifest =
"$target_gen_dir/trichrome_library_apk/AndroidManifest.xml"
trichrome_chrome_android_manifest =
"$target_gen_dir/trichrome_chrome_apk/AndroidManifest.xml"
chrome_sync_shell_jinja_variables =
default_chrome_public_jinja_variables +
......@@ -89,6 +95,20 @@ jinja_template("monochrome_public_android_manifest") {
[ "target_sdk_version=$android_sdk_version" ]
}
jinja_template("trichrome_library_android_manifest") {
input = "java/AndroidManifest_trichrome_library.xml"
output = trichrome_library_android_manifest
variables = trichrome_jinja_variables +
[ "manifest_package=$trichrome_library_package" ]
}
jinja_template("trichrome_chrome_android_manifest") {
input = "java/AndroidManifest_trichrome_chrome.xml"
includes = [ "java/AndroidManifest.xml" ]
output = trichrome_chrome_android_manifest
variables = chrome_public_jinja_variables + trichrome_jinja_variables
}
jinja_template("chrome_sync_shell_android_manifest") {
input = "java/AndroidManifest.xml"
output = chrome_sync_shell_android_manifest
......@@ -1441,15 +1461,20 @@ template("monochrome_public_apk_or_module_tmpl") {
monochrome_public_common_apk_or_module_tmpl(target_name) {
forward_variables_from(invoker,
[
"android_manifest",
"android_manifest_dep",
"apk_name",
"is_base_module",
"module_name",
"proguard_jar_path",
"target_type",
"use_trichrome_library",
])
if (!defined(android_manifest) && !defined(android_manifest_dep)) {
android_manifest = monochrome_public_android_manifest
android_manifest_dep = ":monochrome_public_android_manifest"
}
if (public_android_sdk) {
# Resource whitelist used when generating R.java files and causes
......@@ -1486,6 +1511,53 @@ monochrome_public_apk_or_module_tmpl("monochrome_public_base_module") {
is_base_module = true
}
android_apk("trichrome_library_apk") {
apk_name = "TrichromeLibrary"
android_manifest = trichrome_library_android_manifest
android_manifest_dep = ":trichrome_library_android_manifest"
# TODO(torne): this contains the list of locales amongst other things.
# Skip building it because the version in the library won't be used anyway;
# the one in the main APK will take precedence.
generate_buildconfig_java = false
# TODO(torne): since there's no real java code in the library right now,
# leave out the build hooks and let them get compiled into each APK. Later
# this should probably be in the library.
no_build_hooks = true
alternative_android_sdk_dep = webview_framework_dep
app_as_shared_lib = true
requires_sdk_api_level_23 = true
use_chromium_linker = false
uncompress_shared_libraries = true
_native_lib_file =
rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
native_lib_version_rule = "//build/util:chrome_version_json"
if (android_64bit_target_cpu) {
# Include a 64-bit placeholder library to ensure that the library is treated
# as multiarch and gets its Java code precompiled for both architectures.
native_lib_placeholders = [ "libdummy.so" ]
if (build_apk_secondary_abi) {
# Include the actual 32-bit libmonochrome library.
secondary_abi_shared_libraries = [ ":monochrome_secondary_abi_lib" ]
}
} else {
shared_libraries = [ ":monochrome" ]
}
}
monochrome_public_apk_or_module_tmpl("trichrome_chrome_apk") {
apk_name = "TrichromeChrome"
target_type = "android_apk"
android_manifest = trichrome_chrome_android_manifest
android_manifest_dep = ":trichrome_chrome_android_manifest"
use_trichrome_library = true
}
chrome_public_common_apk_or_module_tmpl("chrome_sync_shell_apk") {
testonly = true
target_type = "android_apk"
......
......@@ -195,6 +195,8 @@ template("monochrome_public_common_apk_or_module_tmpl") {
_enable_multidex = is_java_debug || multidex_in_release
}
chrome_public_common_apk_or_module_tmpl(target_name) {
if (!defined(invoker.use_trichrome_library) ||
!invoker.use_trichrome_library) {
# Always build 64-bit //android_webview:monochrome because Chrome runs
# in 32-bit mode.
if (android_64bit_target_cpu) {
......@@ -206,6 +208,16 @@ template("monochrome_public_common_apk_or_module_tmpl") {
secondary_abi_shared_libraries =
[ "//chrome/android:monochrome_secondary_abi_lib" ]
}
} else {
# Include a 32-bit placeholder library to ensure that Chrome runs in
# 32-bit mode.
if (android_64bit_target_cpu) {
# We don't want to be 64-bit, only include a placeholder for secondary.
secondary_native_lib_placeholders = [ "libdummy.so" ]
} else {
native_lib_placeholders = [ "libdummy.so" ]
}
}
alternative_android_sdk_dep = webview_framework_dep
app_as_shared_lib = true
......
{% extends "chrome/android/java/AndroidManifest.xml" %}
## 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.
## Note: This is a jinja2 template, processed at build time into the final manifest.
## TODO(torne): we need a Trichrome application subclass to use the library preloader
##{% block application_name %}org.chromium.chrome.browser.MonochromeApplication{% endblock %}
{% block extra_application_attributes %}
{{ super() }}
android:extractNativeLibs="false"
{% endblock %}
{% block extra_keyset_definitions %}
<!-- No keyset definitions should exist for any trichrome apks -->
{% endblock %}
{% block extra_application_definitions %}
{{ super() }}
<uses-static-library
android:name="{{ trichrome_library }}"
android:version="{{ trichrome_version }}"
android:certDigest="{{ trichrome_certdigest }}" />
{% endblock %}
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<!--
Note: This is a jinja2 template, processed at build time into the final manifest.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="{{ manifest_package }}"
tools:ignore="MissingVersion">
<uses-sdk android:minSdkVersion="{{min_sdk_version}}" android:targetSdkVersion="{{target_sdk_version}}" />
<uses-feature android:glEsVersion="0x00020000" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<!-- TODO(torne): we should specify an icon, roundIcon, and label from resources. -->
<application
android:label="Trichrome Library"
android:multiArch="true"
android:extractNativeLibs="false">
<static-library android:name="{{ trichrome_library }}" android:version="{{ trichrome_version }}" />
</application>
</manifest>
......@@ -26,3 +26,7 @@
-keepclassmembers class android.support.design.internal.BottomNavigationMenuView {
boolean mShiftingMode;
}
# Trichrome builds don't include a native library list in the main APK; it's
# picked up from the library APK at runtime.
-dontwarn org.chromium.base.library_loader.NativeLibraries
# 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.
import("//build/config/android/config.gni")
trichrome_library_package = "org.chromium.trichromelibrary"
trichrome_certdigest =
"1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00"
trichrome_jinja_variables = [
"min_sdk_version=26",
"target_sdk_version=$android_sdk_version",
"trichrome_library=$trichrome_library_package",
"trichrome_version=$android_default_version_code",
"trichrome_certdigest=$trichrome_certdigest",
]
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