From 92682de147997298177424bccf4a6d3637c9c656 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 7 May 2024 09:21:59 -0700 Subject: [PATCH] Add a test to ensure the Starlark-exposed Android transitions are usable. (This was accidentally broken with no tests by a pending change). Part of #22248. PiperOrigin-RevId: 631447201 Change-Id: Ie099705b35aff672efe0ee71b26d28aca2836a4f --- .../android/AndroidStarlarkCommonTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommonTest.java index 55f980ec6e48ee..b93e2846c34e7a 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommonTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommonTest.java @@ -82,4 +82,31 @@ def _impl(ctx): assertThat(fooJavaInfo.getJavaPluginInfo()).isNotNull(); assertThat(barJavaInfo.getJavaPluginInfo()).isNull(); } + + @Test + public void androidPlatformsTransition() throws Exception { + scratch.file( + "java/android/compatible.bzl", + """ + def _impl(ctx): + pass + + my_rule = rule( + implementation = _impl, + cfg = android_common.android_platforms_transition, + ) + """); + scratch.file( + "java/android/BUILD", + """ + load(":compatible.bzl", "my_rule") + + my_rule( + name = "bar", + ) + """); + + // Just check that the rule can be analyzed. + assertThat(getConfiguredTarget("//java/android:bar")).isNotNull(); + } }