Commit f5d643dd authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

Simplify use of generate_jni_registration in test_dummy module.

We can allow generate_jni_registration targets to appear in multiple
toolchains by moving the default_toolchain dependency into the
template.

This will eventually be needed to build bundles that include HWASAN
splits, which will employ three toolchains (32-bit, 64-bit and HWASAN)
instead of the usual two.

Bug: 916828
Change-Id: I4edb22263d6feb432034be41f2cfea5cafafc60f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1832713
Auto-Submit: Peter Collingbourne <pcc@chromium.org>
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarChristopher Grant <cjgrant@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702026}
parent 8149d2f8
...@@ -373,14 +373,16 @@ if (enable_java_templates) { ...@@ -373,14 +373,16 @@ if (enable_java_templates) {
template("generate_jni_registration") { template("generate_jni_registration") {
action_with_pydeps(target_name) { action_with_pydeps(target_name) {
forward_variables_from(invoker, [ "testonly" ]) forward_variables_from(invoker, [ "testonly" ])
_build_config = get_label_info(invoker.target, "target_gen_dir") + "/" + _build_config = get_label_info("${invoker.target}($default_toolchain)",
get_label_info(invoker.target, "name") + ".build_config" "target_gen_dir") + "/" +
get_label_info("${invoker.target}($default_toolchain)",
"name") + ".build_config"
_rebased_build_config = rebase_path(_build_config, root_build_dir) _rebased_build_config = rebase_path(_build_config, root_build_dir)
_srcjar_output = "$target_gen_dir/$target_name.srcjar" _srcjar_output = "$target_gen_dir/$target_name.srcjar"
script = "//base/android/jni_generator/jni_registration_generator.py" script = "//base/android/jni_generator/jni_registration_generator.py"
deps = [ deps = [
"${invoker.target}$build_config_target_suffix", "${invoker.target}$build_config_target_suffix($default_toolchain)",
] ]
inputs = [ inputs = [
_build_config, _build_config,
......
...@@ -30,6 +30,7 @@ component("test_dummy") { ...@@ -30,6 +30,7 @@ component("test_dummy") {
"entrypoints.cc", "entrypoints.cc",
] ]
deps = [ deps = [
":jni_registration",
"//base", "//base",
"//chrome/android/features/test_dummy/internal:native", "//chrome/android/features/test_dummy/internal:native",
] ]
...@@ -38,12 +39,6 @@ component("test_dummy") { ...@@ -38,12 +39,6 @@ component("test_dummy") {
if (use_native_modules) { if (use_native_modules) {
cflags = [ "-fsymbol-partition=libtest_dummy.so" ] cflags = [ "-fsymbol-partition=libtest_dummy.so" ]
} }
if (current_toolchain != default_toolchain) {
deps += [ ":jni_registration_secondary($default_toolchain)" ]
} else {
deps += [ ":jni_registration($default_toolchain)" ]
}
} }
# TODO(https://crbug.com/1008109): Adapt JNI registration to point at a Java # TODO(https://crbug.com/1008109): Adapt JNI registration to point at a Java
...@@ -55,26 +50,9 @@ component("test_dummy") { ...@@ -55,26 +50,9 @@ component("test_dummy") {
# including a registration stub, as Chrome's base library does. That requires # including a registration stub, as Chrome's base library does. That requires
# two sets of registration targets, so that the feature module template can # two sets of registration targets, so that the feature module template can
# selectively pull in the real version or a stub. # selectively pull in the real version or a stub.
if (current_toolchain == default_toolchain) { generate_jni_registration("jni_registration") {
generate_jni_registration("jni_registration") {
target = target =
"//chrome/android:chrome_modern_public_bundle__test_dummy_bundle_module" "//chrome/android:chrome_modern_public_bundle__test_dummy_bundle_module"
header_output = "$target_gen_dir/jni_registration.h" header_output = "$target_gen_dir/jni_registration.h"
namespace = "test_dummy" namespace = "test_dummy"
}
# Note also: We cannot currently build JNI registration on secondary ABI
# toolchain (dependency issues). Therefore, for Monochrome's 32-bit library,
# we need to use the 64-bit side registration header that ChromeModern uses.
# However, it's in the 64-bit output directory. We need to also generate a copy
# for the 32-bit directory.
if (android_64bit_target_cpu) {
generate_jni_registration("jni_registration_secondary") {
target = "//chrome/android:chrome_modern_public_bundle__test_dummy_bundle_module"
header_output =
get_label_info(":native($android_secondary_abi_toolchain)",
"target_gen_dir") + "/jni_registration.h"
namespace = "test_dummy"
}
}
} }
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