Commit Graph

9 Commits

Author SHA1 Message Date
Eli Schwartz fec7265b5c
flake8: use plain strings instead of f-strings when no variables used 2022-02-16 18:19:12 -05:00
Nazar Mokrynskyi 44e7f75cc3 Remove unnecessary check during VS activation 2022-02-03 09:13:35 -05:00
Nirbheek Chauhan faf79f4539 Add a test for the --vsenv meson setup option
The tests and the unittests both unconditionally call setup_vsenv()
because all tests are run using the backend commands directly: ninja,
msbuild, etc.

There's no way to undo this vs env setup, so the only way to test that
--vsenv works is by:

1. Removing all paths in PATH that provide ninja
2. Changing setup_vsenv(force=True) to forcibly set-up a new vsenv
   when MESON_FORCE_VSENV_FOR_UNITTEST is set
3. Mock-patching build_command, test_command, install_command to use
   `meson` instead of `ninja`
4. Asserting that 'Activating VS' is in the output for all commands
5. Ensure that compilation works because ninja is picked up from the
   vs env.

I manually checked that this test actually does fail when the previous
commit is reverted.
2022-01-16 23:42:19 +05:30
DFOVIT eeb110ab02 Search for Visual Studio Express when activating VS env
Visual Studio Express does not come with the
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' workload.
This adds a check for the 'Microsoft.VisualStudio.Workload.WDExpress'
workload. Non-express versions take precedence over express versions
when activating.
2022-01-13 01:14:26 +05:30
Xavier Claessens 37ea997ca4 Fix "meson compile" not activating vsenv
setup_vsenv() was not propagating the return value, so build.need_vsenv
was always False.
2021-10-29 08:54:49 -04:00
Gabor Kertesz 60c8fedb95 Add support for win-arm64 to MSVC
For Windows on Arm win-arm64 platform, the corresponding vcvars
is called now.
2021-10-20 12:34:58 -04:00
Gabor Kertesz 747982e6cb Fix NamedTemporaryFile file reopen issue on Win #9412
NamedTemporaryFile can't be opened by name on Windows.
For Windows the created temporary bat file is now closed before
passing to a subprocess, prevented from removal automatically upon
close and deleted explicitly upon finish.
2021-10-19 09:41:17 -04:00
Matthew Brett 6718556571 Add missing but expected as exception clause
The `except` line was missing its `as e` clause.

As a result, when erroring out, after not finding a compiler, Meson
gives an error ending:

```
File "C:\Users\Matthew\AppData\Roaming\Python\Python39\site-packages\mesonbuild\mesonlib\vsenv.py",
  line 100, in setup_vsenv
      mlog.warning('Failed to activate VS environment:', str(e))
```
2021-10-16 12:41:02 -04:00
Xavier Claessens 928078982c Add --vsenv command line option and active VS only when needed 2021-10-10 23:15:18 +03:00