Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 881d7202 authored by Sam Delmerico's avatar Sam Delmerico
Browse files

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
parent 10eada74
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ android_app {
				"srcs":           `["app.java"]`,
				"manifest":       `"AndroidManifest.xml"`,
				"resource_files": `["res/res.png"]`,
				"deps":           `["//prebuilts/sdk:public_current_android_sdk_java_import"]`,
			}),
		}})
}
@@ -86,7 +87,10 @@ android_app {
        "resb/res.png",
    ]`,
				"custom_package": `"com.google"`,
				"deps":           `[":static_lib_dep"]`,
				"deps": `[
        "//prebuilts/sdk:public_current_android_sdk_java_import",
        ":static_lib_dep",
    ]`,
			}),
		}})
}
+5 −0
Original line number Diff line number Diff line
@@ -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))
	}