Merge "Add static_libs support to android_app bp2build converter."
This commit is contained in:
commit
24431448b2
3 changed files with 8 additions and 1 deletions
|
@ -281,6 +281,7 @@ var (
|
||||||
"development/samples/USB/MissileLauncher": Bp2BuildDefaultTrue,
|
"development/samples/USB/MissileLauncher": Bp2BuildDefaultTrue,
|
||||||
"development/samples/VoiceRecognitionService": Bp2BuildDefaultTrue,
|
"development/samples/VoiceRecognitionService": Bp2BuildDefaultTrue,
|
||||||
"development/samples/VoicemailProviderDemo": Bp2BuildDefaultTrue,
|
"development/samples/VoicemailProviderDemo": Bp2BuildDefaultTrue,
|
||||||
|
"development/samples/WiFiDirectDemo": Bp2BuildDefaultTrue,
|
||||||
"development/sdk": Bp2BuildDefaultTrueRecursively,
|
"development/sdk": Bp2BuildDefaultTrueRecursively,
|
||||||
"external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,
|
"external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,
|
||||||
"external/boringssl": Bp2BuildDefaultTrueRecursively,
|
"external/boringssl": Bp2BuildDefaultTrueRecursively,
|
||||||
|
|
|
@ -66,7 +66,7 @@ func TestAndroidAppAllSupportedFields(t *testing.T) {
|
||||||
"resb/res.png": "",
|
"resb/res.png": "",
|
||||||
"manifest/AndroidManifest.xml": "",
|
"manifest/AndroidManifest.xml": "",
|
||||||
},
|
},
|
||||||
blueprint: `
|
blueprint: simpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + `
|
||||||
android_app {
|
android_app {
|
||||||
name: "TestApp",
|
name: "TestApp",
|
||||||
srcs: ["app.java"],
|
srcs: ["app.java"],
|
||||||
|
@ -74,6 +74,7 @@ android_app {
|
||||||
package_name: "com.google",
|
package_name: "com.google",
|
||||||
resource_dirs: ["resa", "resb"],
|
resource_dirs: ["resa", "resb"],
|
||||||
manifest: "manifest/AndroidManifest.xml",
|
manifest: "manifest/AndroidManifest.xml",
|
||||||
|
static_libs: ["static_lib_dep"]
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
expectedBazelTargets: []string{
|
expectedBazelTargets: []string{
|
||||||
|
@ -85,6 +86,7 @@ android_app {
|
||||||
"resb/res.png",
|
"resb/res.png",
|
||||||
]`,
|
]`,
|
||||||
"custom_package": `"com.google"`,
|
"custom_package": `"com.google"`,
|
||||||
|
"deps": `[":static_lib_dep"]`,
|
||||||
}),
|
}),
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1436,6 +1436,7 @@ type bazelAndroidAppAttributes struct {
|
||||||
Manifest bazel.Label
|
Manifest bazel.Label
|
||||||
Custom_package *string
|
Custom_package *string
|
||||||
Resource_files bazel.LabelListAttribute
|
Resource_files bazel.LabelListAttribute
|
||||||
|
Deps bazel.LabelListAttribute
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertWithBp2build is used to convert android_app to Bazel.
|
// ConvertWithBp2build is used to convert android_app to Bazel.
|
||||||
|
@ -1453,12 +1454,15 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||||
resourceFiles.Includes = append(resourceFiles.Includes, files...)
|
resourceFiles.Includes = append(resourceFiles.Includes, files...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deps := bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, a.properties.Static_libs))
|
||||||
|
|
||||||
attrs := &bazelAndroidAppAttributes{
|
attrs := &bazelAndroidAppAttributes{
|
||||||
Srcs: srcs,
|
Srcs: srcs,
|
||||||
Manifest: android.BazelLabelForModuleSrcSingle(ctx, manifest),
|
Manifest: android.BazelLabelForModuleSrcSingle(ctx, manifest),
|
||||||
// TODO(b/209576404): handle package name override by product variable PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
|
// TODO(b/209576404): handle package name override by product variable PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
|
||||||
Custom_package: a.overridableAppProperties.Package_name,
|
Custom_package: a.overridableAppProperties.Package_name,
|
||||||
Resource_files: bazel.MakeLabelListAttribute(resourceFiles),
|
Resource_files: bazel.MakeLabelListAttribute(resourceFiles),
|
||||||
|
Deps: deps,
|
||||||
}
|
}
|
||||||
props := bazel.BazelTargetModuleProperties{Rule_class: "android_binary",
|
props := bazel.BazelTargetModuleProperties{Rule_class: "android_binary",
|
||||||
Bzl_load_location: "@rules_android//rules:rules.bzl"}
|
Bzl_load_location: "@rules_android//rules:rules.bzl"}
|
||||||
|
|
Loading…
Reference in a new issue