Commit 0cc91c67 authored by Fred Mello's avatar Fred Mello Committed by Commit Bot

Android: Add compile-only target for module config

This avoids IS_BUNDLE being optimized out by the JVM. Added comments to
clarify which config target should be used by other java targets.

Note:
The changes in this CL were originally uploaded @ 1765654
and patched (fixed srcjar_deps for tests) in this CL.

Bug: 996821
Binary-Size: Related to a faulty CL(1762699) that decreased it (same amount).
Change-Id: Ide295c69c61b98d7039f5f74fe72d97a88b28cb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1769516
Commit-Queue: Fred Mello <fredmello@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690162}
parent 1a98a43d
......@@ -728,6 +728,10 @@ junit_binary("chrome_junit_tests") {
"//url/mojom:url_mojom_gurl_java",
]
srcjar_deps = [
"//components/module_installer/android:module_installer_apk_build_config",
]
package_name = chrome_public_manifest_package
}
......
......@@ -102,7 +102,6 @@ junit_binary("keyboard_accessory_junit_tests") {
"//third_party/mockito:mockito_java",
]
srcjar_deps = [
"//components/module_installer/android:module_installer_apk_build_config",
]
srcjar_deps =
[ "//components/module_installer/android:module_installer_build_config" ]
}
......@@ -589,6 +589,9 @@ if (is_android) {
"android/browsertests_apk/src/org/chromium/android_browsertests_apk/ChromeBrowserTestsActivity.java",
"android/browsertests_apk/src/org/chromium/android_browsertests_apk/ChromeBrowserTestsApplication.java",
]
srcjar_deps = [
"//components/module_installer/android:module_installer_apk_build_config",
]
}
jinja_template("android_browsertests_manifest") {
......@@ -3580,6 +3583,10 @@ test("unit_tests") {
} else {
deps += [ "//v8:v8_external_startup_data_assets" ]
}
srcjar_deps = [
"//components/module_installer/android:module_installer_apk_build_config",
]
} else {
# !is_android
sources += [
......
......@@ -25,7 +25,7 @@ android_library("module_installer_java") {
"//third_party/google_android_play_core:com_google_android_play_core_java",
]
srcjar_deps = [ ":module_installer_apk_build_config" ]
srcjar_deps = [ ":module_installer_build_config" ]
jar_excluded_patterns = [ "*/ModuleInstallerConfig.class" ]
......@@ -72,12 +72,21 @@ java_annotation_processor("module_interface_processor") {
jacoco_never_instrument = true
}
# Use this one if your target needs to depend on ModuleInstallerConfig. The
# other two targets are automatically added to build targets.
java_cpp_template("module_installer_build_config") {
package_path = "org/chromium/components/module_installer"
sources = [
"build/ModuleInstallerConfig.template",
]
}
java_cpp_template("module_installer_bundle_build_config") {
package_path = "org/chromium/components/module_installer"
sources = [
"build/ModuleInstallerConfig.template",
]
defines = [ "IS_BUNDLE_ENABLED" ]
defines = [ "IS_BUNDLE_BUILD" ]
}
java_cpp_template("module_installer_apk_build_config") {
......@@ -85,4 +94,5 @@ java_cpp_template("module_installer_apk_build_config") {
sources = [
"build/ModuleInstallerConfig.template",
]
defines = [ "IS_APK_BUILD" ]
}
......@@ -7,10 +7,13 @@ package org.chromium.components.module_installer;
/** Build config for DFMs. */
public class ModuleInstallerConfig {
#if defined(IS_BUNDLE_ENABLED)
#if defined(IS_BUNDLE_BUILD)
public static final boolean IS_BUNDLE = true;
#else
#elif defined(IS_APK_BUILD)
public static final boolean IS_BUNDLE = false;
#else
// This needs to not be final in order to avoid being inlined.
public static boolean IS_BUNDLE;
#endif
}
\ No newline at end of file
}
......@@ -99,6 +99,7 @@ template("test") {
"min_sdk_version",
"proguard_configs",
"proguard_enabled",
"srcjar_deps",
"target_sdk_version",
"use_default_launcher",
"use_native_activity",
......
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