Split java 8 and 9 classpaths in TestClasspath
In preparation for adding the system modules jars to the classpath for java 9, split the expected java 8 and java 9 classpaths into separate fields. Also replace the system: "bootclasspath" special case with a bool that specifies that the module will always be built using a java 8 style command line. Test: TestClasspath Change-Id: I661ec50d77a039c435c03bc8e6443cc5a57c206e
This commit is contained in:
parent
5bce0931c1
commit
617b1451b4
|
@ -34,16 +34,25 @@ func TestClasspath(t *testing.T) {
|
||||||
moduleType string
|
moduleType string
|
||||||
host android.OsClass
|
host android.OsClass
|
||||||
properties string
|
properties string
|
||||||
|
|
||||||
|
// for java 8
|
||||||
bootclasspath []string
|
bootclasspath []string
|
||||||
|
java8classpath []string
|
||||||
|
|
||||||
|
// for java 9
|
||||||
system string
|
system string
|
||||||
classpath []string
|
java9classpath []string
|
||||||
|
|
||||||
|
forces8 bool // if set, javac will always be called with java 8 arguments
|
||||||
|
|
||||||
aidl string
|
aidl string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "default",
|
name: "default",
|
||||||
bootclasspath: config.DefaultBootclasspathLibraries,
|
bootclasspath: config.DefaultBootclasspathLibraries,
|
||||||
system: config.DefaultSystemModules,
|
system: config.DefaultSystemModules,
|
||||||
classpath: config.DefaultLibraries,
|
java8classpath: config.DefaultLibraries,
|
||||||
|
java9classpath: config.DefaultLibraries,
|
||||||
aidl: "-Iframework/aidl",
|
aidl: "-Iframework/aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -51,7 +60,7 @@ func TestClasspath(t *testing.T) {
|
||||||
properties: `sdk_version:"core_platform"`,
|
properties: `sdk_version:"core_platform"`,
|
||||||
bootclasspath: config.DefaultBootclasspathLibraries,
|
bootclasspath: config.DefaultBootclasspathLibraries,
|
||||||
system: config.DefaultSystemModules,
|
system: config.DefaultSystemModules,
|
||||||
classpath: []string{},
|
java8classpath: []string{},
|
||||||
aidl: "",
|
aidl: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -59,7 +68,8 @@ func TestClasspath(t *testing.T) {
|
||||||
properties: `sdk_version: "",`,
|
properties: `sdk_version: "",`,
|
||||||
bootclasspath: config.DefaultBootclasspathLibraries,
|
bootclasspath: config.DefaultBootclasspathLibraries,
|
||||||
system: config.DefaultSystemModules,
|
system: config.DefaultSystemModules,
|
||||||
classpath: config.DefaultLibraries,
|
java8classpath: config.DefaultLibraries,
|
||||||
|
java9classpath: config.DefaultLibraries,
|
||||||
aidl: "-Iframework/aidl",
|
aidl: "-Iframework/aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -67,8 +77,8 @@ func TestClasspath(t *testing.T) {
|
||||||
name: "sdk v25",
|
name: "sdk v25",
|
||||||
properties: `sdk_version: "25",`,
|
properties: `sdk_version: "25",`,
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
java8classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
||||||
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -76,7 +86,7 @@ func TestClasspath(t *testing.T) {
|
||||||
name: "current",
|
name: "current",
|
||||||
properties: `sdk_version: "current",`,
|
properties: `sdk_version: "current",`,
|
||||||
bootclasspath: []string{"android_stubs_current", "core-lambda-stubs"},
|
bootclasspath: []string{"android_stubs_current", "core-lambda-stubs"},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
aidl: "-p" + buildDir + "/framework.aidl",
|
aidl: "-p" + buildDir + "/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -84,7 +94,7 @@ func TestClasspath(t *testing.T) {
|
||||||
name: "system_current",
|
name: "system_current",
|
||||||
properties: `sdk_version: "system_current",`,
|
properties: `sdk_version: "system_current",`,
|
||||||
bootclasspath: []string{"android_system_stubs_current", "core-lambda-stubs"},
|
bootclasspath: []string{"android_system_stubs_current", "core-lambda-stubs"},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
aidl: "-p" + buildDir + "/framework.aidl",
|
aidl: "-p" + buildDir + "/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -92,8 +102,8 @@ func TestClasspath(t *testing.T) {
|
||||||
name: "system_25",
|
name: "system_25",
|
||||||
properties: `sdk_version: "system_25",`,
|
properties: `sdk_version: "system_25",`,
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
classpath: []string{"prebuilts/sdk/25/system/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
java8classpath: []string{"prebuilts/sdk/25/system/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
||||||
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -101,7 +111,7 @@ func TestClasspath(t *testing.T) {
|
||||||
name: "test_current",
|
name: "test_current",
|
||||||
properties: `sdk_version: "test_current",`,
|
properties: `sdk_version: "test_current",`,
|
||||||
bootclasspath: []string{"android_test_stubs_current", "core-lambda-stubs"},
|
bootclasspath: []string{"android_test_stubs_current", "core-lambda-stubs"},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
aidl: "-p" + buildDir + "/framework.aidl",
|
aidl: "-p" + buildDir + "/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -109,7 +119,7 @@ func TestClasspath(t *testing.T) {
|
||||||
name: "core_current",
|
name: "core_current",
|
||||||
properties: `sdk_version: "core_current",`,
|
properties: `sdk_version: "core_current",`,
|
||||||
bootclasspath: []string{"core.current.stubs", "core-lambda-stubs"},
|
bootclasspath: []string{"core.current.stubs", "core-lambda-stubs"},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -117,7 +127,7 @@ func TestClasspath(t *testing.T) {
|
||||||
properties: `sdk_version: "none", system_modules: "none"`,
|
properties: `sdk_version: "none", system_modules: "none"`,
|
||||||
system: "none",
|
system: "none",
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
classpath: []string{},
|
java8classpath: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -125,7 +135,7 @@ func TestClasspath(t *testing.T) {
|
||||||
properties: `sdk_version: "none", system_modules: "core-platform-api-stubs-system-modules"`,
|
properties: `sdk_version: "none", system_modules: "core-platform-api-stubs-system-modules"`,
|
||||||
system: "core-platform-api-stubs-system-modules",
|
system: "core-platform-api-stubs-system-modules",
|
||||||
bootclasspath: []string{"core-platform-api-stubs-system-modules-lib"},
|
bootclasspath: []string{"core-platform-api-stubs-system-modules-lib"},
|
||||||
classpath: []string{},
|
java8classpath: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -134,21 +144,21 @@ func TestClasspath(t *testing.T) {
|
||||||
properties: ``,
|
properties: ``,
|
||||||
host: android.Host,
|
host: android.Host,
|
||||||
bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
|
bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
|
||||||
classpath: []string{},
|
java8classpath: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
name: "host supported default",
|
name: "host supported default",
|
||||||
host: android.Host,
|
host: android.Host,
|
||||||
properties: `host_supported: true,`,
|
properties: `host_supported: true,`,
|
||||||
classpath: []string{},
|
java8classpath: []string{},
|
||||||
bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
|
bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "host supported nostdlib",
|
name: "host supported nostdlib",
|
||||||
host: android.Host,
|
host: android.Host,
|
||||||
properties: `host_supported: true, sdk_version: "none", system_modules: "none"`,
|
properties: `host_supported: true, sdk_version: "none", system_modules: "none"`,
|
||||||
classpath: []string{},
|
java8classpath: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -156,8 +166,8 @@ func TestClasspath(t *testing.T) {
|
||||||
unbundled: true,
|
unbundled: true,
|
||||||
properties: `sdk_version: "25",`,
|
properties: `sdk_version: "25",`,
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
java8classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
||||||
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -166,8 +176,8 @@ func TestClasspath(t *testing.T) {
|
||||||
unbundled: true,
|
unbundled: true,
|
||||||
properties: `sdk_version: "current",`,
|
properties: `sdk_version: "current",`,
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
classpath: []string{"prebuilts/sdk/current/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
java8classpath: []string{"prebuilts/sdk/current/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
||||||
aidl: "-pprebuilts/sdk/current/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/current/public/framework.aidl",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -175,8 +185,8 @@ func TestClasspath(t *testing.T) {
|
||||||
name: "pdk default",
|
name: "pdk default",
|
||||||
pdk: true,
|
pdk: true,
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
java8classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
||||||
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -184,8 +194,8 @@ func TestClasspath(t *testing.T) {
|
||||||
pdk: true,
|
pdk: true,
|
||||||
properties: `sdk_version: "current",`,
|
properties: `sdk_version: "current",`,
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
java8classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
||||||
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -193,8 +203,8 @@ func TestClasspath(t *testing.T) {
|
||||||
pdk: true,
|
pdk: true,
|
||||||
properties: `sdk_version: "25",`,
|
properties: `sdk_version: "25",`,
|
||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
forces8: true,
|
||||||
classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
java8classpath: []string{"prebuilts/sdk/25/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
|
||||||
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
aidl: "-pprebuilts/sdk/25/public/framework.aidl",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -235,7 +245,8 @@ func TestClasspath(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bootclasspath := convertModulesToPaths(testcase.bootclasspath)
|
bootclasspath := convertModulesToPaths(testcase.bootclasspath)
|
||||||
classpath := convertModulesToPaths(testcase.classpath)
|
java8classpath := convertModulesToPaths(testcase.java8classpath)
|
||||||
|
java9classpath := convertModulesToPaths(testcase.java9classpath)
|
||||||
|
|
||||||
bc := ""
|
bc := ""
|
||||||
var bcDeps []string
|
var bcDeps []string
|
||||||
|
@ -246,18 +257,20 @@ func TestClasspath(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := ""
|
j8c := ""
|
||||||
if len(classpath) > 0 {
|
if len(java8classpath) > 0 {
|
||||||
c = "-classpath " + strings.Join(classpath, ":")
|
j8c = "-classpath " + strings.Join(java8classpath, ":")
|
||||||
|
}
|
||||||
|
|
||||||
|
j9c := ""
|
||||||
|
if len(java9classpath) > 0 {
|
||||||
|
j9c = "-classpath " + strings.Join(java9classpath, ":")
|
||||||
}
|
}
|
||||||
|
|
||||||
system := ""
|
system := ""
|
||||||
var systemDeps []string
|
var systemDeps []string
|
||||||
if testcase.system == "none" {
|
if testcase.system == "none" {
|
||||||
system = "--system=none"
|
system = "--system=none"
|
||||||
} else if testcase.system == "bootclasspath" {
|
|
||||||
system = bc
|
|
||||||
systemDeps = bcDeps
|
|
||||||
} else if testcase.system != "" {
|
} else if testcase.system != "" {
|
||||||
system = "--system=" + filepath.Join(buildDir, ".intermediates", testcase.system, "android_common", "system")
|
system = "--system=" + filepath.Join(buildDir, ".intermediates", testcase.system, "android_common", "system")
|
||||||
// The module-relative parts of these paths are hardcoded in system_modules.go:
|
// The module-relative parts of these paths are hardcoded in system_modules.go:
|
||||||
|
@ -280,7 +293,7 @@ func TestClasspath(t *testing.T) {
|
||||||
|
|
||||||
got := javac.Args["bootClasspath"]
|
got := javac.Args["bootClasspath"]
|
||||||
expected := ""
|
expected := ""
|
||||||
if isJava8 {
|
if isJava8 || testcase.forces8 {
|
||||||
expected = bc
|
expected = bc
|
||||||
deps = append(deps, bcDeps...)
|
deps = append(deps, bcDeps...)
|
||||||
} else {
|
} else {
|
||||||
|
@ -291,11 +304,17 @@ func TestClasspath(t *testing.T) {
|
||||||
t.Errorf("bootclasspath expected %q != got %q", expected, got)
|
t.Errorf("bootclasspath expected %q != got %q", expected, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
got = javac.Args["classpath"]
|
if isJava8 || testcase.forces8 {
|
||||||
if got != c {
|
expected = j8c
|
||||||
t.Errorf("classpath expected %q != got %q", c, got)
|
deps = append(deps, java8classpath...)
|
||||||
|
} else {
|
||||||
|
expected = j9c
|
||||||
|
deps = append(deps, java9classpath...)
|
||||||
|
}
|
||||||
|
got = javac.Args["classpath"]
|
||||||
|
if got != expected {
|
||||||
|
t.Errorf("classpath expected %q != got %q", expected, got)
|
||||||
}
|
}
|
||||||
deps = append(deps, classpath...)
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(javac.Implicits.Strings(), deps) {
|
if !reflect.DeepEqual(javac.Implicits.Strings(), deps) {
|
||||||
t.Errorf("implicits expected %q != got %q", deps, javac.Implicits.Strings())
|
t.Errorf("implicits expected %q != got %q", deps, javac.Implicits.Strings())
|
||||||
|
|
Loading…
Reference in New Issue