Merge "apex/apk: enforce min_sdk_version of all deps" am: 14a08f5b28
am: afdc5239b8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1287253 Change-Id: I63074e39f5f319789920e55802d4f7934b556e0a
This commit is contained in:
28
java/java.go
28
java/java.go
@@ -1891,6 +1891,24 @@ func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu
|
||||
return j.depIsInSameApex(ctx, dep)
|
||||
}
|
||||
|
||||
func (j *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion int) error {
|
||||
sdkSpec := j.minSdkVersion()
|
||||
if !sdkSpec.specified() {
|
||||
return fmt.Errorf("min_sdk_version is not specified")
|
||||
}
|
||||
if sdkSpec.kind == sdkCore {
|
||||
return nil
|
||||
}
|
||||
ver, err := sdkSpec.effectiveVersion(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if int(ver) > sdkVersion {
|
||||
return fmt.Errorf("newer SDK(%v)", ver)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (j *Module) Stem() string {
|
||||
return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
|
||||
}
|
||||
@@ -2655,6 +2673,11 @@ func (j *Import) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu
|
||||
return j.depIsInSameApex(ctx, dep)
|
||||
}
|
||||
|
||||
func (j *Import) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion int) error {
|
||||
// Do not check for prebuilts against the min_sdk_version of enclosing APEX
|
||||
return nil
|
||||
}
|
||||
|
||||
// Add compile time check for interface implementation
|
||||
var _ android.IDEInfo = (*Import)(nil)
|
||||
var _ android.IDECustomizedModuleName = (*Import)(nil)
|
||||
@@ -2824,6 +2847,11 @@ func (j *DexImport) DexJarBuildPath() android.Path {
|
||||
return j.dexJarFile
|
||||
}
|
||||
|
||||
func (j *DexImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext, sdkVersion int) error {
|
||||
// we don't check prebuilt modules for sdk_version
|
||||
return nil
|
||||
}
|
||||
|
||||
// dex_import imports a `.jar` file containing classes.dex files.
|
||||
//
|
||||
// A dex_import module cannot be used as a dependency of a java_* or android_* module, it can only be installed
|
||||
|
Reference in New Issue
Block a user