gecko-dev/servo/mach.bat
Andrés Barreiro f192eda281 servo: Merge #19324 - Get back to working dir after vcvarsall.bat (from drewler:fix_matchbat); r=jdm
<!-- Please describe your changes on the following line: -->

When using cmd.exe directly (instead of `x86_x64 Cross Tools Command Prompt for VS 2017`), vcvarsall.bat changes the working directory.
To prevent this, pushd and popd could be used.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [X] These changes do not require tests because they are part of the build process.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: a20efc6d7bbbfa7261eea9a0aa534420724a1dbc

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 89a364953e569531902d36ce013b46ca19fca33b
2017-11-21 17:27:34 -06:00

40 lines
936 B
Batchfile

@echo off
pushd .
IF EXIST "%ProgramFiles(x86)%" (
set "ProgramFiles32=%ProgramFiles(x86)%"
) ELSE (
set "ProgramFiles32=%ProgramFiles%"
)
set VC14VARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat
IF EXIST "%VC14VARS%" (
set "VS_VCVARS=%VC14VARS%"
) ELSE (
for %%e in (Enterprise Professional Community BuildTools) do (
IF EXIST "%ProgramFiles32%\Microsoft Visual Studio\2017\%%e\VC\Auxiliary\Build\vcvarsall.bat" (
set "VS_VCVARS=%ProgramFiles32%\Microsoft Visual Studio\2017\%%e\VC\Auxiliary\Build\vcvarsall.bat"
)
)
)
IF EXIST "%VS_VCVARS%" (
IF NOT DEFINED Platform (
IF EXIST "%ProgramFiles(x86)%" (
call "%VS_VCVARS%" x64
) ELSE (
ECHO 32-bit Windows is currently unsupported.
EXIT /B
)
)
) ELSE (
ECHO Visual Studio 2015 or 2017 is not installed.
ECHO Download and install Visual Studio 2015 or 2017 from https://www.visualstudio.com/
EXIT /B
)
popd
python mach %*