Use a provider for systems modules

Replace the SystemModulesProvider interface with Provider

Test: all soong tests
Flag: EXEMPT refactor
Change-Id: If313580b28094d55b71f1635259bafa850ef7af5
This commit is contained in:
Colin Cross
2024-08-08 14:04:42 -07:00
parent a66b4630f6
commit b61c226943
4 changed files with 38 additions and 34 deletions

View File

@@ -2374,16 +2374,24 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
case bootClasspathTag:
// If a system modules dependency has been added to the bootclasspath
// then add its libs to the bootclasspath.
sm := module.(SystemModulesProvider)
deps.bootClasspath = append(deps.bootClasspath, sm.HeaderJars()...)
if sm, ok := android.OtherModuleProvider(ctx, module, SystemModulesProvider); ok {
depHeaderJars := sm.HeaderJars
deps.bootClasspath = append(deps.bootClasspath, depHeaderJars...)
} else {
ctx.PropertyErrorf("boot classpath dependency %q does not provide SystemModulesProvider",
ctx.OtherModuleName(module))
}
case systemModulesTag:
if deps.systemModules != nil {
panic("Found two system module dependencies")
}
sm := module.(SystemModulesProvider)
outputDir, outputDeps := sm.OutputDirAndDeps()
deps.systemModules = &systemModules{outputDir, outputDeps}
if sm, ok := android.OtherModuleProvider(ctx, module, SystemModulesProvider); ok {
deps.systemModules = &systemModules{sm.OutputDir, sm.OutputDirDeps}
} else {
ctx.PropertyErrorf("system modules dependency %q does not provide SystemModulesProvider",
ctx.OtherModuleName(module))
}
case instrumentationForTag:
ctx.PropertyErrorf("instrumentation_for", "dependency %q of type %q does not provide JavaInfo so is unsuitable for use with this property", ctx.OtherModuleName(module), ctx.OtherModuleType(module))