Use OutputFilesProvider on platformBootclasspathModule
In the context of incremental soong, the output files
inter-module-communication will be through OutputFilesProvider.
The OutputFileProducer interface will be deprecated.
Test: CI
Bug: 339477385
Change-Id: I2a5317ae92a11df0a2cb9f803121d03e16859cb2
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 8d4cf68..38553a6 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -15,8 +15,6 @@
package java
import (
- "fmt"
-
"android/soong/android"
"android/soong/dexpreopt"
)
@@ -57,9 +55,6 @@
// Path to the monolithic hiddenapi-unsupported.csv file.
hiddenAPIMetadataCSV android.OutputPath
-
- // Path to a srcjar containing all the transitive sources of the bootclasspath.
- srcjar android.OutputPath
}
type platformBootclasspathProperties struct {
@@ -76,8 +71,6 @@
return m
}
-var _ android.OutputFileProducer = (*platformBootclasspathModule)(nil)
-
func (b *platformBootclasspathModule) AndroidMkEntries() (entries []android.AndroidMkEntries) {
entries = append(entries, android.AndroidMkEntries{
Class: "FAKE",
@@ -89,22 +82,6 @@
return
}
-// Make the hidden API files available from the platform-bootclasspath module.
-func (b *platformBootclasspathModule) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "hiddenapi-flags.csv":
- return android.Paths{b.hiddenAPIFlagsCSV}, nil
- case "hiddenapi-index.csv":
- return android.Paths{b.hiddenAPIIndexCSV}, nil
- case "hiddenapi-metadata.csv":
- return android.Paths{b.hiddenAPIMetadataCSV}, nil
- case ".srcjar":
- return android.Paths{b.srcjar}, nil
- }
-
- return nil, fmt.Errorf("unknown tag %s", tag)
-}
-
func (b *platformBootclasspathModule) DepsMutator(ctx android.BottomUpMutatorContext) {
// Create a dependency on all_apex_contributions to determine the selected mainline module
ctx.AddDependency(ctx.Module(), apexContributionsMetadataDepTag, "all_apex_contributions")
@@ -198,8 +175,8 @@
}
jarArgs := resourcePathsToJarArgs(transitiveSrcFiles)
jarArgs = append(jarArgs, "-srcjar") // Move srcfiles to the right package
- b.srcjar = android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar").OutputPath
- TransformResourcesToJar(ctx, b.srcjar, jarArgs, transitiveSrcFiles)
+ srcjar := android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar").OutputPath
+ TransformResourcesToJar(ctx, srcjar, jarArgs, transitiveSrcFiles)
// Gather all the fragments dependencies.
b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)
@@ -213,6 +190,11 @@
bootDexJarByModule := b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)
buildRuleForBootJarsPackageCheck(ctx, bootDexJarByModule)
+
+ ctx.SetOutputFiles(android.Paths{b.hiddenAPIFlagsCSV}, "hiddenapi-flags.csv")
+ ctx.SetOutputFiles(android.Paths{b.hiddenAPIIndexCSV}, "hiddenapi-index.csv")
+ ctx.SetOutputFiles(android.Paths{b.hiddenAPIMetadataCSV}, "hiddenapi-metadata.csv")
+ ctx.SetOutputFiles(android.Paths{srcjar}, ".srcjar")
}
// Generate classpaths.proto config