summaryrefslogtreecommitdiff
path: root/mesonbuild/mcompile.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-07-31 11:18:46 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2022-08-12 17:07:41 +0300
commit28d07c31b818d04dede11a3e48a87e5265d53c8f (patch)
treeac306bdbd51ee43a0abe6c99d8f557e5bad97c88 /mesonbuild/mcompile.py
parent6db9a014497761efa19e953e67645c8c0690820c (diff)
downloadmeson-28d07c31b818d04dede11a3e48a87e5265d53c8f.tar.gz
mcompile: provide user visibility into what actually happens
This command is magical and I hate it. Mostly because it seems people have no clue what it does, and what it doesn't do. Provide informational messages to the user indicating how it works, e.g. for debugging. Point out if we ran vsenv before shelling out to the backend.
Diffstat (limited to 'mesonbuild/mcompile.py')
-rw-r--r--mesonbuild/mcompile.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py
index cea2f727b..432de440d 100644
--- a/mesonbuild/mcompile.py
+++ b/mesonbuild/mcompile.py
@@ -22,11 +22,12 @@ import shutil
import typing as T
from collections import defaultdict
from pathlib import Path
+from time import sleep
from . import mlog
from . import mesonlib
from . import coredata
-from .mesonlib import MesonException, RealPathAction, setup_vsenv
+from .mesonlib import MesonException, RealPathAction, join_args, setup_vsenv
from mesonbuild.environment import detect_ninja
from mesonbuild.coredata import UserArrayOption
from mesonbuild import build
@@ -336,13 +337,16 @@ def run(options: 'argparse.Namespace') -> int:
cdata = coredata.load(options.wd)
b = build.load(options.wd)
- setup_vsenv(b.need_vsenv)
+ vsenv_active = setup_vsenv(b.need_vsenv)
+ if vsenv_active:
+ mlog.log(mlog.green('INFO:'), 'automatically activated MSVC compiler environment')
cmd = [] # type: T.List[str]
env = None # type: T.Optional[T.Dict[str, str]]
backend = cdata.get_option(mesonlib.OptionKey('backend'))
assert isinstance(backend, str)
+ mlog.log(mlog.green('INFO:'), 'autodetecting backend as', backend)
if backend == 'ninja':
cmd, env = get_parsed_args_ninja(options, bdir)
elif backend.startswith('vs'):
@@ -353,6 +357,8 @@ def run(options: 'argparse.Namespace') -> int:
raise MesonException(
f'Backend `{backend}` is not yet supported by `compile`. Use generated project files directly instead.')
+ mlog.log(mlog.green('INFO:'), 'calculating backend command to run:', join_args(cmd))
+ sleep(2)
p, *_ = mesonlib.Popen_safe(cmd, stdout=sys.stdout.buffer, stderr=sys.stderr.buffer, env=env)
return p.returncode