Use a provider for systems modules
Replace the SystemModulesProvider interface with Provider
Test: all soong tests
Flag: EXEMPT refactor
Change-Id: If313580b28094d55b71f1635259bafa850ef7af5
diff --git a/java/system_modules.go b/java/system_modules.go
index 48b33ba..5b00079 100644
--- a/java/system_modules.go
+++ b/java/system_modules.go
@@ -120,14 +120,16 @@
return module
}
-type SystemModulesProvider interface {
- HeaderJars() android.Paths
- OutputDirAndDeps() (android.Path, android.Paths)
+type SystemModulesProviderInfo struct {
+ // The aggregated header jars from all jars specified in the libs property.
+ // Used when system module is added as a dependency to bootclasspath.
+ HeaderJars android.Paths
+
+ OutputDir android.Path
+ OutputDirDeps android.Paths
}
-var _ SystemModulesProvider = (*SystemModules)(nil)
-
-var _ SystemModulesProvider = (*systemModulesImport)(nil)
+var SystemModulesProvider = blueprint.NewProvider[*SystemModulesProviderInfo]()
type SystemModules struct {
android.ModuleBase
@@ -135,9 +137,6 @@
properties SystemModulesProperties
- // The aggregated header jars from all jars specified in the libs property.
- // Used when system module is added as a dependency to bootclasspath.
- headerJars android.Paths
outputDir android.Path
outputDeps android.Paths
}
@@ -147,17 +146,6 @@
Libs []string
}
-func (system *SystemModules) HeaderJars() android.Paths {
- return system.headerJars
-}
-
-func (system *SystemModules) OutputDirAndDeps() (android.Path, android.Paths) {
- if system.outputDir == nil || len(system.outputDeps) == 0 {
- panic("Missing directory for system module dependency")
- }
- return system.outputDir, system.outputDeps
-}
-
func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleContext) {
var jars android.Paths
@@ -167,9 +155,13 @@
}
})
- system.headerJars = jars
-
system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, jars)
+
+ android.SetProvider(ctx, SystemModulesProvider, &SystemModulesProviderInfo{
+ HeaderJars: jars,
+ OutputDir: system.outputDir,
+ OutputDirDeps: system.outputDeps,
+ })
}
// ComponentDepsMutator is called before prebuilt modules without a corresponding source module are