Use prebuilts/sdk/*current until Soong can generate stubs

am: 2ebc476646

Change-Id: Ia32894aa7ac8a62ccef2aa0b5017114d403de622
This commit is contained in:
Colin Cross 2017-10-21 03:37:46 +00:00 committed by android-build-merger
commit 730bb0113c
2 changed files with 35 additions and 24 deletions

View File

@ -271,13 +271,13 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep {
} }
} }
toModule := func(m string) sdkDep { //toModule := func(m string) sdkDep {
return sdkDep{ // return sdkDep{
useModule: true, // useModule: true,
module: m, // module: m,
systemModules: m + "_system_modules", // systemModules: m + "_system_modules",
} // }
} //}
if ctx.AConfig().UnbundledBuild() && v != "" { if ctx.AConfig().UnbundledBuild() && v != "" {
return toFile(v) return toFile(v)
@ -288,12 +288,14 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep {
return sdkDep{ return sdkDep{
useDefaultLibs: true, useDefaultLibs: true,
} }
case "current": // TODO(ccross): re-enable these once we generate stubs, until then
return toModule("android_stubs_current") // use the stubs in prebuilts/sdk/*current
case "system_current": //case "current":
return toModule("android_system_stubs_current") // return toModule("android_stubs_current")
case "test_current": //case "system_current":
return toModule("android_test_stubs_current") // return toModule("android_system_stubs_current")
//case "test_current":
// return toModule("android_test_stubs_current")
default: default:
return toFile(v) return toFile(v)
} }
@ -478,6 +480,9 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
flags.javaVersion = "1.7" flags.javaVersion = "1.7"
} else if ctx.Device() && sdk <= 26 || !ctx.AConfig().TargetOpenJDK9() { } else if ctx.Device() && sdk <= 26 || !ctx.AConfig().TargetOpenJDK9() {
flags.javaVersion = "1.8" flags.javaVersion = "1.8"
} else if ctx.Device() && j.deviceProperties.Sdk_version != "" && sdk == 10000 {
// TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current"
flags.javaVersion = "1.8"
} else { } else {
flags.javaVersion = "1.9" flags.javaVersion = "1.9"
} }

View File

@ -123,8 +123,14 @@ func testJavaWithEnv(t *testing.T, bp string, env map[string]string) *android.Te
"res/b": nil, "res/b": nil,
"res2/a": nil, "res2/a": nil,
"prebuilts/sdk/14/android.jar": nil, "prebuilts/sdk/14/android.jar": nil,
"prebuilts/sdk/14/framework.aidl": nil, "prebuilts/sdk/14/framework.aidl": nil,
"prebuilts/sdk/current/android.jar": nil,
"prebuilts/sdk/current/framework.aidl": nil,
"prebuilts/sdk/system_current/android.jar": nil,
"prebuilts/sdk/system_current/framework.aidl": nil,
"prebuilts/sdk/test_current/android.jar": nil,
"prebuilts/sdk/test_current/framework.aidl": nil,
}) })
_, errs := ctx.ParseBlueprintsFiles("Android.bp") _, errs := ctx.ParseBlueprintsFiles("Android.bp")
@ -246,25 +252,25 @@ var classpathTestcases = []struct {
name: "current", name: "current",
properties: `sdk_version: "current",`, properties: `sdk_version: "current",`,
bootclasspath: []string{"android_stubs_current"}, bootclasspath: []string{`""`},
system: "android_stubs_current_system_modules", system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
classpath: []string{}, classpath: []string{"prebuilts/sdk/current/android.jar"},
}, },
{ {
name: "system_current", name: "system_current",
properties: `sdk_version: "system_current",`, properties: `sdk_version: "system_current",`,
bootclasspath: []string{"android_system_stubs_current"}, bootclasspath: []string{`""`},
system: "android_system_stubs_current_system_modules", system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
classpath: []string{}, classpath: []string{"prebuilts/sdk/system_current/android.jar"},
}, },
{ {
name: "test_current", name: "test_current",
properties: `sdk_version: "test_current",`, properties: `sdk_version: "test_current",`,
bootclasspath: []string{"android_test_stubs_current"}, bootclasspath: []string{`""`},
system: "android_test_stubs_current_system_modules", system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
classpath: []string{}, classpath: []string{"prebuilts/sdk/test_current/android.jar"},
}, },
{ {