Merge "Mark android_* modules with java_resources as unconvertible" into main

This commit is contained in:
Alix Espino 2023-09-22 14:56:18 +00:00 committed by Gerrit Code Review
commit c62b27a7ea
2 changed files with 16 additions and 0 deletions

View file

@ -1352,6 +1352,9 @@ func (a *AndroidLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext)
if !supported { if !supported {
return return
} }
if hasJavaResources := aaptAttrs.ConvertJavaResources(ctx, commonAttrs); hasJavaResources {
return
}
ctx.CreateBazelTargetModule( ctx.CreateBazelTargetModule(
props, props,
android.CommonAttributes{Name: name}, android.CommonAttributes{Name: name},

View file

@ -1638,6 +1638,15 @@ type bazelAndroidAppAttributes struct {
Updatable *bool Updatable *bool
} }
func (b bazelAapt) ConvertJavaResources(ctx android.Bp2buildMutatorContext, javaAttrs *javaCommonAttributes) bool {
// TODO (b/300470246) bp2build support for java_resources & java_resource_dirs in android rules
hasJavaResources := !javaAttrs.javaResourcesAttributes.Resources.IsEmpty()
if hasJavaResources {
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_UNSUPPORTED, "(b/300470246) java resources in android_* module")
}
return hasJavaResources
}
func convertWithBp2build(ctx android.Bp2buildMutatorContext, a *AndroidApp) (bool, android.CommonAttributes, *bazelAndroidAppAttributes) { func convertWithBp2build(ctx android.Bp2buildMutatorContext, a *AndroidApp) (bool, android.CommonAttributes, *bazelAndroidAppAttributes) {
aapt, supported := a.convertAaptAttrsWithBp2Build(ctx) aapt, supported := a.convertAaptAttrsWithBp2Build(ctx)
if !supported { if !supported {
@ -1712,6 +1721,10 @@ func convertWithBp2build(ctx android.Bp2buildMutatorContext, a *AndroidApp) (boo
if !supported { if !supported {
return false, android.CommonAttributes{}, &bazelAndroidAppAttributes{} return false, android.CommonAttributes{}, &bazelAndroidAppAttributes{}
} }
if hasJavaResources := aapt.ConvertJavaResources(ctx, commonAttrs); hasJavaResources {
return false, android.CommonAttributes{}, &bazelAndroidAppAttributes{}
}
depLabels := bp2BuildInfo.DepLabels depLabels := bp2BuildInfo.DepLabels
deps := depLabels.Deps deps := depLabels.Deps