diff --git a/windows/Dockerfile b/windows/Dockerfile index 2d5d56644922d8fd648bb30770dab5e2835033f8..699bc7b85842b48d8ebef7676fb8a336395ab4d4 100644 --- a/windows/Dockerfile +++ b/windows/Dockerfile @@ -121,3 +121,4 @@ RUN python -m pip --no-cache-dir install --no-warn-script-location \ numpy \ scipy \ pandas +COPY lib.ps1 C:/lib.ps1 diff --git a/windows/lib.ps1 b/windows/lib.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..efe232401669206c33b1a8ef8603a3edc42e9d11 --- /dev/null +++ b/windows/lib.ps1 @@ -0,0 +1,28 @@ + +# +# Sets up Visual Studio Development environment +# +function VSDevEnv { + pushd "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/Common7/Tools" + cmd /c "VsDevCmd.bat $args & set" | + foreach { + if ($_ -match "=") { + $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" + } + } + popd +} + +# +# Sets exit to error when the command fails +# +function Must-Run { + $command = $args[0] + $arguments = $args[1..($args.Length)] + & $command @arguments + if (!$?) { + $Host.SetShouldExit(1) + Write-Error "Exit code $LastExitCode while running $command $arguments" + Exit(1) + } +}