blob: 776069dc90bc5497e9c709774a8a522ef38e1e16 [file] [log] [blame]
Colin Crossfb6d7812019-01-09 22:17:55 -08001// Copyright 2019 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package java
16
17import (
Colin Crossfb6d7812019-01-09 22:17:55 -080018 "path/filepath"
19 "reflect"
20 "strings"
21 "testing"
22
23 "github.com/google/blueprint/proptools"
Colin Cross60405e52019-04-18 12:31:22 -070024
25 "android/soong/android"
26 "android/soong/java/config"
Colin Crossfb6d7812019-01-09 22:17:55 -080027)
28
Colin Crossfb6d7812019-01-09 22:17:55 -080029func TestClasspath(t *testing.T) {
Colin Cross3047fa22019-04-18 10:56:44 -070030 var classpathTestcases = []struct {
Colin Cross617b1452019-10-25 15:22:50 -070031 name string
32 unbundled bool
Colin Cross617b1452019-10-25 15:22:50 -070033 moduleType string
34 host android.OsClass
35 properties string
36
37 // for java 8
38 bootclasspath []string
39 java8classpath []string
40
41 // for java 9
42 system string
43 java9classpath []string
44
45 forces8 bool // if set, javac will always be called with java 8 arguments
46
47 aidl string
Colin Cross3047fa22019-04-18 10:56:44 -070048 }{
49 {
Colin Cross617b1452019-10-25 15:22:50 -070050 name: "default",
Pete Gillin84c38072020-07-09 18:03:41 +010051 bootclasspath: config.StableCorePlatformBootclasspathLibraries,
52 system: config.StableCorePlatformSystemModules,
Pete Gillin0638dfc2020-07-01 10:48:14 +010053 java8classpath: config.FrameworkLibraries,
54 java9classpath: config.FrameworkLibraries,
Colin Cross617b1452019-10-25 15:22:50 -070055 aidl: "-Iframework/aidl",
Colin Cross3047fa22019-04-18 10:56:44 -070056 },
57 {
Colin Cross617b1452019-10-25 15:22:50 -070058 name: `sdk_version:"core_platform"`,
59 properties: `sdk_version:"core_platform"`,
Pete Gillin84c38072020-07-09 18:03:41 +010060 bootclasspath: config.StableCorePlatformBootclasspathLibraries,
61 system: config.StableCorePlatformSystemModules,
Colin Cross617b1452019-10-25 15:22:50 -070062 java8classpath: []string{},
63 aidl: "",
Paul Duffin50c217c2019-06-12 13:25:22 +010064 },
65 {
Colin Cross617b1452019-10-25 15:22:50 -070066 name: "blank sdk version",
67 properties: `sdk_version: "",`,
Pete Gillin84c38072020-07-09 18:03:41 +010068 bootclasspath: config.StableCorePlatformBootclasspathLibraries,
69 system: config.StableCorePlatformSystemModules,
Pete Gillin0638dfc2020-07-01 10:48:14 +010070 java8classpath: config.FrameworkLibraries,
71 java9classpath: config.FrameworkLibraries,
Colin Cross617b1452019-10-25 15:22:50 -070072 aidl: "-Iframework/aidl",
Colin Cross3047fa22019-04-18 10:56:44 -070073 },
74 {
75
Colin Cross74362a42019-10-28 08:05:02 -070076 name: "sdk v29",
77 properties: `sdk_version: "29",`,
Colin Cross617b1452019-10-25 15:22:50 -070078 bootclasspath: []string{`""`},
79 forces8: true,
Colin Cross74362a42019-10-28 08:05:02 -070080 java8classpath: []string{"prebuilts/sdk/29/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
81 aidl: "-pprebuilts/sdk/29/public/framework.aidl",
Colin Cross3047fa22019-04-18 10:56:44 -070082 },
83 {
84
Colin Cross17dec172020-05-14 18:05:32 -070085 name: "sdk v30",
86 properties: `sdk_version: "30",`,
87 bootclasspath: []string{`""`},
88 system: "sdk_public_30_system_modules",
89 java8classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
90 java9classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
91 aidl: "-pprebuilts/sdk/30/public/framework.aidl",
92 },
93 {
94
Colin Cross6cef4812019-10-17 14:23:50 -070095 name: "current",
96 properties: `sdk_version: "current",`,
97 bootclasspath: []string{"android_stubs_current", "core-lambda-stubs"},
98 system: "core-current-stubs-system-modules",
99 java9classpath: []string{"android_stubs_current"},
100 aidl: "-p" + buildDir + "/framework.aidl",
Colin Cross3047fa22019-04-18 10:56:44 -0700101 },
102 {
103
Colin Cross6cef4812019-10-17 14:23:50 -0700104 name: "system_current",
105 properties: `sdk_version: "system_current",`,
106 bootclasspath: []string{"android_system_stubs_current", "core-lambda-stubs"},
107 system: "core-current-stubs-system-modules",
108 java9classpath: []string{"android_system_stubs_current"},
109 aidl: "-p" + buildDir + "/framework.aidl",
Colin Cross3047fa22019-04-18 10:56:44 -0700110 },
111 {
112
Colin Cross74362a42019-10-28 08:05:02 -0700113 name: "system_29",
114 properties: `sdk_version: "system_29",`,
Colin Cross617b1452019-10-25 15:22:50 -0700115 bootclasspath: []string{`""`},
116 forces8: true,
Colin Cross74362a42019-10-28 08:05:02 -0700117 java8classpath: []string{"prebuilts/sdk/29/system/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
118 aidl: "-pprebuilts/sdk/29/public/framework.aidl",
Colin Cross3047fa22019-04-18 10:56:44 -0700119 },
120 {
121
Colin Cross17dec172020-05-14 18:05:32 -0700122 name: "system_30",
123 properties: `sdk_version: "system_30",`,
124 bootclasspath: []string{`""`},
125 system: "sdk_public_30_system_modules",
126 java8classpath: []string{"prebuilts/sdk/30/system/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
127 java9classpath: []string{"prebuilts/sdk/30/system/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
128 aidl: "-pprebuilts/sdk/30/public/framework.aidl",
129 },
130 {
131
Colin Cross6cef4812019-10-17 14:23:50 -0700132 name: "test_current",
133 properties: `sdk_version: "test_current",`,
134 bootclasspath: []string{"android_test_stubs_current", "core-lambda-stubs"},
135 system: "core-current-stubs-system-modules",
136 java9classpath: []string{"android_test_stubs_current"},
137 aidl: "-p" + buildDir + "/framework.aidl",
Colin Cross3047fa22019-04-18 10:56:44 -0700138 },
139 {
140
Pete Gillin880f9642020-07-01 13:17:16 +0100141 name: "core_current",
142 properties: `sdk_version: "core_current",`,
143 bootclasspath: []string{"core.current.stubs", "core-lambda-stubs"},
144 system: "core-current-stubs-system-modules",
Colin Cross3047fa22019-04-18 10:56:44 -0700145 },
146 {
147
Colin Cross617b1452019-10-25 15:22:50 -0700148 name: "nostdlib",
149 properties: `sdk_version: "none", system_modules: "none"`,
150 system: "none",
151 bootclasspath: []string{`""`},
152 java8classpath: []string{},
Paul Duffin52d398a2019-06-11 12:31:14 +0100153 },
154 {
155
Colin Cross617b1452019-10-25 15:22:50 -0700156 name: "nostdlib system_modules",
Pete Gillin84c38072020-07-09 18:03:41 +0100157 properties: `sdk_version: "none", system_modules: "stable-core-platform-api-stubs-system-modules"`,
158 system: "stable-core-platform-api-stubs-system-modules",
159 bootclasspath: []string{"stable-core-platform-api-stubs-system-modules-lib"},
Colin Cross617b1452019-10-25 15:22:50 -0700160 java8classpath: []string{},
Paul Duffin52d398a2019-06-11 12:31:14 +0100161 },
162 {
163
Colin Cross617b1452019-10-25 15:22:50 -0700164 name: "host default",
165 moduleType: "java_library_host",
166 properties: ``,
167 host: android.Host,
168 bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
169 java8classpath: []string{},
Colin Cross3047fa22019-04-18 10:56:44 -0700170 },
171 {
Colin Cross3047fa22019-04-18 10:56:44 -0700172
Colin Cross617b1452019-10-25 15:22:50 -0700173 name: "host supported default",
174 host: android.Host,
175 properties: `host_supported: true,`,
176 java8classpath: []string{},
177 bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
Colin Cross3047fa22019-04-18 10:56:44 -0700178 },
179 {
Colin Cross617b1452019-10-25 15:22:50 -0700180 name: "host supported nostdlib",
181 host: android.Host,
182 properties: `host_supported: true, sdk_version: "none", system_modules: "none"`,
183 java8classpath: []string{},
Paul Duffin52d398a2019-06-11 12:31:14 +0100184 },
185 {
Colin Cross3047fa22019-04-18 10:56:44 -0700186
Colin Cross74362a42019-10-28 08:05:02 -0700187 name: "unbundled sdk v29",
Colin Cross617b1452019-10-25 15:22:50 -0700188 unbundled: true,
Colin Cross74362a42019-10-28 08:05:02 -0700189 properties: `sdk_version: "29",`,
Colin Cross617b1452019-10-25 15:22:50 -0700190 bootclasspath: []string{`""`},
191 forces8: true,
Colin Cross74362a42019-10-28 08:05:02 -0700192 java8classpath: []string{"prebuilts/sdk/29/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
193 aidl: "-pprebuilts/sdk/29/public/framework.aidl",
Colin Cross3047fa22019-04-18 10:56:44 -0700194 },
195 {
196
Colin Cross17dec172020-05-14 18:05:32 -0700197 name: "unbundled sdk v30",
198 unbundled: true,
199 properties: `sdk_version: "30",`,
200 bootclasspath: []string{`""`},
201 system: "sdk_public_30_system_modules",
202 java8classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
203 java9classpath: []string{"prebuilts/sdk/30/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
204 aidl: "-pprebuilts/sdk/30/public/framework.aidl",
205 },
206 {
207
Colin Cross617b1452019-10-25 15:22:50 -0700208 name: "unbundled current",
209 unbundled: true,
210 properties: `sdk_version: "current",`,
211 bootclasspath: []string{`""`},
Colin Cross17dec172020-05-14 18:05:32 -0700212 system: "sdk_public_current_system_modules",
Colin Cross617b1452019-10-25 15:22:50 -0700213 java8classpath: []string{"prebuilts/sdk/current/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
Colin Cross17dec172020-05-14 18:05:32 -0700214 java9classpath: []string{"prebuilts/sdk/current/public/android.jar", "prebuilts/sdk/tools/core-lambda-stubs.jar"},
Colin Cross617b1452019-10-25 15:22:50 -0700215 aidl: "-pprebuilts/sdk/current/public/framework.aidl",
Colin Cross3047fa22019-04-18 10:56:44 -0700216 },
217
218 {
Jiyong Park50146e92020-01-30 18:00:15 +0900219 name: "module_current",
220 properties: `sdk_version: "module_current",`,
221 bootclasspath: []string{"android_module_lib_stubs_current", "core-lambda-stubs"},
222 system: "core-current-stubs-system-modules",
223 java9classpath: []string{"android_module_lib_stubs_current"},
Anton Hansson3f07ab22020-04-09 13:29:59 +0100224 aidl: "-p" + buildDir + "/framework_non_updatable.aidl",
Jiyong Park50146e92020-01-30 18:00:15 +0900225 },
Jiyong Parkaae9bd12020-02-12 04:36:43 +0900226 {
227 name: "system_server_current",
228 properties: `sdk_version: "system_server_current",`,
Anton Hanssonba6ab2e2020-03-19 15:23:38 +0000229 bootclasspath: []string{"android_system_server_stubs_current", "core-lambda-stubs"},
Jiyong Parkaae9bd12020-02-12 04:36:43 +0900230 system: "core-current-stubs-system-modules",
Anton Hanssonba6ab2e2020-03-19 15:23:38 +0000231 java9classpath: []string{"android_system_server_stubs_current"},
Jiyong Parkaae9bd12020-02-12 04:36:43 +0900232 aidl: "-p" + buildDir + "/framework.aidl",
233 },
Colin Cross3047fa22019-04-18 10:56:44 -0700234 }
235
Colin Crossfb6d7812019-01-09 22:17:55 -0800236 for _, testcase := range classpathTestcases {
237 t.Run(testcase.name, func(t *testing.T) {
238 moduleType := "java_library"
239 if testcase.moduleType != "" {
240 moduleType = testcase.moduleType
241 }
242
Pete Gillinbdf5d712019-10-21 14:29:58 +0100243 props := `
Colin Crossfb6d7812019-01-09 22:17:55 -0800244 name: "foo",
245 srcs: ["a.java"],
Colin Cross3047fa22019-04-18 10:56:44 -0700246 target: {
247 android: {
248 srcs: ["bar-doc/IFoo.aidl"],
249 },
250 },
Pete Gillinbdf5d712019-10-21 14:29:58 +0100251 `
252 bp := moduleType + " {" + props + testcase.properties + `
253 }`
254 bpJava8 := moduleType + " {" + props + `java_version: "1.8",
Colin Crossfb6d7812019-01-09 22:17:55 -0800255 ` + testcase.properties + `
256 }`
257
258 variant := "android_common"
259 if testcase.host == android.Host {
260 variant = android.BuildOs.String() + "_common"
261 }
262
263 convertModulesToPaths := func(cp []string) []string {
264 ret := make([]string, len(cp))
265 for i, e := range cp {
266 ret[i] = moduleToPath(e)
267 }
268 return ret
269 }
270
271 bootclasspath := convertModulesToPaths(testcase.bootclasspath)
Colin Cross617b1452019-10-25 15:22:50 -0700272 java8classpath := convertModulesToPaths(testcase.java8classpath)
273 java9classpath := convertModulesToPaths(testcase.java9classpath)
Colin Crossfb6d7812019-01-09 22:17:55 -0800274
Pete Gillinbdf5d712019-10-21 14:29:58 +0100275 bc := ""
276 var bcDeps []string
277 if len(bootclasspath) > 0 {
278 bc = "-bootclasspath " + strings.Join(bootclasspath, ":")
279 if bootclasspath[0] != `""` {
280 bcDeps = bootclasspath
281 }
Colin Crossfb6d7812019-01-09 22:17:55 -0800282 }
283
Colin Cross617b1452019-10-25 15:22:50 -0700284 j8c := ""
285 if len(java8classpath) > 0 {
286 j8c = "-classpath " + strings.Join(java8classpath, ":")
287 }
288
289 j9c := ""
290 if len(java9classpath) > 0 {
291 j9c = "-classpath " + strings.Join(java9classpath, ":")
Colin Crossfb6d7812019-01-09 22:17:55 -0800292 }
Pete Gillinbdf5d712019-10-21 14:29:58 +0100293
Colin Crossfb6d7812019-01-09 22:17:55 -0800294 system := ""
Pete Gillinbdf5d712019-10-21 14:29:58 +0100295 var systemDeps []string
Colin Crossfb6d7812019-01-09 22:17:55 -0800296 if testcase.system == "none" {
297 system = "--system=none"
298 } else if testcase.system != "" {
Colin Cross17dec172020-05-14 18:05:32 -0700299 dir := ""
300 if strings.HasPrefix(testcase.system, "sdk_public_") {
301 dir = "prebuilts/sdk"
302 }
303 system = "--system=" + filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system")
Pete Gillinbdf5d712019-10-21 14:29:58 +0100304 // The module-relative parts of these paths are hardcoded in system_modules.go:
305 systemDeps = []string{
Colin Cross17dec172020-05-14 18:05:32 -0700306 filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system", "lib", "modules"),
307 filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system", "lib", "jrt-fs.jar"),
308 filepath.Join(buildDir, ".intermediates", dir, testcase.system, "android_common", "system", "release"),
Pete Gillinbdf5d712019-10-21 14:29:58 +0100309 }
Colin Crossfb6d7812019-01-09 22:17:55 -0800310 }
311
Pete Gillinbdf5d712019-10-21 14:29:58 +0100312 checkClasspath := func(t *testing.T, ctx *android.TestContext, isJava8 bool) {
Colin Crossc0806172019-06-14 18:51:47 -0700313 foo := ctx.ModuleForTests("foo", variant)
314 javac := foo.Rule("javac")
Pete Gillinbdf5d712019-10-21 14:29:58 +0100315 var deps []string
Colin Crossc0806172019-06-14 18:51:47 -0700316
317 aidl := foo.MaybeRule("aidl")
Pete Gillinbdf5d712019-10-21 14:29:58 +0100318 if aidl.Rule != nil {
319 deps = append(deps, aidl.Output.String())
320 }
Colin Crossfb6d7812019-01-09 22:17:55 -0800321
322 got := javac.Args["bootClasspath"]
Pete Gillinbdf5d712019-10-21 14:29:58 +0100323 expected := ""
Colin Cross617b1452019-10-25 15:22:50 -0700324 if isJava8 || testcase.forces8 {
Pete Gillinbdf5d712019-10-21 14:29:58 +0100325 expected = bc
326 deps = append(deps, bcDeps...)
327 } else {
328 expected = system
329 deps = append(deps, systemDeps...)
330 }
331 if got != expected {
332 t.Errorf("bootclasspath expected %q != got %q", expected, got)
Colin Crossfb6d7812019-01-09 22:17:55 -0800333 }
334
Colin Cross617b1452019-10-25 15:22:50 -0700335 if isJava8 || testcase.forces8 {
336 expected = j8c
337 deps = append(deps, java8classpath...)
338 } else {
339 expected = j9c
340 deps = append(deps, java9classpath...)
Colin Crossfb6d7812019-01-09 22:17:55 -0800341 }
Colin Cross617b1452019-10-25 15:22:50 -0700342 got = javac.Args["classpath"]
343 if got != expected {
344 t.Errorf("classpath expected %q != got %q", expected, got)
345 }
Colin Crossfb6d7812019-01-09 22:17:55 -0800346
347 if !reflect.DeepEqual(javac.Implicits.Strings(), deps) {
348 t.Errorf("implicits expected %q != got %q", deps, javac.Implicits.Strings())
349 }
Colin Cross3047fa22019-04-18 10:56:44 -0700350 }
351
Pete Gillin1b3370f2019-10-01 13:57:31 +0100352 // Test with legacy javac -source 1.8 -target 1.8
Pete Gillin0c2143e2019-05-02 15:32:11 +0100353 t.Run("Java language level 8", func(t *testing.T) {
Colin Cross98be1bb2019-12-13 20:41:13 -0800354 config := testConfig(nil, bpJava8, nil)
Colin Cross3047fa22019-04-18 10:56:44 -0700355 if testcase.unbundled {
356 config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
Jeongik Cha816a23a2020-07-08 01:09:23 +0900357 config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
Colin Cross3047fa22019-04-18 10:56:44 -0700358 }
Colin Cross98be1bb2019-12-13 20:41:13 -0800359 ctx := testContext()
Colin Cross3047fa22019-04-18 10:56:44 -0700360 run(t, ctx, config)
361
Pete Gillinbdf5d712019-10-21 14:29:58 +0100362 checkClasspath(t, ctx, true /* isJava8 */)
Colin Cross3047fa22019-04-18 10:56:44 -0700363
364 if testcase.host != android.Host {
365 aidl := ctx.ModuleForTests("foo", variant).Rule("aidl")
366
Colin Crossc0806172019-06-14 18:51:47 -0700367 if g, w := aidl.RuleParams.Command, testcase.aidl+" -I."; !strings.Contains(g, w) {
368 t.Errorf("want aidl command to contain %q, got %q", w, g)
Colin Cross3047fa22019-04-18 10:56:44 -0700369 }
370 }
Colin Crossfb6d7812019-01-09 22:17:55 -0800371 })
372
Pete Gillin1b3370f2019-10-01 13:57:31 +0100373 // Test with default javac -source 9 -target 9
Pete Gillin0c2143e2019-05-02 15:32:11 +0100374 t.Run("Java language level 9", func(t *testing.T) {
Colin Cross98be1bb2019-12-13 20:41:13 -0800375 config := testConfig(nil, bp, nil)
Colin Crossfb6d7812019-01-09 22:17:55 -0800376 if testcase.unbundled {
377 config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
Jeongik Cha816a23a2020-07-08 01:09:23 +0900378 config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
Colin Crossfb6d7812019-01-09 22:17:55 -0800379 }
Colin Cross98be1bb2019-12-13 20:41:13 -0800380 ctx := testContext()
Colin Crossfb6d7812019-01-09 22:17:55 -0800381 run(t, ctx, config)
382
Pete Gillinbdf5d712019-10-21 14:29:58 +0100383 checkClasspath(t, ctx, false /* isJava8 */)
384
385 if testcase.host != android.Host {
386 aidl := ctx.ModuleForTests("foo", variant).Rule("aidl")
387
388 if g, w := aidl.RuleParams.Command, testcase.aidl+" -I."; !strings.Contains(g, w) {
389 t.Errorf("want aidl command to contain %q, got %q", w, g)
390 }
Colin Crossfb6d7812019-01-09 22:17:55 -0800391 }
392 })
Colin Crossff0daf42019-04-02 16:10:56 -0700393
Pete Gillinbdf5d712019-10-21 14:29:58 +0100394 // Test again with PLATFORM_VERSION_CODENAME=REL, javac -source 8 -target 8
395 t.Run("REL + Java language level 8", func(t *testing.T) {
Colin Cross98be1bb2019-12-13 20:41:13 -0800396 config := testConfig(nil, bpJava8, nil)
Colin Crossff0daf42019-04-02 16:10:56 -0700397 config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("REL")
398 config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(true)
399
400 if testcase.unbundled {
401 config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
Jeongik Cha816a23a2020-07-08 01:09:23 +0900402 config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
Colin Crossff0daf42019-04-02 16:10:56 -0700403 }
Colin Cross98be1bb2019-12-13 20:41:13 -0800404 ctx := testContext()
Colin Crossff0daf42019-04-02 16:10:56 -0700405 run(t, ctx, config)
406
Pete Gillinbdf5d712019-10-21 14:29:58 +0100407 checkClasspath(t, ctx, true /* isJava8 */)
Colin Crossff0daf42019-04-02 16:10:56 -0700408 })
Pete Gillinbdf5d712019-10-21 14:29:58 +0100409
Colin Cross6cef4812019-10-17 14:23:50 -0700410 // Test again with PLATFORM_VERSION_CODENAME=REL, javac -source 9 -target 9
411 t.Run("REL + Java language level 9", func(t *testing.T) {
Colin Cross98be1bb2019-12-13 20:41:13 -0800412 config := testConfig(nil, bp, nil)
Colin Cross6cef4812019-10-17 14:23:50 -0700413 config.TestProductVariables.Platform_sdk_codename = proptools.StringPtr("REL")
414 config.TestProductVariables.Platform_sdk_final = proptools.BoolPtr(true)
415
416 if testcase.unbundled {
417 config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
Jeongik Cha816a23a2020-07-08 01:09:23 +0900418 config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
Colin Cross6cef4812019-10-17 14:23:50 -0700419 }
Colin Cross98be1bb2019-12-13 20:41:13 -0800420 ctx := testContext()
Colin Cross6cef4812019-10-17 14:23:50 -0700421 run(t, ctx, config)
422
423 checkClasspath(t, ctx, false /* isJava8 */)
424 })
Colin Crossfb6d7812019-01-09 22:17:55 -0800425 })
426 }
Colin Crossfb6d7812019-01-09 22:17:55 -0800427}