Windows environment variable name can contain brackets

Bazel cuts off environment variables with brackets in name.
It leads to a problem for me.

I have Visual Studio 2017 with workloads "Desktop C++ development", "TypeScript 3.1 SDK", "Python Web Support" installed.
I use Visual Studio toolchain configuration script similar to `tools/cpp/windows_cc_configure.bzl`.
My script in contrast to original finds more tools and checks a result of `VCVARSALL.BAT` also.
I noticed that `VCVARSALL.BAT` fails with error:
```
[ERROR:typescript.bat] TypeScript was not added to PATH since a valid installation was not found
[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ***
[ERROR:VsDevCmd.bat] In an uninitialized command prompt, please 'set VSCMD_DEBUG=[value]' and then re-run
[ERROR:VsDevCmd.bat] vsdevcmd.bat [args] for additional details.
[ERROR:VsDevCmd.bat] Where [value] is:
[ERROR:VsDevCmd.bat]    1 : basic debug logging
[ERROR:VsDevCmd.bat]    2 : detailed debug logging
[ERROR:VsDevCmd.bat]    3 : trace level logging. Redirection of output to a file when using this level is recommended.
[ERROR:VsDevCmd.bat] Example: set VSCMD_DEBUG=3
[ERROR:VsDevCmd.bat]          vsdevcmd.bat > vsdevcmd.trace.txt 2>&1
```
It happens because `typescript.bat` can't access `ProgramFiles(x86)` environment variable:
**typescript.bat**:
```
...
if exist "%ProgramFiles(x86)%\Microsoft SDKs\TypeScript\3.1" (
    set "PATH=%ProgramFiles(x86)%\Microsoft SDKs\TypeScript\3.1;%PATH%"
    set _TypeScript_Found=1
)
...
```

Exit code of `VCVARSALL.BAT` is ignored in original `tools/cpp/windows_cc_configure.bzl` so it is not critical bug but it can lead to unobvious errors for users who find external tools (TypeScript compiler, for example) with own scripts.

Closes #10605.

PiperOrigin-RevId: 291932741
1 file changed
tree: df4f17c94c567541e36bbb62577ada9ffbe2f9c1
  1. .bazelci/
  2. examples/
  3. scripts/
  4. site/
  5. src/
  6. third_party/
  7. tools/
  8. .bazelrc
  9. .gitattributes
  10. .gitignore
  11. AUTHORS
  12. BUILD
  13. CHANGELOG.md
  14. CODEOWNERS
  15. combine_distfiles.py
  16. combine_distfiles_to_tar.sh
  17. compile.sh
  18. CONTRIBUTING.md
  19. CONTRIBUTORS
  20. distdir.bzl
  21. ISSUE_TEMPLATE.md
  22. LICENSE
  23. README.md
  24. WORKSPACE
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel rebuilds only 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.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status