Merge "Add PLATFORM_SYSTEMSDK_VERSIONS and BOARD_SYSTEMSDK_VERSIONS" am: d89f6621ae
am: ee33e88111
Change-Id: I617285c03082a27417815942f51b417f2f51a569
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
|
||||
var Bool = proptools.Bool
|
||||
var String = proptools.String
|
||||
var FutureApiLevel = 10000
|
||||
|
||||
// The configuration file name
|
||||
const configFileName = "soong.config"
|
||||
@@ -453,7 +454,7 @@ func (c *config) DefaultAppTargetSdkInt() int {
|
||||
if Bool(c.ProductVariables.Platform_sdk_final) {
|
||||
return c.PlatformSdkVersionInt()
|
||||
} else {
|
||||
return 10000
|
||||
return FutureApiLevel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,6 +658,17 @@ func (c *deviceConfig) ExtraVndkVersions() []string {
|
||||
return c.config.ProductVariables.ExtraVndkVersions
|
||||
}
|
||||
|
||||
func (c *deviceConfig) SystemSdkVersions() []string {
|
||||
if c.config.ProductVariables.DeviceSystemSdkVersions == nil {
|
||||
return nil
|
||||
}
|
||||
return *c.config.ProductVariables.DeviceSystemSdkVersions
|
||||
}
|
||||
|
||||
func (c *deviceConfig) PlatformSystemSdkVersions() []string {
|
||||
return c.config.ProductVariables.Platform_systemsdk_versions
|
||||
}
|
||||
|
||||
func (c *deviceConfig) OdmPath() string {
|
||||
if c.config.ProductVariables.OdmPath != nil {
|
||||
return *c.config.ProductVariables.OdmPath
|
||||
|
@@ -115,13 +115,15 @@ type productVariables struct {
|
||||
Platform_version_active_codenames []string `json:",omitempty"`
|
||||
Platform_version_future_codenames []string `json:",omitempty"`
|
||||
Platform_vndk_version *string `json:",omitempty"`
|
||||
Platform_systemsdk_versions []string `json:",omitempty"`
|
||||
|
||||
DeviceName *string `json:",omitempty"`
|
||||
DeviceArch *string `json:",omitempty"`
|
||||
DeviceArchVariant *string `json:",omitempty"`
|
||||
DeviceCpuVariant *string `json:",omitempty"`
|
||||
DeviceAbi *[]string `json:",omitempty"`
|
||||
DeviceVndkVersion *string `json:",omitempty"`
|
||||
DeviceName *string `json:",omitempty"`
|
||||
DeviceArch *string `json:",omitempty"`
|
||||
DeviceArchVariant *string `json:",omitempty"`
|
||||
DeviceCpuVariant *string `json:",omitempty"`
|
||||
DeviceAbi *[]string `json:",omitempty"`
|
||||
DeviceVndkVersion *string `json:",omitempty"`
|
||||
DeviceSystemSdkVersions *[]string `json:",omitempty"`
|
||||
|
||||
DeviceSecondaryArch *string `json:",omitempty"`
|
||||
DeviceSecondaryArchVariant *string `json:",omitempty"`
|
||||
|
20
java/java.go
20
java/java.go
@@ -308,7 +308,7 @@ type sdkDep struct {
|
||||
func sdkStringToNumber(ctx android.BaseContext, v string) int {
|
||||
switch v {
|
||||
case "", "current", "system_current", "test_current":
|
||||
return 10000
|
||||
return android.FutureApiLevel
|
||||
default:
|
||||
if i, err := strconv.Atoi(android.GetNumericSdkVersion(v)); err != nil {
|
||||
ctx.PropertyErrorf("sdk_version", "invalid sdk version")
|
||||
@@ -336,6 +336,22 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep {
|
||||
return sdkDep{}
|
||||
}
|
||||
|
||||
// Ensures that the specificed system SDK version is one of BOARD_SYSTEMSDK_VERSIONS (for vendor apks)
|
||||
// or PRODUCT_SYSTEMSDK_VERSIONS (for other apks or when BOARD_SYSTEMSDK_VERSIONS is not set)
|
||||
if strings.HasPrefix(v, "system_") && i != android.FutureApiLevel {
|
||||
allowed_versions := ctx.DeviceConfig().PlatformSystemSdkVersions()
|
||||
if ctx.DeviceSpecific() || ctx.SocSpecific() {
|
||||
if len(ctx.DeviceConfig().SystemSdkVersions()) > 0 {
|
||||
allowed_versions = ctx.DeviceConfig().SystemSdkVersions()
|
||||
}
|
||||
}
|
||||
version := strings.TrimPrefix(v, "system_")
|
||||
if len(allowed_versions) > 0 && !android.InList(version, allowed_versions) {
|
||||
ctx.PropertyErrorf("sdk_version", "incompatible sdk version %q. System SDK version should be one of %q",
|
||||
v, allowed_versions)
|
||||
}
|
||||
}
|
||||
|
||||
toFile := func(v string) sdkDep {
|
||||
dir := filepath.Join("prebuilts/sdk", v)
|
||||
jar := filepath.Join(dir, "android.jar")
|
||||
@@ -638,7 +654,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
|
||||
flags.javaVersion = "1.7"
|
||||
} else if ctx.Device() && sdk <= 26 || !ctx.Config().TargetOpenJDK9() {
|
||||
flags.javaVersion = "1.8"
|
||||
} else if ctx.Device() && String(j.deviceProperties.Sdk_version) != "" && sdk == 10000 {
|
||||
} else if ctx.Device() && String(j.deviceProperties.Sdk_version) != "" && sdk == android.FutureApiLevel {
|
||||
// TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current"
|
||||
flags.javaVersion = "1.8"
|
||||
} else {
|
||||
|
@@ -59,7 +59,9 @@ func testConfig(env map[string]string) android.Config {
|
||||
if env["ANDROID_JAVA8_HOME"] == "" {
|
||||
env["ANDROID_JAVA8_HOME"] = "jdk8"
|
||||
}
|
||||
return android.TestArchConfig(buildDir, env)
|
||||
config := android.TestArchConfig(buildDir, env)
|
||||
config.ProductVariables.DeviceSystemSdkVersions = &[]string{"14", "15"}
|
||||
return config
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user