Merge "Bp2build support for JNI deps of android_app." into main
This commit is contained in:
commit
1c4048e08d
3 changed files with 31 additions and 6 deletions
|
@ -854,6 +854,10 @@ var (
|
|||
|
||||
"libstagefright_headers",
|
||||
|
||||
// Apps with JNI libs
|
||||
"SimpleJNI",
|
||||
"libsimplejni",
|
||||
|
||||
// aidl
|
||||
"aidl",
|
||||
"libaidl-common",
|
||||
|
|
|
@ -16,6 +16,7 @@ package bp2build
|
|||
|
||||
import (
|
||||
"android/soong/android"
|
||||
"android/soong/cc"
|
||||
"android/soong/java"
|
||||
|
||||
"testing"
|
||||
|
@ -29,6 +30,7 @@ func runAndroidAppTestCase(t *testing.T, tc Bp2buildTestCase) {
|
|||
func registerAndroidAppModuleTypes(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
||||
ctx.RegisterModuleType("java_library", java.LibraryFactory)
|
||||
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
|
||||
}
|
||||
|
||||
func TestMinimalAndroidApp(t *testing.T) {
|
||||
|
@ -78,8 +80,9 @@ func TestAndroidAppAllSupportedFields(t *testing.T) {
|
|||
"manifest/AndroidManifest.xml": "",
|
||||
"assets_/asset.png": "",
|
||||
},
|
||||
StubbedBuildDefinitions: []string{"static_lib_dep"},
|
||||
Blueprint: simpleModule("android_app", "static_lib_dep") + `
|
||||
StubbedBuildDefinitions: []string{"static_lib_dep", "jni_lib"},
|
||||
Blueprint: simpleModule("android_app", "static_lib_dep") +
|
||||
simpleModule("cc_library_shared", "jni_lib") + `
|
||||
android_app {
|
||||
name: "TestApp",
|
||||
srcs: ["app.java"],
|
||||
|
@ -100,6 +103,7 @@ android_app {
|
|||
obfuscate: false,
|
||||
ignore_warnings: true,
|
||||
},
|
||||
jni_libs: ["jni_lib"],
|
||||
}
|
||||
`,
|
||||
ExpectedBazelTargets: []string{
|
||||
|
@ -110,10 +114,13 @@ android_app {
|
|||
"resa/res.png",
|
||||
"resb/res.png",
|
||||
]`,
|
||||
"assets": `["assets_/asset.png"]`,
|
||||
"assets_dir": `"assets_"`,
|
||||
"custom_package": `"com.google"`,
|
||||
"deps": `[":static_lib_dep"]`,
|
||||
"assets": `["assets_/asset.png"]`,
|
||||
"assets_dir": `"assets_"`,
|
||||
"custom_package": `"com.google"`,
|
||||
"deps": `[
|
||||
":static_lib_dep",
|
||||
":jni_lib",
|
||||
]`,
|
||||
"java_version": `"7"`,
|
||||
"sdk_version": `"current"`,
|
||||
"certificate_name": `"foocert"`,
|
||||
|
|
14
java/app.go
14
java/app.go
|
@ -1732,6 +1732,20 @@ func convertWithBp2build(ctx android.Bp2buildMutatorContext, a *AndroidApp) (boo
|
|||
deps := depLabels.Deps
|
||||
deps.Append(depLabels.StaticDeps)
|
||||
|
||||
var jniDeps bazel.LabelListAttribute
|
||||
archVariantProps := a.GetArchVariantProperties(ctx, &appProperties{})
|
||||
for axis, configToProps := range archVariantProps {
|
||||
for config, _props := range configToProps {
|
||||
if archProps, ok := _props.(*appProperties); ok {
|
||||
archJniLibs := android.BazelLabelForModuleDeps(
|
||||
ctx,
|
||||
android.LastUniqueStrings(android.CopyOf(archProps.Jni_libs)))
|
||||
jniDeps.SetSelectValue(axis, config, archJniLibs)
|
||||
}
|
||||
}
|
||||
}
|
||||
deps.Append(jniDeps)
|
||||
|
||||
if !bp2BuildInfo.hasKotlin {
|
||||
appAttrs.javaCommonAttributes = commonAttrs
|
||||
appAttrs.bazelAapt = aapt
|
||||
|
|
Loading…
Reference in a new issue