Commit 4a5eb6e0 authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

Modules: Include VR native library in DFM

When enabled, this change will package the VR native library in the VR DFM.

Also, introduce a .gni that computes whether native libraries in modules is
enabled as a whole (not VR specific).

Bug: 921663
Change-Id: Iacf09c46393daf924059217b3c7b335822cedef6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601535
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658347}
parent f50dd5b8
......@@ -2232,6 +2232,7 @@ template("monochrome_or_trichrome_public_bundle_tmpl") {
module_name = "Vr" + _bundle_name
base_module_target = ":$_base_module_target_name"
native_switches = _native_switches
is_monochrome_or_trichrome = true
uncompress_shared_libraries = true
version_code = _version_code
version_name = _version_name
......
......@@ -4,7 +4,7 @@
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//chrome/android/features/module_names_to_package_ids.gni")
import("//chrome/android/features/dynamic_feature_modules.gni")
import("//device/vr/buildflags/buildflags.gni")
assert(enable_arcore)
......
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//chrome/android/features/module_names_to_package_ids.gni")
import("//chrome/android/features/dynamic_feature_modules.gni")
template("autofill_assistant_module_tmpl") {
_manifest = "$target_gen_dir/$target_name/AndroidManifest.xml"
......
# Copyright 2019 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/compiler/compiler.gni")
import("//device/vr/buildflags/buildflags.gni")
# This file aggregates data used when pulling DFM-related dependencies into
# bundle builds. As DFMs move to describe their parameters in a standard way,
# this file may evolve to an aggregation of individual DFM configurations.
# Mapping that controls package IDs assigned to modules.
resource_packages_id_mapping = [
"ar=0x7e",
"vr=0x7d",
"tab_ui=0x7c",
"autofill_assistant=0x7b",
]
# This variable indicates whether the native feature module system is engaged.
# Currently, this implies a build configuration that supports native modules,
# and that at least one feature is using a native module.
if (is_clang && use_lld && !is_component_build) {
use_native_modules = enable_vr && modularize_vr_native
} else {
use_native_modules = false
}
# Mapping that controls package IDs assigned to modules.
resource_packages_id_mapping = [
"ar=0x7e",
"vr=0x7d",
"tab_ui=0x7c",
"autofill_assistant=0x7b",
]
......@@ -4,7 +4,7 @@
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//chrome/android/features/module_names_to_package_ids.gni")
import("//chrome/android/features/dynamic_feature_modules.gni")
template("tab_ui_module_tmpl") {
assert(defined(invoker.version_code))
......
......@@ -5,7 +5,7 @@
import("//base/android/linker/config.gni")
import("//build/config/android/rules.gni")
import("//build/config/locales.gni")
import("//chrome/android/features/module_names_to_package_ids.gni")
import("//chrome/android/features/dynamic_feature_modules.gni")
import("//device/vr/buildflags/buildflags.gni")
assert(enable_vr)
......@@ -45,9 +45,49 @@ template("vr_module_tmpl") {
"//chrome/browser/android/vr:vr_ui_dummy_lib",
]
# TODO(crbug.com/943210): Remove this condition once downstream passes in
# native_switches.
if (defined(invoker.native_switches)) {
if (defined(invoker.is_monochrome_or_trichrome)) {
not_needed(invoker, [ "is_monochrome_or_trichrome" ])
}
if (use_native_modules && modularize_vr_native) {
# Include the VR native library. In relation to http://crbug.com/950056,
# this logic could be moved into a location common to all feature modules.
# This could be android_app_bundle_module(), or a Chrome-specific
# extension of it. In that case, this scope would potentially pass "vr"
# as a required native library, and the lower-level template would derive
# and include the correct library.
_is_monochrome_or_trichrome =
defined(invoker.is_monochrome_or_trichrome) &&
invoker.is_monochrome_or_trichrome
_arch = ""
_toolchain = ""
_root_out_dir = root_out_dir
if (android_64bit_target_cpu) {
if (defined(invoker.is_64_bit_browser) && invoker.is_64_bit_browser) {
_arch = "_64"
} else {
_toolchain = "($android_secondary_abi_toolchain)"
_root_out_dir =
get_label_info(":foo($android_secondary_abi_toolchain)",
"root_out_dir")
}
}
if (_is_monochrome_or_trichrome) {
_base_target_name = "monochrome${_arch}_base"
} else {
_base_target_name = "libchrome${_arch}_base"
}
_module = "vr"
deps +=
[ "//chrome/android:${_base_target_name}_${_module}${_toolchain}" ]
_module_file =
"${_root_out_dir}/${_base_target_name}_partitions/lib${_module}.so"
# Pass the correct library as both the 32 and 64-bit options. Underlying
# logic will choose from the correct variable, and supply a dummy library
# for the other architecture if required.
loadable_modules_if_32_bit = [ _module_file ]
loadable_modules_if_64_bit = [ _module_file ]
} else {
if (android_64bit_target_cpu) {
_32_bit_toolchain_root_dir =
get_label_info(":foo($android_secondary_abi_toolchain)",
......
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