Use OutputFilesProvider on certain module types
The module types below no longer implement OutputFileProducer, but
use OutputFilesProvider for output files inter-module-communication.
se_policy_conf
se_policy_cil
se_policy_binary
se_compat_cil
se_versioned_policy
Test: CI
Bug: 339477385
Change-Id: I87d1845162f91065acd7d2f6c27fd7583cc8b5e0
diff --git a/build/soong/compat_cil.go b/build/soong/compat_cil.go
index baad413..3b9d5e2 100644
--- a/build/soong/compat_cil.go
+++ b/build/soong/compat_cil.go
@@ -92,6 +92,10 @@
c.installPath = android.PathForModuleInstall(ctx, "etc", "selinux", "mapping")
c.installSource = android.OptionalPathForPath(out)
ctx.InstallFile(c.installPath, c.stem(), out)
+
+ if c.installSource.Valid() {
+ ctx.SetOutputFiles(android.Paths{c.installSource.Path()}, "")
+ }
}
func (c *compatCil) AndroidMkEntries() []android.AndroidMkEntries {
@@ -110,21 +114,6 @@
}}
}
-func (c *compatCil) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- if c.installSource.Valid() {
- return android.Paths{c.installSource.Path()}, nil
- } else {
- return nil, nil
- }
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
-var _ android.OutputFileProducer = (*compatCil)(nil)
-
// se_compat_test checks if compat files ({ver}.cil, {ver}.compat.cil) files are compatible with
// current policy.
func compatTestFactory() android.SingletonModule {
@@ -239,15 +228,7 @@
func (f *compatTestModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
var inputs android.Paths
ctx.VisitDirectDepsWithTag(compatTestDepTag, func(child android.Module) {
- o, ok := child.(android.OutputFileProducer)
- if !ok {
- panic(fmt.Errorf("Module %q should be an OutputFileProducer but it isn't", ctx.OtherModuleName(child)))
- }
-
- outputs, err := o.OutputFiles("")
- if err != nil {
- panic(fmt.Errorf("Module %q error while producing output: %v", ctx.OtherModuleName(child), err))
- }
+ outputs := android.OutputFilesForModule(ctx, child, "")
if len(outputs) != 1 {
panic(fmt.Errorf("Module %q should produce exactly one output, but did %q", ctx.OtherModuleName(child), outputs.Strings()))
}