mcompile: fix broken codepaths and restore orphaned code
In commit928078982c
a good error message about the directory not being a valid build directory, was replaced by a worse message. In commitabaa980436
the error message was replaced by a traceback when trying to load the coredata before checking if it was a build directory. Revert back to using the helper function with the good error message. Reorganize code so that we check basic things first, and do less work before detecting errors. Fixes #9584
This commit is contained in:
parent
ab924fc1de
commit
88f8a8ea15
|
@ -322,20 +322,18 @@ def add_arguments(parser: 'argparse.ArgumentParser') -> None:
|
|||
)
|
||||
|
||||
def run(options: 'argparse.Namespace') -> int:
|
||||
cdata = coredata.load(options.wd)
|
||||
bdir = Path(options.wd)
|
||||
buildfile = bdir / 'meson-private' / 'build.dat'
|
||||
if not buildfile.is_file():
|
||||
raise MesonException(f'Directory {options.wd!r} does not seem to be a Meson build directory.')
|
||||
validate_builddir(bdir)
|
||||
if options.targets and options.clean:
|
||||
raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously')
|
||||
|
||||
cdata = coredata.load(options.wd)
|
||||
b = build.load(options.wd)
|
||||
setup_vsenv(b.need_vsenv)
|
||||
|
||||
cmd = [] # type: T.List[str]
|
||||
env = None # type: T.Optional[T.Dict[str, str]]
|
||||
|
||||
if options.targets and options.clean:
|
||||
raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously')
|
||||
|
||||
backend = cdata.get_option(mesonlib.OptionKey('backend'))
|
||||
assert isinstance(backend, str)
|
||||
if backend == 'ninja':
|
||||
|
|
Loading…
Reference in New Issue