From 0926fae350a86fa1ea008d8fde95391bd6ed0ca0 Mon Sep 17 00:00:00 2001 From: Sundong Ahn Date: Tue, 17 Oct 2017 16:34:51 +0900 Subject: [PATCH] Add system_$(VER) The system_$(VER) is added for vendor, similar to sdk. Bug: 67724799 Test: build Merged-In: I2545c92707591ca278066870c74e9f49e9825855 Change-Id: I2545c92707591ca278066870c74e9f49e9825855 (cherry picked from commit b8baff1fa353a311c3dd918dfa29ec45dd0168be) --- android/util.go | 7 +++++++ cc/rs.go | 2 +- java/java.go | 10 ++++++++-- java/java_test.go | 10 ++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/android/util.go b/android/util.go index 4d30a7400..29bb9b106 100644 --- a/android/util.go +++ b/android/util.go @@ -157,3 +157,10 @@ func callerName(skip int) (pkgPath, funcName string, ok bool) { ok = true return } + +func GetNumericSdkVersion(v string) string { + if strings.Contains(v, "system_") { + return strings.Replace(v, "system_", "", 1) + } + return v +} diff --git a/cc/rs.go b/cc/rs.go index c2335dd36..68ba54b14 100644 --- a/cc/rs.go +++ b/cc/rs.go @@ -86,7 +86,7 @@ func rsFlags(ctx ModuleContext, flags Flags, properties *BaseCompilerProperties) case "current", "system_current", "test_current": // Nothing default: - targetApi = ctx.sdkVersion() + targetApi = android.GetNumericSdkVersion(ctx.sdkVersion()) } } diff --git a/java/java.go b/java/java.go index f875c799f..4355200fb 100644 --- a/java/java.go +++ b/java/java.go @@ -251,7 +251,7 @@ func sdkStringToNumber(ctx android.BaseContext, v string) int { case "", "current", "system_current", "test_current": return 10000 default: - if i, err := strconv.Atoi(v); err != nil { + if i, err := strconv.Atoi(android.GetNumericSdkVersion(v)); err != nil { ctx.PropertyErrorf("sdk_version", "invalid sdk version") return -1 } else { @@ -275,6 +275,12 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep { aidlPath := android.ExistentPathForSource(ctx, "sdkdir", aidl) if (!jarPath.Valid() || !aidlPath.Valid()) && ctx.Config().AllowMissingDependencies() { + if strings.Contains(v, "system_") { + return sdkDep{ + invalidVersion: true, + module: "vsdk_v" + strings.Replace(v, "system_", "", 1), + } + } return sdkDep{ invalidVersion: true, module: "sdk_v" + v, @@ -887,7 +893,7 @@ func (j *Module) minSdkVersionNumber(ctx android.ModuleContext) string { case "", "current", "test_current", "system_current": return strconv.Itoa(ctx.Config().DefaultAppTargetSdkInt()) default: - return String(j.deviceProperties.Sdk_version) + return android.GetNumericSdkVersion(String(j.deviceProperties.Sdk_version)) } } diff --git a/java/java_test.go b/java/java_test.go index 0a9eba94d..5b364279d 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -139,6 +139,8 @@ func testJavaWithEnvFs(t *testing.T, bp string, "prebuilts/sdk/current/framework.aidl": nil, "prebuilts/sdk/system_current/android.jar": nil, "prebuilts/sdk/system_current/framework.aidl": nil, + "prebuilts/sdk/system_14/android.jar": nil, + "prebuilts/sdk/system_14/framework.aidl": nil, "prebuilts/sdk/test_current/android.jar": nil, "prebuilts/sdk/test_current/framework.aidl": nil, @@ -284,6 +286,14 @@ var classpathTestcases = []struct { system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath classpath: []string{"prebuilts/sdk/system_current/android.jar"}, }, + { + + name: "system_14", + properties: `sdk_version: "system_14",`, + bootclasspath: []string{`""`}, + system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath + classpath: []string{"prebuilts/sdk/system_14/android.jar"}, + }, { name: "test_current",