Separate metadata provider from apex contents provider
The platform_compat_config_singleton only needs access to the metadata so this separates that method into its own interface, distinct from the one needed by the apex. This also adds a test to ensure that the merging still works. Bug: 182402754 Test: m nothing Change-Id: I5212239786810e5fc5eb99831b1122db93d1329f
This commit is contained in:
@@ -48,7 +48,7 @@ type platformCompatConfig struct {
|
||||
metadataFile android.OutputPath
|
||||
}
|
||||
|
||||
func (p *platformCompatConfig) compatConfigMetadata() android.OutputPath {
|
||||
func (p *platformCompatConfig) compatConfigMetadata() android.Path {
|
||||
return p.metadataFile
|
||||
}
|
||||
|
||||
@@ -60,16 +60,20 @@ func (p *platformCompatConfig) SubDir() string {
|
||||
return "compatconfig"
|
||||
}
|
||||
|
||||
type platformCompatConfigMetadataProvider interface {
|
||||
compatConfigMetadata() android.Path
|
||||
}
|
||||
|
||||
type PlatformCompatConfigIntf interface {
|
||||
android.Module
|
||||
|
||||
compatConfigMetadata() android.OutputPath
|
||||
CompatConfig() android.OutputPath
|
||||
// Sub dir under etc dir.
|
||||
SubDir() string
|
||||
}
|
||||
|
||||
var _ PlatformCompatConfigIntf = (*platformCompatConfig)(nil)
|
||||
var _ platformCompatConfigMetadataProvider = (*platformCompatConfig)(nil)
|
||||
|
||||
func (p *platformCompatConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
rule := android.NewRuleBuilder(pctx, ctx)
|
||||
@@ -122,7 +126,7 @@ func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.Singlet
|
||||
var compatConfigMetadata android.Paths
|
||||
|
||||
ctx.VisitAllModules(func(module android.Module) {
|
||||
if c, ok := module.(PlatformCompatConfigIntf); ok {
|
||||
if c, ok := module.(platformCompatConfigMetadataProvider); ok {
|
||||
metadata := c.compatConfigMetadata()
|
||||
compatConfigMetadata = append(compatConfigMetadata, metadata)
|
||||
}
|
||||
|
Reference in New Issue
Block a user