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/base.go b/java/base.go
index f820629..daa50ef 100644
--- a/java/base.go
+++ b/java/base.go
@@ -2374,16 +2374,24 @@
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))