Introduce BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES
If BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES has a numeric value, it replaces "current" or "system_current" with the version which the flag indicates. Bug: 163009188 Test: BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES=29 m, and then check if every vendor java module's sdk_version is 29 if its sdk_version was current. Change-Id: I17b49b8e02caf2d1bc57b91648d4420f3ad9fcb9
This commit is contained in:
28
java/sdk.go
28
java/sdk.go
@@ -191,6 +191,26 @@ func (s sdkSpec) prebuiltSdkAvailableForUnbundledBuild() bool {
|
||||
return s.kind != sdkPrivate && s.kind != sdkNone && s.kind != sdkCorePlatform
|
||||
}
|
||||
|
||||
func (s sdkSpec) forVendorPartition(ctx android.EarlyModuleContext) sdkSpec {
|
||||
// If BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES has a numeric value,
|
||||
// use it instead of "current" for the vendor partition.
|
||||
currentSdkVersion := ctx.DeviceConfig().CurrentApiLevelForVendorModules()
|
||||
if currentSdkVersion == "current" {
|
||||
return s
|
||||
}
|
||||
|
||||
if s.kind == sdkPublic || s.kind == sdkSystem {
|
||||
if s.version.isCurrent() {
|
||||
if i, err := strconv.Atoi(currentSdkVersion); err == nil {
|
||||
version := sdkVersion(i)
|
||||
return sdkSpec{s.kind, version, s.raw}
|
||||
}
|
||||
panic(fmt.Errorf("BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES must be either \"current\" or a number, but was %q", currentSdkVersion))
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// usePrebuilt determines whether prebuilt SDK should be used for this sdkSpec with the given context.
|
||||
func (s sdkSpec) usePrebuilt(ctx android.EarlyModuleContext) bool {
|
||||
if s.version.isCurrent() {
|
||||
@@ -216,6 +236,10 @@ func (s sdkSpec) effectiveVersion(ctx android.EarlyModuleContext) (sdkVersion, e
|
||||
if !s.valid() {
|
||||
return s.version, fmt.Errorf("invalid sdk version %q", s.raw)
|
||||
}
|
||||
|
||||
if ctx.DeviceSpecific() || ctx.SocSpecific() {
|
||||
s = s.forVendorPartition(ctx)
|
||||
}
|
||||
if s.version.isNumbered() {
|
||||
return s.version, nil
|
||||
}
|
||||
@@ -330,6 +354,10 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext sdkContext) sdkDep
|
||||
return sdkDep{}
|
||||
}
|
||||
|
||||
if ctx.DeviceSpecific() || ctx.SocSpecific() {
|
||||
sdkVersion = sdkVersion.forVendorPartition(ctx)
|
||||
}
|
||||
|
||||
if !sdkVersion.validateSystemSdk(ctx) {
|
||||
return sdkDep{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user