diff --git a/scripts/run_ninja.py b/scripts/run_ninja.py index 16972b5..f886837 100755 --- a/scripts/run_ninja.py +++ b/scripts/run_ninja.py @@ -18,15 +18,20 @@ import os import platform import subprocess -def run_ninja(target: str, repo_path: str): + +def run_ninja(target: str, repo_path: str, *, dryrun:bool = False): build_dir = os.path.join(repo_path, 'build') cmd = 'ninja {}'.format(target) - subprocess.check_call(cmd, shell=True, cwd=build_dir) + if dryrun: + print('Dryrun. Command would have been:\n{}'.format(cmd)) + else: + subprocess.check_call(cmd, shell=True, cwd=build_dir) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Run ninja for LLVM.') parser.add_argument('target') parser.add_argument('repo_path', type=str, nargs='?', default=os.getcwd()) + parser.add_argument('--dryrun', action='store_true') args = parser.parse_args() - run_ninja(args.target, args.repo_path) + run_ninja(args.target, args.repo_path, dryrun=args.dryrun)