Merge "Bp2build support for JNI deps of android_app." into main am: 1c4048e08d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2622674 Change-Id: Ie3d0fefd42a14038e97cbecb5e93f677dca3cbda Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
4bc34aa84e
3 changed files with 31 additions and 6 deletions
|
@ -854,6 +854,10 @@ var (
|
||||||
|
|
||||||
"libstagefright_headers",
|
"libstagefright_headers",
|
||||||
|
|
||||||
|
// Apps with JNI libs
|
||||||
|
"SimpleJNI",
|
||||||
|
"libsimplejni",
|
||||||
|
|
||||||
// aidl
|
// aidl
|
||||||
"aidl",
|
"aidl",
|
||||||
"libaidl-common",
|
"libaidl-common",
|
||||||
|
|
|
@ -16,6 +16,7 @@ package bp2build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
"android/soong/cc"
|
||||||
"android/soong/java"
|
"android/soong/java"
|
||||||
|
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -29,6 +30,7 @@ func runAndroidAppTestCase(t *testing.T, tc Bp2buildTestCase) {
|
||||||
func registerAndroidAppModuleTypes(ctx android.RegistrationContext) {
|
func registerAndroidAppModuleTypes(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
||||||
ctx.RegisterModuleType("java_library", java.LibraryFactory)
|
ctx.RegisterModuleType("java_library", java.LibraryFactory)
|
||||||
|
ctx.RegisterModuleType("cc_library_shared", cc.LibrarySharedFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMinimalAndroidApp(t *testing.T) {
|
func TestMinimalAndroidApp(t *testing.T) {
|
||||||
|
@ -78,8 +80,9 @@ func TestAndroidAppAllSupportedFields(t *testing.T) {
|
||||||
"manifest/AndroidManifest.xml": "",
|
"manifest/AndroidManifest.xml": "",
|
||||||
"assets_/asset.png": "",
|
"assets_/asset.png": "",
|
||||||
},
|
},
|
||||||
StubbedBuildDefinitions: []string{"static_lib_dep"},
|
StubbedBuildDefinitions: []string{"static_lib_dep", "jni_lib"},
|
||||||
Blueprint: simpleModule("android_app", "static_lib_dep") + `
|
Blueprint: simpleModule("android_app", "static_lib_dep") +
|
||||||
|
simpleModule("cc_library_shared", "jni_lib") + `
|
||||||
android_app {
|
android_app {
|
||||||
name: "TestApp",
|
name: "TestApp",
|
||||||
srcs: ["app.java"],
|
srcs: ["app.java"],
|
||||||
|
@ -100,6 +103,7 @@ android_app {
|
||||||
obfuscate: false,
|
obfuscate: false,
|
||||||
ignore_warnings: true,
|
ignore_warnings: true,
|
||||||
},
|
},
|
||||||
|
jni_libs: ["jni_lib"],
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
ExpectedBazelTargets: []string{
|
ExpectedBazelTargets: []string{
|
||||||
|
@ -110,10 +114,13 @@ android_app {
|
||||||
"resa/res.png",
|
"resa/res.png",
|
||||||
"resb/res.png",
|
"resb/res.png",
|
||||||
]`,
|
]`,
|
||||||
"assets": `["assets_/asset.png"]`,
|
"assets": `["assets_/asset.png"]`,
|
||||||
"assets_dir": `"assets_"`,
|
"assets_dir": `"assets_"`,
|
||||||
"custom_package": `"com.google"`,
|
"custom_package": `"com.google"`,
|
||||||
"deps": `[":static_lib_dep"]`,
|
"deps": `[
|
||||||
|
":static_lib_dep",
|
||||||
|
":jni_lib",
|
||||||
|
]`,
|
||||||
"java_version": `"7"`,
|
"java_version": `"7"`,
|
||||||
"sdk_version": `"current"`,
|
"sdk_version": `"current"`,
|
||||||
"certificate_name": `"foocert"`,
|
"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 := depLabels.Deps
|
||||||
deps.Append(depLabels.StaticDeps)
|
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 {
|
if !bp2BuildInfo.hasKotlin {
|
||||||
appAttrs.javaCommonAttributes = commonAttrs
|
appAttrs.javaCommonAttributes = commonAttrs
|
||||||
appAttrs.bazelAapt = aapt
|
appAttrs.bazelAapt = aapt
|
||||||
|
|
Loading…
Reference in a new issue