* Bazel's hermetic java, from `SE_BAZEL_JAVA_LOCATION` (a file holding the `$(JAVA)` path). * @return {(string|undefined)} the java executable, or undefined to use the server's default.
()
| 631 | * @return {(string|undefined)} the java executable, or undefined to use the server's default. |
| 632 | */ |
| 633 | function bazelJava() { |
| 634 | const javaLocation = process.env['SE_BAZEL_JAVA_LOCATION'] |
| 635 | if (!javaLocation) { |
| 636 | return undefined |
| 637 | } |
| 638 | // $(JAVA) is an exec path (external/<repo>/...); without the prefix it is a runfiles path. |
| 639 | const execPath = fs.readFileSync(locate(javaLocation), { encoding: 'utf8' }).trim() |
| 640 | const java = locate(execPath.replace(/^external\//, '')) |
| 641 | // Resolve the JDK symlink to its real path to dodge a Windows JVM bug mapping lib\modules. |
| 642 | return process.platform === 'win32' ? fs.realpathSync(java) : java |
| 643 | } |
| 644 | |
| 645 | /** Browser name -> [driver env var, browser env var, vendor options key], for a Grid slot. */ |
| 646 | const GRID_BROWSERS = { |