apex: checks min_sdk_version for preview/current
If we don't check "current", it won't be checked even in the finalized branch. If we don't check "preview", it should be done during the SDK finalization. It'd be better done before the SDK finalization regarding that setting min_sdk_version is to get approval from deps library owners. Bug: 177833148 Test: m (soong tests) Change-Id: I712b61cfe5a134fbb69c73956d26fb3a1e5c011e
This commit is contained in:
14
apex/apex.go
14
apex/apex.go
@@ -854,11 +854,17 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||
Contents: apexContents,
|
||||
})
|
||||
|
||||
minSdkVersion := a.minSdkVersion(mctx)
|
||||
// When min_sdk_version is not set, the apex is built against FutureApiLevel.
|
||||
if minSdkVersion.IsNone() {
|
||||
minSdkVersion = android.FutureApiLevel
|
||||
}
|
||||
|
||||
// This is the main part of this mutator. Mark the collected dependencies that they need to
|
||||
// be built for this apexBundle.
|
||||
apexInfo := android.ApexInfo{
|
||||
ApexVariationName: mctx.ModuleName(),
|
||||
MinSdkVersionStr: a.minSdkVersion(mctx).String(),
|
||||
MinSdkVersionStr: minSdkVersion.String(),
|
||||
RequiredSdks: a.RequiredSdks(),
|
||||
Updatable: a.Updatable(),
|
||||
InApexes: []string{mctx.ModuleName()},
|
||||
@@ -2116,17 +2122,13 @@ func (a *apexBundle) checkMinSdkVersion(ctx android.ModuleContext) {
|
||||
func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) android.ApiLevel {
|
||||
ver := proptools.String(a.properties.Min_sdk_version)
|
||||
if ver == "" {
|
||||
return android.FutureApiLevel
|
||||
return android.NoneApiLevel
|
||||
}
|
||||
apiLevel, err := android.ApiLevelFromUser(ctx, ver)
|
||||
if err != nil {
|
||||
ctx.PropertyErrorf("min_sdk_version", "%s", err.Error())
|
||||
return android.NoneApiLevel
|
||||
}
|
||||
if apiLevel.IsPreview() {
|
||||
// All codenames should build against "current".
|
||||
return android.FutureApiLevel
|
||||
}
|
||||
return apiLevel
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user