Add sdk_version:"none" to replace no_standard_libs:true

Where possible this duplicates any tests that use no_standard_libs:true
with ones that use sdk_version:"none". If not possible (e.g. in the
default targets included in java/testing.go) it switches some to use
sdk_version:"none" to ensure that there is no regression in the
behavior of no_standard_libs:true.

Follow up changes will switch all usages of no_standard_libs:true over
to use sdk_version:"none" at which point no_standard_libs will be
removed.

Bug: 134566750
Test: m droid
Change-Id: I5f0fd3daa980f6b223abe454cba7f25a97a39d7a
This commit is contained in:
Paul Duffin
2019-06-11 12:31:14 +01:00
parent 250e6198d4
commit 52d398a841
8 changed files with 96 additions and 15 deletions

View File

@@ -682,7 +682,7 @@ func getLinkType(m *Module, name string) (ret linkType, stubs bool) {
return javaSdk, true
case ver == "current":
return javaSdk, false
case ver == "":
case ver == "" || ver == "none":
return javaPlatform, false
default:
if _, err := strconv.Atoi(ver); err != nil {
@@ -860,7 +860,7 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sd
var ret string
v := sdkContext.sdkVersion()
// For PDK builds, use the latest SDK version instead of "current"
if ctx.Config().IsPdkBuild() && (v == "" || v == "current") {
if ctx.Config().IsPdkBuild() && (v == "" || v == "none" || v == "current") {
sdkVersions := ctx.Config().Get(sdkVersionsKey).([]int)
latestSdkVersion := 0
if len(sdkVersions) > 0 {
@@ -879,7 +879,7 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sd
ret = "1.7"
} else if ctx.Device() && sdk <= 29 || !ctx.Config().TargetOpenJDK9() {
ret = "1.8"
} else if ctx.Device() && sdkContext.sdkVersion() != "" && sdk == android.FutureApiLevel {
} else if ctx.Device() && sdkContext.sdkVersion() != "" && sdkContext.sdkVersion() != "none" && sdk == android.FutureApiLevel {
// TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current"
ret = "1.8"
} else {