Use toModule for all "standard" API surfaces

For the purposes of this change a standard API surface is one of the
following:
* public
* system
* test
* module-lib
* system-server

Test: m droid
Bug: 204189791
Change-Id: I88ee9709430ca455dd6c7d1523ae22f8c22b0b7e
This commit is contained in:
Paul Duffin
2021-10-28 11:43:21 +01:00
parent 132c3e61c0
commit e9758b0415

View File

@@ -116,13 +116,13 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext)
} }
} }
toModule := func(modules []string, res string, aidl android.Path) sdkDep { toModule := func(systemModules string, module string, aidl android.Path) sdkDep {
return sdkDep{ return sdkDep{
useModule: true, useModule: true,
bootclasspath: append(modules, config.DefaultLambdaStubsLibrary), bootclasspath: []string{module, config.DefaultLambdaStubsLibrary},
systemModules: "core-current-stubs-system-modules", systemModules: systemModules,
java9Classpath: modules, java9Classpath: []string{module},
frameworkResModule: res, frameworkResModule: "framework-res",
aidl: android.OptionalPathForPath(aidl), aidl: android.OptionalPathForPath(aidl),
} }
} }
@@ -161,11 +161,11 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext)
noFrameworksLibs: true, noFrameworksLibs: true,
} }
case android.SdkPublic: case android.SdkPublic:
return toModule([]string{"android_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx)) return toModule("core-current-stubs-system-modules", "android_stubs_current", sdkFrameworkAidlPath(ctx))
case android.SdkSystem: case android.SdkSystem:
return toModule([]string{"android_system_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx)) return toModule("core-current-stubs-system-modules", "android_system_stubs_current", sdkFrameworkAidlPath(ctx))
case android.SdkTest: case android.SdkTest:
return toModule([]string{"android_test_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx)) return toModule("core-current-stubs-system-modules", "android_test_stubs_current", sdkFrameworkAidlPath(ctx))
case android.SdkCore: case android.SdkCore:
return sdkDep{ return sdkDep{
useModule: true, useModule: true,
@@ -175,24 +175,10 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext)
} }
case android.SdkModule: case android.SdkModule:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules // TODO(146757305): provide .apk and .aidl that have more APIs for modules
return sdkDep{ return toModule("core-module-lib-stubs-system-modules", "android_module_lib_stubs_current", nonUpdatableFrameworkAidlPath(ctx))
useModule: true,
bootclasspath: []string{"android_module_lib_stubs_current", config.DefaultLambdaStubsLibrary},
systemModules: "core-module-lib-stubs-system-modules",
java9Classpath: []string{"android_module_lib_stubs_current"},
frameworkResModule: "framework-res",
aidl: android.OptionalPathForPath(nonUpdatableFrameworkAidlPath(ctx)),
}
case android.SdkSystemServer: case android.SdkSystemServer:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules // TODO(146757305): provide .apk and .aidl that have more APIs for modules
return sdkDep{ return toModule("core-module-lib-stubs-system-modules", "android_system_server_stubs_current", sdkFrameworkAidlPath(ctx))
useModule: true,
bootclasspath: []string{"android_system_server_stubs_current", config.DefaultLambdaStubsLibrary},
systemModules: "core-module-lib-stubs-system-modules",
java9Classpath: []string{"android_system_server_stubs_current"},
frameworkResModule: "framework-res",
aidl: android.OptionalPathForPath(sdkFrameworkAidlPath(ctx)),
}
default: default:
panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw)) panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw))
} }