Merge "Update min_sdk_version from SdkSpec to ApiLevel"
This commit is contained in:
commit
ddfab60014
18 changed files with 83 additions and 71 deletions
|
@ -845,7 +845,7 @@ type WalkPayloadDepsFunc func(ctx ModuleContext, do PayloadDepsCallback)
|
|||
// ModuleWithMinSdkVersionCheck represents a module that implements min_sdk_version checks
|
||||
type ModuleWithMinSdkVersionCheck interface {
|
||||
Module
|
||||
MinSdkVersion(ctx EarlyModuleContext) SdkSpec
|
||||
MinSdkVersion(ctx EarlyModuleContext) ApiLevel
|
||||
CheckMinSdkVersion(ctx ModuleContext)
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,14 @@ func (l ApiLevel) EffectiveVersionString(ctx EarlyModuleContext) (string, error)
|
|||
return ret.String(), nil
|
||||
}
|
||||
|
||||
// Specified returns true if the module is targeting a recognzized api_level.
|
||||
// It returns false if either
|
||||
// 1. min_sdk_version is not an int or a recognized codename
|
||||
// 2. both min_sdk_version and sdk_version are empty. In this case, MinSdkVersion() defaults to SdkSpecPrivate.ApiLevel
|
||||
func (this ApiLevel) Specified() bool {
|
||||
return !this.IsInvalid() && !this.IsPrivate()
|
||||
}
|
||||
|
||||
// Returns -1 if the current API level is less than the argument, 0 if they
|
||||
// are equal, and 1 if it is greater than the argument.
|
||||
func (this ApiLevel) CompareTo(other ApiLevel) int {
|
||||
|
@ -289,6 +297,16 @@ func ReplaceFinalizedCodenames(config Config, raw string) string {
|
|||
return strconv.Itoa(num)
|
||||
}
|
||||
|
||||
// ApiLevelFrom converts the given string `raw` to an ApiLevel.
|
||||
// If `raw` is invalid (empty string, unrecognized codename etc.) it returns an invalid ApiLevel
|
||||
func ApiLevelFrom(ctx PathContext, raw string) ApiLevel {
|
||||
ret, err := ApiLevelFromUser(ctx, raw)
|
||||
if err != nil {
|
||||
return NewInvalidApiLevel(raw)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// ApiLevelFromUser converts the given string `raw` to an ApiLevel, possibly returning an error.
|
||||
//
|
||||
// `raw` must be non-empty. Passing an empty string results in a panic.
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
// minApiLevelForSdkSnapshot provides access to the min_sdk_version for MinApiLevelForSdkSnapshot
|
||||
type minApiLevelForSdkSnapshot interface {
|
||||
MinSdkVersion(ctx EarlyModuleContext) SdkSpec
|
||||
MinSdkVersion(ctx EarlyModuleContext) ApiLevel
|
||||
}
|
||||
|
||||
// MinApiLevelForSdkSnapshot returns the ApiLevel of the min_sdk_version of the supplied module.
|
||||
|
@ -34,7 +34,7 @@ type minApiLevelForSdkSnapshot interface {
|
|||
func MinApiLevelForSdkSnapshot(ctx EarlyModuleContext, module Module) ApiLevel {
|
||||
minApiLevel := NoneApiLevel
|
||||
if m, ok := module.(minApiLevelForSdkSnapshot); ok {
|
||||
minApiLevel = m.MinSdkVersion(ctx).ApiLevel
|
||||
minApiLevel = m.MinSdkVersion(ctx)
|
||||
}
|
||||
if minApiLevel == NoneApiLevel {
|
||||
// The default min API level is 1.
|
||||
|
|
|
@ -25,9 +25,9 @@ type SdkContext interface {
|
|||
SdkVersion(ctx EarlyModuleContext) SdkSpec
|
||||
// SystemModules returns the system_modules property of the current module, or an empty string if it is not set.
|
||||
SystemModules() string
|
||||
// MinSdkVersion returns SdkSpec that corresponds to the min_sdk_version property of the current module,
|
||||
// MinSdkVersion returns ApiLevel that corresponds to the min_sdk_version property of the current module,
|
||||
// or from sdk_version if it is not set.
|
||||
MinSdkVersion(ctx EarlyModuleContext) SdkSpec
|
||||
MinSdkVersion(ctx EarlyModuleContext) ApiLevel
|
||||
// ReplaceMaxSdkVersionPlaceholder returns SdkSpec to replace the maxSdkVersion property of permission and
|
||||
// uses-permission tags if it is set.
|
||||
ReplaceMaxSdkVersionPlaceholder(ctx EarlyModuleContext) SdkSpec
|
||||
|
|
|
@ -2949,12 +2949,8 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string {
|
|||
}
|
||||
|
||||
// Returns apex's min_sdk_version SdkSpec, honoring overrides
|
||||
func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
return android.SdkSpec{
|
||||
Kind: android.SdkNone,
|
||||
ApiLevel: a.minSdkVersion(ctx),
|
||||
Raw: a.minSdkVersionValue(ctx),
|
||||
}
|
||||
func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
return a.minSdkVersion(ctx)
|
||||
}
|
||||
|
||||
// Returns apex's min_sdk_version ApiLevel, honoring overrides
|
||||
|
|
|
@ -1063,10 +1063,10 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
|
|||
} else {
|
||||
toMinSdkVersion := "(no version)"
|
||||
if m, ok := to.(interface {
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel
|
||||
}); ok {
|
||||
if v := m.MinSdkVersion(ctx); !v.ApiLevel.IsNone() {
|
||||
toMinSdkVersion = v.ApiLevel.String()
|
||||
if v := m.MinSdkVersion(ctx); !v.IsNone() {
|
||||
toMinSdkVersion = v.String()
|
||||
}
|
||||
} else if m, ok := to.(interface{ MinSdkVersion() string }); ok {
|
||||
// TODO(b/175678607) eliminate the use of MinSdkVersion returning
|
||||
|
@ -1087,7 +1087,7 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
|
|||
return !externalDep
|
||||
})
|
||||
|
||||
a.ApexBundleDepsInfo.BuildDepsInfoLists(ctx, a.MinSdkVersion(ctx).Raw, depInfos)
|
||||
a.ApexBundleDepsInfo.BuildDepsInfoLists(ctx, a.MinSdkVersion(ctx).String(), depInfos)
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: android.Phony,
|
||||
|
|
12
java/aar.go
12
java/aar.go
|
@ -220,12 +220,12 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext android.SdkConte
|
|||
linkDeps = append(linkDeps, assetDeps...)
|
||||
|
||||
// Returns the effective version for {min|target}_sdk_version
|
||||
effectiveVersionString := func(sdkVersion android.SdkSpec, minSdkVersion android.SdkSpec) string {
|
||||
effectiveVersionString := func(sdkVersion android.SdkSpec, minSdkVersion android.ApiLevel) string {
|
||||
// If {min|target}_sdk_version is current, use sdk_version to determine the effective level
|
||||
// This is necessary for vendor modules.
|
||||
// The effective version does not _only_ depend on {min|target}_sdk_version(level),
|
||||
// but also on the sdk_version (kind+level)
|
||||
if minSdkVersion.ApiLevel.IsCurrent() {
|
||||
if minSdkVersion.IsCurrent() {
|
||||
ret, err := sdkVersion.EffectiveVersionString(ctx)
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf("invalid sdk_version: %s", err)
|
||||
|
@ -689,7 +689,7 @@ type AARImport struct {
|
|||
jniPackages android.Paths
|
||||
|
||||
sdkVersion android.SdkSpec
|
||||
minSdkVersion android.SdkSpec
|
||||
minSdkVersion android.ApiLevel
|
||||
}
|
||||
|
||||
var _ android.OutputFileProducer = (*AARImport)(nil)
|
||||
|
@ -714,11 +714,11 @@ func (a *AARImport) SystemModules() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (a *AARImport) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
func (a *AARImport) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
if a.properties.Min_sdk_version != nil {
|
||||
return android.SdkSpecFrom(ctx, *a.properties.Min_sdk_version)
|
||||
return android.ApiLevelFrom(ctx, *a.properties.Min_sdk_version)
|
||||
}
|
||||
return a.SdkVersion(ctx)
|
||||
return a.SdkVersion(ctx).ApiLevel
|
||||
}
|
||||
|
||||
func (a *AARImport) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
|
|
14
java/app.go
14
java/app.go
|
@ -752,7 +752,7 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
|
||||
type appDepsInterface interface {
|
||||
SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel
|
||||
RequiresStableAPIs(ctx android.BaseModuleContext) bool
|
||||
}
|
||||
|
||||
|
@ -865,10 +865,10 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) {
|
|||
} else {
|
||||
toMinSdkVersion := "(no version)"
|
||||
if m, ok := to.(interface {
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel
|
||||
}); ok {
|
||||
if v := m.MinSdkVersion(ctx); !v.ApiLevel.IsNone() {
|
||||
toMinSdkVersion = v.ApiLevel.String()
|
||||
if v := m.MinSdkVersion(ctx); !v.IsNone() {
|
||||
toMinSdkVersion = v.String()
|
||||
}
|
||||
} else if m, ok := to.(interface{ MinSdkVersion() string }); ok {
|
||||
// TODO(b/175678607) eliminate the use of MinSdkVersion returning
|
||||
|
@ -1524,9 +1524,9 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
manifestValues := &manifestValueAttribute{}
|
||||
// TODO(b/274474008 ): Directly convert deviceProperties.Min_sdk_version in bp2build
|
||||
// MinSdkVersion(ctx) calls SdkVersion(ctx) if no value for min_sdk_version is set
|
||||
minSdkSpec := a.MinSdkVersion(ctx)
|
||||
if !minSdkSpec.ApiLevel.IsPreview() && minSdkSpec.Valid() {
|
||||
minSdkStr, err := minSdkSpec.EffectiveVersionString(ctx)
|
||||
minSdkVersion := a.MinSdkVersion(ctx)
|
||||
if !minSdkVersion.IsPreview() && !minSdkVersion.IsInvalid() {
|
||||
minSdkStr, err := minSdkVersion.EffectiveVersionString(ctx)
|
||||
if err == nil {
|
||||
manifestValues.MinSdkVersion = &minSdkStr
|
||||
}
|
||||
|
|
|
@ -426,8 +426,8 @@ func (a *AndroidAppImport) SdkVersion(ctx android.EarlyModuleContext) android.Sd
|
|||
return android.SdkSpecPrivate
|
||||
}
|
||||
|
||||
func (a *AndroidAppImport) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
return android.SdkSpecPrivate
|
||||
func (a *AndroidAppImport) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
return android.SdkSpecPrivate.ApiLevel
|
||||
}
|
||||
|
||||
func (a *AndroidAppImport) LintDepSets() LintDepSets {
|
||||
|
|
27
java/base.go
27
java/base.go
|
@ -489,7 +489,7 @@ type Module struct {
|
|||
hideApexVariantFromMake bool
|
||||
|
||||
sdkVersion android.SdkSpec
|
||||
minSdkVersion android.SdkSpec
|
||||
minSdkVersion android.ApiLevel
|
||||
maxSdkVersion android.SdkSpec
|
||||
|
||||
sourceExtensions []string
|
||||
|
@ -665,11 +665,11 @@ func (j *Module) SystemModules() string {
|
|||
return proptools.String(j.deviceProperties.System_modules)
|
||||
}
|
||||
|
||||
func (j *Module) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
func (j *Module) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
if j.deviceProperties.Min_sdk_version != nil {
|
||||
return android.SdkSpecFrom(ctx, *j.deviceProperties.Min_sdk_version)
|
||||
return android.ApiLevelFrom(ctx, *j.deviceProperties.Min_sdk_version)
|
||||
}
|
||||
return j.SdkVersion(ctx)
|
||||
return j.SdkVersion(ctx).ApiLevel
|
||||
}
|
||||
|
||||
func (j *Module) MaxSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
|
@ -685,7 +685,7 @@ func (j *Module) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext)
|
|||
}
|
||||
|
||||
func (j *Module) MinSdkVersionString() string {
|
||||
return j.minSdkVersion.Raw
|
||||
return j.minSdkVersion.String()
|
||||
}
|
||||
|
||||
func (j *Module) TargetSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
|
@ -881,7 +881,7 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt
|
|||
j.ignoredAidlPermissionList = android.PathsForModuleSrcExcludes(ctx, exceptions, nil)
|
||||
}
|
||||
|
||||
aidlMinSdkVersion := j.MinSdkVersion(ctx).ApiLevel.String()
|
||||
aidlMinSdkVersion := j.MinSdkVersion(ctx).String()
|
||||
flags = append(flags, "--min_sdk_version="+aidlMinSdkVersion)
|
||||
|
||||
return strings.Join(flags, " "), deps
|
||||
|
@ -1542,9 +1542,9 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
|
|||
}
|
||||
|
||||
if ctx.Device() {
|
||||
lintSDKVersion := func(sdkSpec android.SdkSpec) int {
|
||||
if v := sdkSpec.ApiLevel; !v.IsPreview() {
|
||||
return v.FinalInt()
|
||||
lintSDKVersion := func(apiLevel android.ApiLevel) int {
|
||||
if !apiLevel.IsPreview() {
|
||||
return apiLevel.FinalInt()
|
||||
} else {
|
||||
// When running metalava, we pass --version-codename. When that value
|
||||
// is not REL, metalava will add 1 to the --current-version argument.
|
||||
|
@ -1575,8 +1575,8 @@ 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))
|
||||
j.linter.compileSdkVersion = lintSDKVersion(j.SdkVersion(ctx))
|
||||
j.linter.targetSdkVersion = lintSDKVersion(j.TargetSdkVersion(ctx).ApiLevel)
|
||||
j.linter.compileSdkVersion = lintSDKVersion(j.SdkVersion(ctx).ApiLevel)
|
||||
j.linter.compileSdkKind = j.SdkVersion(ctx).Kind
|
||||
j.linter.javaLanguageLevel = flags.javaVersion.String()
|
||||
j.linter.kotlinLanguageLevel = "1.3"
|
||||
|
@ -1846,15 +1846,14 @@ func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu
|
|||
// Implements android.ApexModule
|
||||
func (j *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion android.ApiLevel) error {
|
||||
sdkVersionSpec := j.SdkVersion(ctx)
|
||||
minSdkVersionSpec := j.MinSdkVersion(ctx)
|
||||
if !minSdkVersionSpec.Specified() {
|
||||
minSdkVersion := j.MinSdkVersion(ctx)
|
||||
if !minSdkVersion.Specified() {
|
||||
return fmt.Errorf("min_sdk_version is not specified")
|
||||
}
|
||||
// If the module is compiling against core (via sdk_version), skip comparison check.
|
||||
if sdkVersionSpec.Kind == android.SdkCore {
|
||||
return nil
|
||||
}
|
||||
minSdkVersion := minSdkVersionSpec.ApiLevel
|
||||
if minSdkVersion.GreaterThan(sdkVersion) {
|
||||
return fmt.Errorf("newer SDK(%v)", minSdkVersion)
|
||||
}
|
||||
|
|
|
@ -130,13 +130,13 @@ func configuredJarListToClasspathJars(ctx android.ModuleContext, configuredJars
|
|||
if s, ok := m.(*SdkLibrary); ok {
|
||||
// TODO(208456999): instead of mapping "current" to latest, min_sdk_version should never be set to "current"
|
||||
if s.minSdkVersion.Specified() {
|
||||
if s.minSdkVersion.ApiLevel.IsCurrent() {
|
||||
if s.minSdkVersion.IsCurrent() {
|
||||
jar.minSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
|
||||
} else {
|
||||
jar.minSdkVersion = s.minSdkVersion.ApiLevel.String()
|
||||
jar.minSdkVersion = s.minSdkVersion.String()
|
||||
}
|
||||
}
|
||||
if s.maxSdkVersion.Specified() {
|
||||
if s.maxSdkVersion.ApiLevel.Specified() {
|
||||
if s.maxSdkVersion.ApiLevel.IsCurrent() {
|
||||
jar.maxSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
|
||||
} else {
|
||||
|
|
|
@ -343,7 +343,7 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, flags javaBuilderFlags) (r8Fl
|
|||
type compileDexParams struct {
|
||||
flags javaBuilderFlags
|
||||
sdkVersion android.SdkSpec
|
||||
minSdkVersion android.SdkSpec
|
||||
minSdkVersion android.ApiLevel
|
||||
classesJar android.Path
|
||||
jarName string
|
||||
}
|
||||
|
|
|
@ -248,8 +248,8 @@ func (j *Javadoc) SystemModules() string {
|
|||
return proptools.String(j.properties.System_modules)
|
||||
}
|
||||
|
||||
func (j *Javadoc) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
return j.SdkVersion(ctx)
|
||||
func (j *Javadoc) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
return j.SdkVersion(ctx).ApiLevel
|
||||
}
|
||||
|
||||
func (j *Javadoc) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
|
@ -304,7 +304,7 @@ func (j *Javadoc) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Op
|
|||
flags = append(flags, "-I"+src.String())
|
||||
}
|
||||
|
||||
minSdkVersion := j.MinSdkVersion(ctx).ApiLevel.FinalOrFutureInt()
|
||||
minSdkVersion := j.MinSdkVersion(ctx).FinalOrFutureInt()
|
||||
flags = append(flags, fmt.Sprintf("--min_sdk_version=%v", minSdkVersion))
|
||||
|
||||
return strings.Join(flags, " "), deps
|
||||
|
|
|
@ -73,7 +73,7 @@ type hiddenAPIModule interface {
|
|||
android.Module
|
||||
hiddenAPIIntf
|
||||
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec
|
||||
MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel
|
||||
}
|
||||
|
||||
type hiddenAPIIntf interface {
|
||||
|
@ -157,7 +157,7 @@ func (h *hiddenAPI) hiddenAPIEncodeDex(ctx android.ModuleContext, dexJar android
|
|||
// Create a copy of the dex jar which has been encoded with hiddenapi flags.
|
||||
flagsCSV := hiddenAPISingletonPaths(ctx).flags
|
||||
outputDir := android.PathForModuleOut(ctx, "hiddenapi").OutputPath
|
||||
encodedDex := hiddenAPIEncodeDex(ctx, dexJar, flagsCSV, uncompressDex, android.SdkSpecNone, outputDir)
|
||||
encodedDex := hiddenAPIEncodeDex(ctx, dexJar, flagsCSV, uncompressDex, android.NoneApiLevel, outputDir)
|
||||
|
||||
// Use the encoded dex jar from here onwards.
|
||||
return encodedDex
|
||||
|
@ -253,7 +253,7 @@ var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", bluepr
|
|||
// The encode dex rule requires unzipping, encoding and rezipping the classes.dex files along with
|
||||
// all the resources from the input jar. It also ensures that if it was uncompressed in the input
|
||||
// it stays uncompressed in the output.
|
||||
func hiddenAPIEncodeDex(ctx android.ModuleContext, dexInput, flagsCSV android.Path, uncompressDex bool, minSdkVersion android.SdkSpec, outputDir android.OutputPath) android.OutputPath {
|
||||
func hiddenAPIEncodeDex(ctx android.ModuleContext, dexInput, flagsCSV android.Path, uncompressDex bool, minSdkVersion android.ApiLevel, outputDir android.OutputPath) android.OutputPath {
|
||||
|
||||
// The output file has the same name as the input file and is in the output directory.
|
||||
output := outputDir.Join(ctx, dexInput.Base())
|
||||
|
@ -283,7 +283,7 @@ func hiddenAPIEncodeDex(ctx android.ModuleContext, dexInput, flagsCSV android.Pa
|
|||
|
||||
// If the library is targeted for Q and/or R then make sure that they do not
|
||||
// have any S+ flags encoded as that will break the runtime.
|
||||
minApiLevel := minSdkVersion.ApiLevel
|
||||
minApiLevel := minSdkVersion
|
||||
if !minApiLevel.IsNone() {
|
||||
if minApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(ctx, "R")) {
|
||||
hiddenapiFlags = hiddenapiFlags + " --max-hiddenapi-level=max-target-r"
|
||||
|
|
|
@ -1278,7 +1278,7 @@ type bootDexInfo struct {
|
|||
uncompressDex bool
|
||||
|
||||
// The minimum sdk version that the dex jar will be used on.
|
||||
minSdkVersion android.SdkSpec
|
||||
minSdkVersion android.ApiLevel
|
||||
}
|
||||
|
||||
// bootDexInfoByModule is a map from module name (as returned by module.Name()) to the boot dex
|
||||
|
|
15
java/java.go
15
java/java.go
|
@ -811,7 +811,7 @@ func (p *librarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberCo
|
|||
// If the min_sdk_version was set then add the canonical representation of the API level to the
|
||||
// snapshot.
|
||||
if j.deviceProperties.Min_sdk_version != nil {
|
||||
canonical := android.ReplaceFinalizedCodenames(ctx.SdkModuleContext().Config(), j.minSdkVersion.ApiLevel.String())
|
||||
canonical := android.ReplaceFinalizedCodenames(ctx.SdkModuleContext().Config(), j.minSdkVersion.String())
|
||||
p.MinSdkVersion = proptools.StringPtr(canonical)
|
||||
}
|
||||
|
||||
|
@ -1874,7 +1874,7 @@ type Import struct {
|
|||
hideApexVariantFromMake bool
|
||||
|
||||
sdkVersion android.SdkSpec
|
||||
minSdkVersion android.SdkSpec
|
||||
minSdkVersion android.ApiLevel
|
||||
}
|
||||
|
||||
var _ PermittedPackagesForUpdatableBootJars = (*Import)(nil)
|
||||
|
@ -1891,11 +1891,11 @@ func (j *Import) SystemModules() string {
|
|||
return "none"
|
||||
}
|
||||
|
||||
func (j *Import) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
func (j *Import) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
if j.properties.Min_sdk_version != nil {
|
||||
return android.SdkSpecFrom(ctx, *j.properties.Min_sdk_version)
|
||||
return android.ApiLevelFrom(ctx, *j.properties.Min_sdk_version)
|
||||
}
|
||||
return j.SdkVersion(ctx)
|
||||
return j.SdkVersion(ctx).ApiLevel
|
||||
}
|
||||
|
||||
func (j *Import) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
|
@ -2161,15 +2161,14 @@ func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu
|
|||
func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
|
||||
sdkVersion android.ApiLevel) error {
|
||||
sdkVersionSpec := j.SdkVersion(ctx)
|
||||
minSdkVersionSpec := j.MinSdkVersion(ctx)
|
||||
if !minSdkVersionSpec.Specified() {
|
||||
minSdkVersion := j.MinSdkVersion(ctx)
|
||||
if !minSdkVersion.Specified() {
|
||||
return fmt.Errorf("min_sdk_version is not specified")
|
||||
}
|
||||
// If the module is compiling against core (via sdk_version), skip comparison check.
|
||||
if sdkVersionSpec.Kind == android.SdkCore {
|
||||
return nil
|
||||
}
|
||||
minSdkVersion := minSdkVersionSpec.ApiLevel
|
||||
if minSdkVersion.GreaterThan(sdkVersion) {
|
||||
return fmt.Errorf("newer SDK(%v)", minSdkVersion)
|
||||
}
|
||||
|
|
|
@ -175,11 +175,11 @@ func (r *RuntimeResourceOverlay) SystemModules() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (r *RuntimeResourceOverlay) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
func (r *RuntimeResourceOverlay) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
if r.properties.Min_sdk_version != nil {
|
||||
return android.SdkSpecFrom(ctx, *r.properties.Min_sdk_version)
|
||||
return android.ApiLevelFrom(ctx, *r.properties.Min_sdk_version)
|
||||
}
|
||||
return r.SdkVersion(ctx)
|
||||
return r.SdkVersion(ctx).ApiLevel
|
||||
}
|
||||
|
||||
func (r *RuntimeResourceOverlay) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
|
|
|
@ -1231,7 +1231,7 @@ func (module *SdkLibrary) getGeneratedApiScopes(ctx android.EarlyModuleContext)
|
|||
var _ android.ModuleWithMinSdkVersionCheck = (*SdkLibrary)(nil)
|
||||
|
||||
func (module *SdkLibrary) CheckMinSdkVersion(ctx android.ModuleContext) {
|
||||
android.CheckMinSdkVersion(ctx, module.MinSdkVersion(ctx).ApiLevel, func(c android.ModuleContext, do android.PayloadDepsCallback) {
|
||||
android.CheckMinSdkVersion(ctx, module.MinSdkVersion(ctx), func(c android.ModuleContext, do android.PayloadDepsCallback) {
|
||||
ctx.WalkDeps(func(child android.Module, parent android.Module) bool {
|
||||
isExternal := !module.depIsInSameApex(ctx, child)
|
||||
if am, ok := child.(android.ApexModule); ok {
|
||||
|
@ -1775,7 +1775,7 @@ func (module *SdkLibrary) UniqueApexVariations() bool {
|
|||
|
||||
// Creates the xml file that publicizes the runtime library
|
||||
func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
|
||||
moduleMinApiLevel := module.Library.MinSdkVersion(mctx).ApiLevel
|
||||
moduleMinApiLevel := module.Library.MinSdkVersion(mctx)
|
||||
var moduleMinApiLevelStr = moduleMinApiLevel.String()
|
||||
if moduleMinApiLevel == android.NoneApiLevel {
|
||||
moduleMinApiLevelStr = "current"
|
||||
|
@ -2414,8 +2414,8 @@ func (module *SdkLibraryImport) UniqueApexVariations() bool {
|
|||
}
|
||||
|
||||
// MinSdkVersion - Implements hiddenAPIModule
|
||||
func (module *SdkLibraryImport) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
|
||||
return android.SdkSpecNone
|
||||
func (module *SdkLibraryImport) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
|
||||
return android.NoneApiLevel
|
||||
}
|
||||
|
||||
var _ hiddenAPIModule = (*SdkLibraryImport)(nil)
|
||||
|
|
Loading…
Reference in a new issue