Fix build_with_chromium=false Android webrtc build attempt #2
This CL: 1) Replaces GN variable used to filter //third_party/android_deps dependencies with a new GN variable - limit_android_deps The new GN variable is needed because: - angle does not use JUnit tests. The standalone angle checkout should not require //third_party/robolectric for "gn gen" to work. - webrtc does use JUnit tests and thus requires //third_party/robolectric This change fixes the standalone WebRTC breakage caused by https://chromium-review.googlesource.com/c/chromium/src/+/2812340 2) Removes build_with_chromium requirement for _generate_final_jni in android_apk_or_module() GN template. This change is needed because the standalone webrtc build uses JNI. Angle will set "generate_final_jni" GN variable to avoid //base dependency. WebRTC bug:12634 Change-Id: I4ad86f33dfea32cb2fb4632e83ab14c0f9f7f4b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2815530 Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org> Reviewed-by: Mohamed Heikal <mheikal@chromium.org> Reviewed-by: Peter Wen <wnwen@chromium.org> Cr-Commit-Position: refs/heads/master@{#871341}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
3991b4b077
commit
f4d6a45f21
base/android/jni_generator
build/config/android
build_overrides
third_party/android_deps
@ -5,6 +5,8 @@
|
||||
import("//build/config/android/rules.gni")
|
||||
import("//testing/test.gni")
|
||||
|
||||
_registration_header = "$target_gen_dir/sample_jni_registration.h"
|
||||
|
||||
generate_jni("jni_sample_header") {
|
||||
sources = [
|
||||
"java/src/org/chromium/example/jni_generator/SampleForAnnotationProcessor.java",
|
||||
@ -40,41 +42,36 @@ source_set("jni_sample_native_side") {
|
||||
]
|
||||
}
|
||||
|
||||
if (build_with_chromium) {
|
||||
_registration_header = "$target_gen_dir/sample_jni_registration.h"
|
||||
shared_library("jni_sample_lib") {
|
||||
sources = [
|
||||
"sample_entry_point.cc",
|
||||
_registration_header,
|
||||
]
|
||||
|
||||
# "__final_jni" is not available when build_with_chromium == false.
|
||||
shared_library("jni_sample_lib") {
|
||||
sources = [
|
||||
"sample_entry_point.cc",
|
||||
_registration_header,
|
||||
]
|
||||
deps = [
|
||||
":jni_sample_native_side",
|
||||
":sample_jni_apk__final_jni", # For registration_header
|
||||
"//base",
|
||||
]
|
||||
}
|
||||
|
||||
deps = [
|
||||
":jni_sample_native_side",
|
||||
":sample_jni_apk__final_jni", # For registration_header
|
||||
"//base",
|
||||
]
|
||||
}
|
||||
|
||||
android_apk("sample_jni_apk") {
|
||||
apk_name = "SampleJni"
|
||||
android_manifest = "AndroidManifest.xml"
|
||||
deps = [
|
||||
":jni_sample_java",
|
||||
"//base:base_java",
|
||||
]
|
||||
shared_libraries = [ ":jni_sample_lib" ]
|
||||
jni_registration_header = _registration_header
|
||||
}
|
||||
android_apk("sample_jni_apk") {
|
||||
apk_name = "SampleJni"
|
||||
android_manifest = "AndroidManifest.xml"
|
||||
deps = [
|
||||
":jni_sample_java",
|
||||
"//base:base_java",
|
||||
]
|
||||
shared_libraries = [ ":jni_sample_lib" ]
|
||||
jni_registration_header = _registration_header
|
||||
}
|
||||
|
||||
# Serves to test that generated bindings compile properly.
|
||||
group("jni_generator_tests") {
|
||||
deps = [ ":jni_annotation_sample_java" ]
|
||||
if (build_with_chromium) {
|
||||
deps += [ ":sample_jni_apk" ]
|
||||
}
|
||||
deps = [
|
||||
":jni_annotation_sample_java",
|
||||
":sample_jni_apk",
|
||||
]
|
||||
}
|
||||
|
||||
java_annotation_processor("jni_processor") {
|
||||
|
@ -2331,7 +2331,7 @@ if (enable_java_templates) {
|
||||
_generate_productconfig_java = defined(invoker.product_config_java_packages)
|
||||
|
||||
# JNI generation usually goes hand-in-hand with buildconfig generation.
|
||||
_generate_final_jni = _generate_buildconfig_java && build_with_chromium
|
||||
_generate_final_jni = _generate_buildconfig_java
|
||||
if (defined(invoker.generate_final_jni)) {
|
||||
_generate_final_jni = invoker.generate_final_jni
|
||||
}
|
||||
|
@ -27,6 +27,13 @@ declare_args() {
|
||||
# TODO(crbug/1006769): Switch to perfetto's client library.
|
||||
use_perfetto_client_library = false
|
||||
|
||||
# Limits the defined //third_party/android_deps targets to only "buildCompile"
|
||||
# and "buildCompileNoDeps" targets. This is useful for third-party
|
||||
# repositories which do not use JUnit tests. For instance,
|
||||
# limit_android_deps == true removes "gn gen" requirement for
|
||||
# //third_party/robolectric .
|
||||
limit_android_deps = false
|
||||
|
||||
# Allows googletest to pretty-print various absl types. Disabled for nacl due
|
||||
# to lack of toolchain support.
|
||||
gtest_enable_absl_printers = !is_nacl
|
||||
|
4
third_party/android_deps/BUILD.gn
vendored
4
third_party/android_deps/BUILD.gn
vendored
@ -5,7 +5,7 @@
|
||||
import("//build/config/android/rules.gni")
|
||||
|
||||
# Library groups
|
||||
if (build_with_chromium) {
|
||||
if (!limit_android_deps) {
|
||||
java_group("android_support_v4_java") {
|
||||
deps = [
|
||||
"//third_party/androidx:androidx_core_core_java",
|
||||
@ -750,7 +750,7 @@ java_prebuilt("org_threeten_threeten_extra_java") {
|
||||
]
|
||||
}
|
||||
|
||||
if (build_with_chromium) {
|
||||
if (!limit_android_deps) {
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
java_prebuilt("android_arch_lifecycle_common_java") {
|
||||
jar_path = "libs/android_arch_lifecycle_common/common-1.1.1.jar"
|
||||
|
@ -243,7 +243,7 @@ class BuildConfigGenerator extends DefaultTask {
|
||||
appendBuildTarget(dependency, depGraph.dependencies, sb)
|
||||
}
|
||||
|
||||
sb.append("if (build_with_chromium) {\n")
|
||||
sb.append("if (!limit_android_deps) {\n")
|
||||
def buildWithChromiumDependencies = depGraph.dependencies.values().findAll {
|
||||
dependency -> !dependency.usedInBuild
|
||||
}
|
||||
|
Reference in New Issue
Block a user