bp2build java_resources that only contain a filegroup

supports filegroup that specifies path property

Bug: 280860624
Test: built libauto_value_plugin
Change-Id: I9ed0b13e055beb92ba8090f6b5e88b9873c9ce61
This commit is contained in:
Alix
2023-05-09 20:37:49 +00:00
parent cd4e6a609e
commit b29a3cd2aa
4 changed files with 72 additions and 2 deletions

View File

@@ -177,6 +177,17 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) {
}
}
type FileGroupPath interface {
GetPath(ctx TopDownMutatorContext) string
}
func (fg *fileGroup) GetPath(ctx TopDownMutatorContext) string {
if fg.properties.Path != nil {
return *fg.properties.Path
}
return ""
}
type fileGroupProperties struct {
// srcs lists files that will be included in this filegroup
Srcs []string `android:"path"`
@@ -207,6 +218,7 @@ type fileGroup struct {
BazelModuleBase
DefaultableModuleBase
FileGroupAsLibrary
FileGroupPath
properties fileGroupProperties
srcs Paths
}
@@ -214,6 +226,7 @@ type fileGroup struct {
var _ MixedBuildBuildable = (*fileGroup)(nil)
var _ SourceFileProducer = (*fileGroup)(nil)
var _ FileGroupAsLibrary = (*fileGroup)(nil)
var _ FileGroupPath = (*fileGroup)(nil)
// filegroup contains a list of files that are referenced by other modules
// properties (such as "srcs") using the syntax ":<name>". filegroup are