Update target_sdk_version from SdkSpec to ApiLevel

target_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid target_sdk_version in bp
files

Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999

Change-Id: I3c19245e29184bd9e5660ad8981966f64dfa9424
This commit is contained in:
Spandan Das
2023-03-01 23:38:49 +00:00
parent ddfab60014
commit ca70fc40bd
8 changed files with 31 additions and 23 deletions

View File

@@ -688,11 +688,11 @@ func (j *Module) MinSdkVersionString() string {
return j.minSdkVersion.String()
}
func (j *Module) TargetSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
func (j *Module) TargetSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
if j.deviceProperties.Target_sdk_version != nil {
return android.SdkSpecFrom(ctx, *j.deviceProperties.Target_sdk_version)
return android.ApiLevelFrom(ctx, *j.deviceProperties.Target_sdk_version)
}
return j.SdkVersion(ctx)
return j.SdkVersion(ctx).ApiLevel
}
func (j *Module) AvailableFor(what string) bool {
@@ -1575,7 +1575,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
j.linter.classpath = append(append(android.Paths(nil), flags.bootClasspath...), flags.classpath...)
j.linter.classes = j.implementationJarFile
j.linter.minSdkVersion = lintSDKVersion(j.MinSdkVersion(ctx))
j.linter.targetSdkVersion = lintSDKVersion(j.TargetSdkVersion(ctx).ApiLevel)
j.linter.targetSdkVersion = lintSDKVersion(j.TargetSdkVersion(ctx))
j.linter.compileSdkVersion = lintSDKVersion(j.SdkVersion(ctx).ApiLevel)
j.linter.compileSdkKind = j.SdkVersion(ctx).Kind
j.linter.javaLanguageLevel = flags.javaVersion.String()