Scope environment variable setting
authorBruce Forstall <brucefo@microsoft.com>
Sat, 26 Aug 2017 00:12:07 +0000 (17:12 -0700)
committerBruce Forstall <brucefo@microsoft.com>
Sat, 26 Aug 2017 00:12:07 +0000 (17:12 -0700)
commitfdc8bc20e453c928e0c2c4f4fb64c8003fcc0647
tree11b78b8a15fe57d2a24097c9a148ff490f677614
parent1eea080a7b3a13110975b92034a22e4fc473df46
Scope environment variable setting

The product and test build scripts invoke Visual Studio environment
setting scripts several times during the build process. If doing a full
cross architecture build including test build, it's as many as five times.
These environment changes are cumulative. For the PATH variable, in
particular, they can lead to a failure by exceeding the variable
length limit. This seems to have been exacerbated by VS2017, which
has very long paths, and for which many things are added to the PATH.

Fix this by adding "setlocal" / "endlocal" around various sections
of the scripts, so that the multiple calls to the environment script
are not cumulative.

(There is still some cumulative environment setting, as build.cmd
calls VsDevCmd.bat, then if tests are being built, calls build-test.cmd,
which also calls VsDevCmd.bat, and then possibly in addition calls
vcvarsall.bat.)

In addition, I simplified the code that sets up the msbuild logging
parameters, so it is more readable, regular, and doesn't have so
much repeated text.
build-test.cmd
build.cmd