commit | 8ac46c157c5da63e97a5825316ce6f0c3290e189 | [log] [tgz] |
---|---|---|
author | Laszlo Csomor <laszlocsomor@google.com> | Tue Feb 26 04:51:31 2019 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Feb 26 04:52:45 2019 -0800 |
tree | 9e569805bbf515b1ae9798d76e577b6f4f946d11 | |
parent | ce7492782d2b6cbb576df0baf7a3c622a33986af [diff] |
Windows: add --incompatible_windows_escape_jvm_flags Add --incompatible_windows_escape_jvm_flags flag (default: false). This flag has no effect on platforms other than Windows. This flag affects how Bazel builds the launcher of java_binary and java_test targets. (The launcher is the .exe file that sets up the environment for the Java program and launches the JVM.) In particular, the flag controls whether or not Bazel will Bash-tokenize the jvm_flags that were declared in the BUILD file, and whether or not these jvm_flags are escaped by the launcher when it invokes the JVM. When the flag is enabled: - Bazel will Bash-tokenize java_binary.jvm_flags and java_test.jvm_flags (as documented by the Build Encyclopedia) before embedding them into the launcher. The build fails if an entry cannot be Bash-tokenized, e.g. if it has unterminated quotes. - The launcher will properly escape these flags when it runs the JVM as a subprocess (using launcher_util::WindowsEscapeArg2). - Result: the jvm_flags declared in the BUILD file will arrive to the Java program as intended. However, due to the extra Bash-tokenization step, some ill-formed flags are no longer accepted, e.g. `jvm_flags=["-Dfoo='a"]` now results in a build error. When the flag is disabled: - Bazel does not Bash-tokenize the jvm_flags before embedding them in the launcher. This preserves quoting meant to be stripped away, and it also means Bazel won't check whether the argument is properly quoted. - The launcher escapes the flags with a Bash-like escaping logic (launcher_util::WindowsEscapeArg) which cannot properly quote and escape everything. - Result: the jvm_flags declared in the BUILD file might get messed up as they are passed to the JVM, or the launcher may not even be able to run the JVM. However, due to the lack of Bash-tokenization, Bazel propagates some flags to the Java binary that it would no longer accept if the new `--incompatible_windows_escape_jvm_flags` were enabled, e.g. `jvm_flags=["'a"]` is fine. Incompatible flag: https://github.com/bazelbuild/bazel/issues/7486 Related: https://github.com/bazelbuild/bazel/issues/7072 RELNOTES[NEW]: Added --incompatible_windows_escape_jvm_flags flag: enables correct java_binary.jvm_flags and java_test.jvm_flags tokenization and escaping on Windows. (No-op on other platforms.) Change-Id: I531cc63cdfeccbe4b6d48876cb82870c1726a723 Closes #7490. PiperOrigin-RevId: 235700143
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel only rebuilds what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Follow our tutorials:
See CONTRIBUTING.md
Bazel is released in ‘Beta’. See the product roadmap to learn about the path toward a stable 1.0 release.