Merge "convert android_app certificate property, bp2build"

This commit is contained in:
Sam Delmerico 2022-03-04 17:30:31 +00:00 committed by Gerrit Code Review
commit d508a638c3
2 changed files with 26 additions and 6 deletions

View file

@ -227,6 +227,7 @@ var (
"prebuilts/gcc":/* recursive = */ true,
"prebuilts/build-tools":/* recursive = */ false,
"prebuilts/jdk/jdk11":/* recursive = */ false,
"prebuilts/sdk":/* recursive = */ false,
"prebuilts/sdk/current/extras/app-toolkit":/* recursive = */ false,
"prebuilts/sdk/current/support":/* recursive = */ false,
@ -245,6 +246,7 @@ var (
"build/bazel/examples/soong_config_variables": Bp2BuildDefaultTrueRecursively,
"build/bazel/examples/apex/minimal": Bp2BuildDefaultTrueRecursively,
"build/make/tools/signapk": Bp2BuildDefaultTrue,
"build/make/target/product/security": Bp2BuildDefaultTrue,
"build/soong": Bp2BuildDefaultTrue,
"build/soong/cc/libbuildversion": Bp2BuildDefaultTrue, // Skip tests subdir
"build/soong/cc/ndkstubgen": Bp2BuildDefaultTrue,
@ -325,6 +327,7 @@ var (
"external/zstd": Bp2BuildDefaultTrueRecursively,
"frameworks/base/media/tests/MediaDump": Bp2BuildDefaultTrue,
"frameworks/base/startop/apps/test": Bp2BuildDefaultTrue,
"frameworks/base/tests/appwidgets/AppWidgetHostTest": Bp2BuildDefaultTrueRecursively,
"frameworks/native/libs/adbd_auth": Bp2BuildDefaultTrueRecursively,
"frameworks/native/opengl/tests/gl2_cameraeye": Bp2BuildDefaultTrue,
"frameworks/native/opengl/tests/gl2_java": Bp2BuildDefaultTrue,

View file

@ -1443,7 +1443,7 @@ func androidAppCertificateBp2Build(ctx android.TopDownMutatorContext, module *An
props := bazel.BazelTargetModuleProperties{
Rule_class: "android_app_certificate",
Bzl_load_location: "//build/bazel/rules:android_app_certificate.bzl",
Bzl_load_location: "//build/bazel/rules/android:android_app_certificate.bzl",
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs)
@ -1451,9 +1451,11 @@ func androidAppCertificateBp2Build(ctx android.TopDownMutatorContext, module *An
type bazelAndroidAppAttributes struct {
*javaLibraryAttributes
Manifest bazel.Label
Custom_package *string
Resource_files bazel.LabelListAttribute
Manifest bazel.Label
Custom_package *string
Resource_files bazel.LabelListAttribute
Certificate *bazel.Label
Certificate_name *string
}
// ConvertWithBp2build is used to convert android_app to Bazel.
@ -1470,15 +1472,30 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
resourceFiles.Includes = append(resourceFiles.Includes, files...)
}
var certificate *bazel.Label
certificateNamePtr := a.overridableAppProperties.Certificate
certificateName := proptools.StringDefault(certificateNamePtr, "")
certModule := android.SrcIsModule(certificateName)
if certModule != "" {
c := android.BazelLabelForModuleDepSingle(ctx, certificateName)
certificate = &c
certificateNamePtr = nil
}
attrs := &bazelAndroidAppAttributes{
libAttrs,
android.BazelLabelForModuleSrcSingle(ctx, manifest),
// TODO(b/209576404): handle package name override by product variable PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
a.overridableAppProperties.Package_name,
bazel.MakeLabelListAttribute(resourceFiles),
certificate,
certificateNamePtr,
}
props := bazel.BazelTargetModuleProperties{
Rule_class: "android_binary",
Bzl_load_location: "//build/bazel/rules/android:android_binary.bzl",
}
props := bazel.BazelTargetModuleProperties{Rule_class: "android_binary",
Bzl_load_location: "@rules_android//rules:rules.bzl"}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: a.Name()}, attrs)