Use system modules for prebuilt SDKs >=30
Prebuilt SDKs >=30 now contain core-for-system-modules.jar, convert them to system modules and use them when compiling against the SDK to allow using javac -source 1.9 -target 1.9. Bug: 117069453 Test: TestClasspath Change-Id: Iebadad5980b952ed91c3ffd56cff1ce1827d3247 Merged-In: Iebadad5980b952ed91c3ffd56cff1ce1827d3247
This commit is contained in:
26
java/sdk.go
26
java/sdk.go
@@ -252,6 +252,20 @@ func (s sdkSpec) effectiveVersionString(ctx android.EarlyModuleContext) (string,
|
||||
return ver.String(), err
|
||||
}
|
||||
|
||||
func (s sdkSpec) defaultJavaLanguageVersion(ctx android.EarlyModuleContext) javaVersion {
|
||||
sdk, err := s.effectiveVersion(ctx)
|
||||
if err != nil {
|
||||
ctx.PropertyErrorf("sdk_version", "%s", err)
|
||||
}
|
||||
if sdk <= 23 {
|
||||
return JAVA_VERSION_7
|
||||
} else if sdk <= 29 {
|
||||
return JAVA_VERSION_8
|
||||
} else {
|
||||
return JAVA_VERSION_9
|
||||
}
|
||||
}
|
||||
|
||||
func sdkSpecFrom(str string) sdkSpec {
|
||||
switch str {
|
||||
// special cases first
|
||||
@@ -370,10 +384,16 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep
|
||||
return sdkDep{}
|
||||
}
|
||||
|
||||
var systemModules string
|
||||
if sdkVersion.defaultJavaLanguageVersion(ctx).usesJavaModules() {
|
||||
systemModules = "sdk_public_" + sdkVersion.version.String() + "_system_modules"
|
||||
}
|
||||
|
||||
return sdkDep{
|
||||
useFiles: true,
|
||||
jars: android.Paths{jarPath.Path(), lambdaStubsPath},
|
||||
aidl: android.OptionalPathForPath(aidlPath.Path()),
|
||||
useFiles: true,
|
||||
jars: android.Paths{jarPath.Path(), lambdaStubsPath},
|
||||
aidl: android.OptionalPathForPath(aidlPath.Path()),
|
||||
systemModules: systemModules,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user