Make prebuilt_api test environment realistic
Previously, the fixture preparer for prebuilt_apis would add a core-for-system-modules.jar file in every API directory even though currently they only exist in the public API directories. This change makes the test environment more realistic by only creating them for the public API. Rather than hard code that into the test code (which would duplicate the hard coding in the decodeSdkDep func) this extracts a function that is used by both. That ensures that any changes to that func will be reflected in both the test and runtime behavior. Bug: 204189791 Test: m nothing Change-Id: I346ac9c0dcf407c61de16b6027663a05821bcf62
This commit is contained in:
@@ -60,6 +60,12 @@ func defaultJavaLanguageVersion(ctx android.EarlyModuleContext, s android.SdkSpe
|
||||
}
|
||||
}
|
||||
|
||||
// systemModuleKind returns the kind of system modules to use.
|
||||
func systemModuleKind() android.SdkKind {
|
||||
// Currently, every sdk version uses the system modules for the public API.
|
||||
return android.SdkPublic
|
||||
}
|
||||
|
||||
func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext) sdkDep {
|
||||
sdkVersion := sdkContext.SdkVersion(ctx)
|
||||
if !sdkVersion.Valid() {
|
||||
@@ -105,7 +111,8 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext)
|
||||
|
||||
var systemModules string
|
||||
if defaultJavaLanguageVersion(ctx, sdkVersion).usesJavaModules() {
|
||||
systemModules = "sdk_public_" + sdkVersion.ApiLevel.String() + "_system_modules"
|
||||
systemModuleKind := systemModuleKind()
|
||||
systemModules = fmt.Sprintf("sdk_%s_%s_system_modules", systemModuleKind, sdkVersion.ApiLevel)
|
||||
}
|
||||
|
||||
return sdkDep{
|
||||
|
Reference in New Issue
Block a user