Merge "Use common java library attributes for android_app bp2build converter." am: 99a81c8dfd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1969119 Change-Id: I124df7f67ba7066b73bd3bc3c234e5c1b78aec07
This commit is contained in:
17
java/app.go
17
java/app.go
@@ -1432,17 +1432,15 @@ func androidAppCertificateBp2Build(ctx android.TopDownMutatorContext, module *An
|
|||||||
}
|
}
|
||||||
|
|
||||||
type bazelAndroidAppAttributes struct {
|
type bazelAndroidAppAttributes struct {
|
||||||
Srcs bazel.LabelListAttribute
|
*javaLibraryAttributes
|
||||||
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.
|
||||||
func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||||
//TODO(b/209577426): Support multiple arch variants
|
libAttrs := a.convertLibraryAttrsBp2Build(ctx)
|
||||||
srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, a.properties.Srcs, a.properties.Exclude_srcs))
|
|
||||||
|
|
||||||
manifest := proptools.StringDefault(a.aaptProperties.Manifest, "AndroidManifest.xml")
|
manifest := proptools.StringDefault(a.aaptProperties.Manifest, "AndroidManifest.xml")
|
||||||
|
|
||||||
@@ -1454,15 +1452,12 @@ 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,
|
libAttrs,
|
||||||
Manifest: android.BazelLabelForModuleSrcSingle(ctx, 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,
|
a.overridableAppProperties.Package_name,
|
||||||
Resource_files: bazel.MakeLabelListAttribute(resourceFiles),
|
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"}
|
||||||
|
@@ -2011,6 +2011,7 @@ type javaLibraryAttributes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) *javaLibraryAttributes {
|
func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) *javaLibraryAttributes {
|
||||||
|
//TODO(b/209577426): Support multiple arch variants
|
||||||
srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs))
|
srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs))
|
||||||
attrs := &javaLibraryAttributes{
|
attrs := &javaLibraryAttributes{
|
||||||
Srcs: srcs,
|
Srcs: srcs,
|
||||||
|
Reference in New Issue
Block a user