Skip to content

Commit 9bbc2cb

Browse files
ahumeskycopybara-github
authored andcommitted
Fixes to enable Android Platforms with android_local_test.
1. Remove `target_compatible_with` from the Android toolchains generated in the Starlark and native `android_sdk_repository` rules so that they can be selected with a host JDK in android_local_test 1. Re-enable `android_local_test_integration_test.sh` 1. Switch `--platforms` to `--android_platforms` in the android integration test setup so that a host JDK can be selected in android_local_test Fixes #19829 RELNOTES: None PiperOrigin-RevId: 582716155 Change-Id: I49d6a9058218d522b9ebb7cc6842fe20c36e2798
1 parent 9e9ed61 commit 9bbc2cb

File tree

3 files changed

+1
-9
lines changed

3 files changed

+1
-9
lines changed

src/test/shell/bazel/android/android_helper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function resolve_android_toolchains() {
115115
echo "This test uses platform-based Android toolchain resolution."
116116
add_to_bazelrc "build --incompatible_enable_android_toolchain_resolution"
117117
add_to_bazelrc "build --incompatible_enable_cc_toolchain_resolution"
118-
add_to_bazelrc "build --platforms=//test_android_platforms:simple"
118+
add_to_bazelrc "build --android_platforms=//test_android_platforms:simple"
119119
else
120120
echo "This test uses legacy Android toolchains."
121121
add_to_bazelrc "build --noincompatible_enable_android_toolchain_resolution"

src/test/shell/bazel/android/android_local_test_integration_test.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ fail_if_no_android_sdk
3434
source "${CURRENT_DIR}/../../integration_test_setup.sh" \
3535
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
3636

37-
if [[ "$1" = '--with_platforms' ]]; then
38-
# TODO(https://github.com/bazelbuild/bazel/issues/19829): Re-enable when
39-
# android_local_test works properly with Android platforms.
40-
exit 0
41-
fi
4237
resolve_android_toolchains "$1"
4338

4439
function setup_android_local_test_env() {

tools/android/android_sdk_repository_template.bzl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@ def create_android_sdk_rules(
199199
native.toolchain(
200200
name = "sdk-%d-toolchain" % api_level,
201201
exec_compatible_with = HOST_CONSTRAINTS,
202-
target_compatible_with = [
203-
"@platforms//os:android",
204-
],
205202
toolchain = ":sdk-%d" % api_level,
206203
toolchain_type = "@bazel_tools//tools/android:sdk_toolchain_type",
207204
)

0 commit comments

Comments
 (0)