bp2build java_libraries depend on Android SDK

Soong adds an implicit dependency on the Android SDK for all
java_libraries (and related modules). This feature becomes apparent
after converting arch-variant srcs for android_apps, so we should suport
this for now. Eventually, we will want to replace this forced dependency
with a Bazel toolchain workaround.

Test: build/bazel/ci/bp2build.sh
Change-Id: Ic28e8c7690f69294b4bdcb9bb78a6f1f031fe97e
This commit is contained in:
Sam Delmerico
2022-02-23 15:18:56 +00:00
parent 10eada743a
commit 881d72022a
2 changed files with 10 additions and 1 deletions

View File

@@ -2030,6 +2030,11 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext)
}
var deps bazel.LabelList
sdkVersion := m.SdkVersion(ctx)
if sdkVersion.Kind == android.SdkPublic && sdkVersion.ApiLevel == android.FutureApiLevel {
// TODO(b/220869005) remove forced dependency on current public android.jar
deps.Add(&bazel.Label{Label: "//prebuilts/sdk:public_current_android_sdk_java_import"})
}
if m.properties.Libs != nil {
deps.Append(android.BazelLabelForModuleDeps(ctx, m.properties.Libs))
}