diff options
Diffstat (limited to 'chromium/chrome/android/modules')
11 files changed, 163 insertions, 28 deletions
diff --git a/chromium/chrome/android/modules/buildflags.gni b/chromium/chrome/android/modules/buildflags.gni index d2402b0179e..fe809d67409 100644 --- a/chromium/chrome/android/modules/buildflags.gni +++ b/chromium/chrome/android/modules/buildflags.gni @@ -6,11 +6,6 @@ import("//build/config/android/config.gni") import("//build/config/compiler/compiler.gni") import("//device/vr/buildflags/buildflags.gni") -# 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_android && is_clang && use_lld && !is_component_build) { - use_native_modules = enable_vr && modularize_vr_native -} else { - use_native_modules = false -} +# If true, lld is used to partition feature code into separate libraries, which +# in turn are included in Dynamic Feature Modules. +use_native_partitions = is_android && is_clang && use_lld && !is_component_build diff --git a/chromium/chrome/android/modules/chrome_feature_module_tmpl.gni b/chromium/chrome/android/modules/chrome_feature_module_tmpl.gni index 7d7a128f1ff..cfc20859aaf 100644 --- a/chromium/chrome/android/modules/chrome_feature_module_tmpl.gni +++ b/chromium/chrome/android/modules/chrome_feature_module_tmpl.gni @@ -33,6 +33,7 @@ template("chrome_feature_module") { "base_module_target", "manifest_package", "min_sdk_version", + "package_id", "uncompress_shared_libraries", "version_code", "version_name", @@ -44,17 +45,12 @@ template("chrome_feature_module") { deps += _module_desc.java_deps } - if (defined(_module_desc.proguard_async) && _module_desc.proguard_async) { - enable_class_deps_output = "${_module_desc.name}_constant_pool_deps.txt" - } - # Don't embed more translations than required (http://crbug.com/932017). aapt_locale_whitelist = locales proguard_enabled = !is_java_debug package_name = _module_desc.name - package_name_to_id_mapping = resource_packages_id_mapping _loadable_modules_32_bit = [] _loadable_modules_64_bit = [] @@ -65,7 +61,8 @@ template("chrome_feature_module") { _loadable_modules_64_bit += _module_desc.loadable_modules_64_bit } - if (defined(_module_desc.native_deps) && _module_desc.native_deps != []) { + if (use_native_partitions && defined(_module_desc.native_deps) && + _module_desc.native_deps != []) { _arch = "" _toolchain = "" _root_out_dir = root_out_dir diff --git a/chromium/chrome/android/modules/chrome_feature_modules.gni b/chromium/chrome/android/modules/chrome_feature_modules.gni index 7912a1598b6..05b617d489f 100644 --- a/chromium/chrome/android/modules/chrome_feature_modules.gni +++ b/chromium/chrome/android/modules/chrome_feature_modules.gni @@ -8,6 +8,7 @@ import( import("//chrome/android/features/dev_ui/dev_ui_module.gni") import("//chrome/android/features/tab_ui/tab_ui_module.gni") import("//chrome/android/modules/buildflags.gni") +import("//chrome/android/modules/extra_icu/extra_icu_module.gni") import("//chrome/android/modules/test_dummy/test_dummy_module.gni") import("//device/vr/buildflags/buildflags.gni") @@ -18,18 +19,6 @@ if (enable_arcore) { import("//chrome/android/features/ar/ar_module.gni") } -# Mapping that controls package IDs assigned to modules. The package IDs have to -# be unique and lower than 0x7f. -# TODO(crbug.com/984158): Autogenerate instead of explicit list. -resource_packages_id_mapping = [ - "ar=0x7e", - "vr=0x7d", - "tab_ui=0x7c", - "autofill_assistant=0x7b", - "dev_ui=0x7a", - "test_dummy=0x79", -] - # List of feature module descs for each Chrome flavor. These lists are used to # autogenerate the relevant module targets and bundles. A feature module desc # is a GN scope with the following fields: @@ -39,7 +28,6 @@ resource_packages_id_mapping = [ # native_deps: (Optional) Native code going into module. # native_entrypoints: (Optional) File with list of exposed symbols from native # feature module library. -# proguard_async: (Optional) Whether to proguard the module asynchronously. # loadable_modules_32_bit: (Optional) List of additional 32-bit shared # library files going into module if the module is executed in 32 bit. # loadable_modules_64_bit: (Optional) List of additional 64-bit shared @@ -47,7 +35,10 @@ resource_packages_id_mapping = [ # Each new module needs to add a desc to one of the lists below. # Modules shipped in Chrome Modern (Android L+). -chrome_modern_module_descs = [ test_dummy_module_desc ] +chrome_modern_module_descs = [ + test_dummy_module_desc, + extra_icu_module_desc, +] if (enable_vr) { chrome_modern_module_descs += [ vr_module_desc ] } diff --git a/chromium/chrome/android/modules/dev_ui/provider/BUILD.gn b/chromium/chrome/android/modules/dev_ui/provider/BUILD.gn index f789f85e6ed..8ab005a8b13 100644 --- a/chromium/chrome/android/modules/dev_ui/provider/BUILD.gn +++ b/chromium/chrome/android/modules/dev_ui/provider/BUILD.gn @@ -7,16 +7,33 @@ import("//build/config/android/rules.gni") android_library("java") { deps = [ "//base:base_java", + "//base:jni_java", "//chrome/android/features/dev_ui/public:java", "//components/module_installer/android:module_installer_java", ] + annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] java_files = [ + "java/src/org/chromium/chrome/features/dev_ui/DevUiInstallListener.java", "java/src/org/chromium/chrome/features/dev_ui/DevUiModuleProvider.java", ] } generate_jni("jni_headers") { sources = [ + "java/src/org/chromium/chrome/features/dev_ui/DevUiInstallListener.java", "java/src/org/chromium/chrome/features/dev_ui/DevUiModuleProvider.java", ] } + +source_set("native") { + deps = [ + ":jni_headers", + "//base", + ] + sources = [ + "dev_ui_install_listener.cc", + "dev_ui_install_listener.h", + "dev_ui_module_provider.cc", + "dev_ui_module_provider.h", + ] +} diff --git a/chromium/chrome/android/modules/extra_icu/extra_icu_module.gni b/chromium/chrome/android/modules/extra_icu/extra_icu_module.gni new file mode 100644 index 00000000000..ace0b82c5d8 --- /dev/null +++ b/chromium/chrome/android/modules/extra_icu/extra_icu_module.gni @@ -0,0 +1,13 @@ +# 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. + +extra_icu_module_desc = { + name = "extra_icu" + android_manifest = + "//chrome/android/modules/extra_icu/internal/java/AndroidManifest.xml" + java_deps = [ + "//third_party/icu:icu_extra_assets", + "//chrome/android/modules/extra_icu/internal:java", + ] +} diff --git a/chromium/chrome/android/modules/extra_icu/internal/BUILD.gn b/chromium/chrome/android/modules/extra_icu/internal/BUILD.gn new file mode 100644 index 00000000000..4adc8993a47 --- /dev/null +++ b/chromium/chrome/android/modules/extra_icu/internal/BUILD.gn @@ -0,0 +1,14 @@ +# 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/android/rules.gni") + +android_library("java") { + java_files = + [ "java/src/org/chromium/chrome/modules/extra_icu/ExtraIcuImpl.java" ] + deps = [ + "//base:base_java", + "//chrome/android/modules/extra_icu/public:java", + ] +} diff --git a/chromium/chrome/android/modules/extra_icu/provider/BUILD.gn b/chromium/chrome/android/modules/extra_icu/provider/BUILD.gn new file mode 100644 index 00000000000..ce7c348b0aa --- /dev/null +++ b/chromium/chrome/android/modules/extra_icu/provider/BUILD.gn @@ -0,0 +1,29 @@ +# 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/android/rules.gni") + +android_library("java") { + deps = [ + "//base:base_java", + "//chrome/android/modules/extra_icu/public:java", + ] + java_files = [ "java/src/org/chromium/chrome/modules/extra_icu/ExtraIcuModuleProvider.java" ] +} + +generate_jni("jni_headers") { + sources = [ + "java/src/org/chromium/chrome/modules/extra_icu/ExtraIcuModuleProvider.java", + ] +} + +source_set("native") { + deps = [ + ":jni_headers", + ] + sources = [ + "module_provider.cc", + "module_provider.h", + ] +} diff --git a/chromium/chrome/android/modules/extra_icu/public/BUILD.gn b/chromium/chrome/android/modules/extra_icu/public/BUILD.gn new file mode 100644 index 00000000000..7a9a943d0a6 --- /dev/null +++ b/chromium/chrome/android/modules/extra_icu/public/BUILD.gn @@ -0,0 +1,16 @@ +# 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/android/rules.gni") + +android_library("java") { + java_files = + [ "java/src/org/chromium/chrome/modules/extra_icu/ExtraIcu.java" ] + deps = [ + "//components/module_installer/android:module_installer_java", + "//components/module_installer/android:module_interface_java", + ] + annotation_processor_deps = + [ "//components/module_installer/android:module_interface_processor" ] +} diff --git a/chromium/chrome/android/modules/test_dummy/internal/BUILD.gn b/chromium/chrome/android/modules/test_dummy/internal/BUILD.gn index 731908916d4..f9759da10e6 100644 --- a/chromium/chrome/android/modules/test_dummy/internal/BUILD.gn +++ b/chromium/chrome/android/modules/test_dummy/internal/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/android/rules.gni") +import("//chrome/android/modules/buildflags.gni") android_library("java") { java_files = [ "java/src/org/chromium/chrome/modules/test_dummy/TestDummyProviderImpl.java" ] @@ -13,3 +14,55 @@ android_library("java") { "//chrome/android/modules/test_dummy/public:java", ] } + +# This group is effectively alias representing the module's native code, +# allowing it to be named "native" for clarity in module descriptors. The +# component target must be named according to the feature, so that the component +# build's .cr.co library is named properly (ie. libtest_dummy.cr.so). +group("native") { + deps = [ + ":test_dummy", + ] +} + +component("test_dummy") { + sources = [ + "entrypoints.cc", + ] + deps = [ + ":jni_registration", + "//base", + "//chrome/android/features/test_dummy/internal:native", + ] + + # Test dummy native entrypoints belong in the partition. + if (use_native_partitions) { + cflags = [ "-fsymbol-partition=libtest_dummy.so" ] + } +} + +# TODO(https://crbug.com/1008109): Adapt JNI registration to point at a Java +# target, instead of an APK/module target. This JNI registration target +# points at ChromeModern's module, but it's used by Monochrome as well, since +# both variants do explicit JNI registration in DFMs (for consistency). +# +# Alternatively, move to lazy JNI init for DFMs in Monochrome, by conditionally +# including a registration stub, as Chrome's base library does. That requires +# two sets of registration targets, so that the feature module template can +# selectively pull in the real version or a stub. +generate_jni_registration("jni_registration") { + target = + "//chrome/android:chrome_modern_public_bundle__test_dummy_bundle_module" + header_output = "$target_gen_dir/jni_registration.h" + namespace = "test_dummy" +} + +android_assets("pak_assets") { + sources = [ + "$root_gen_dir/chrome/test_dummy_resources.pak", + ] + deps = [ + "//chrome/android/features/test_dummy/internal:resources_native", + ] + disable_compression = true +} diff --git a/chromium/chrome/android/modules/test_dummy/provider/BUILD.gn b/chromium/chrome/android/modules/test_dummy/provider/BUILD.gn index 5b0269c7361..4e5988a61aa 100644 --- a/chromium/chrome/android/modules/test_dummy/provider/BUILD.gn +++ b/chromium/chrome/android/modules/test_dummy/provider/BUILD.gn @@ -6,6 +6,8 @@ import("//build/config/android/rules.gni") android_library("java") { deps = [ + "//base:base_java", + "//base:jni_java", "//chrome/android/features/test_dummy/public:java", "//chrome/android/modules/test_dummy/public:java", ] diff --git a/chromium/chrome/android/modules/test_dummy/test_dummy_module.gni b/chromium/chrome/android/modules/test_dummy/test_dummy_module.gni index bcaca9d9543..28ce4ff4299 100644 --- a/chromium/chrome/android/modules/test_dummy/test_dummy_module.gni +++ b/chromium/chrome/android/modules/test_dummy/test_dummy_module.gni @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//chrome/android/modules/buildflags.gni") + test_dummy_module_desc = { name = "test_dummy" android_manifest = @@ -9,5 +11,11 @@ test_dummy_module_desc = { java_deps = [ "//chrome/android/features/test_dummy/internal:java", "//chrome/android/modules/test_dummy/internal:java", + "//chrome/android/modules/test_dummy/internal:pak_assets", + ] + + native_deps = [ + "//chrome/android/features/test_dummy/internal:native", + "//chrome/android/modules/test_dummy/internal:native", ] } |