From 28d07c31b818d04dede11a3e48a87e5265d53c8f Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 31 Jul 2022 11:18:46 -0400 Subject: 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. --- mesonbuild/mcompile.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py index cea2f72..432de44 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 -- cgit v1.1