From 94b68a8a7d571df1c1bf2801e490ef784183e0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Mon, 6 May 2024 02:04:46 +0200 Subject: [PATCH] Error when no build config can be found --- jprm/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jprm/__init__.py b/jprm/__init__.py index 8aa41e9..74605c5 100644 --- a/jprm/__init__.py +++ b/jprm/__init__.py @@ -100,6 +100,7 @@ def get_config(path): build_cfg = load_manifest(config_path) if build_cfg is not None: return build_cfg + logger.warning("Failed to locate config file.") return None @@ -820,10 +821,14 @@ def cli_plugin(): help='Max number of cores to use during build (1)', ) def cli_plugin_build(path, output, dotnet_configuration, dotnet_framework, max_cpu_count, version): + build_cfg = get_config(path) + if build_cfg is None: + raise click.UsageError('No build config found in `{}`'.format(path)) + with tempfile.TemporaryDirectory() as bintemp: - build_plugin(path, output=bintemp, dotnet_config=dotnet_configuration, dotnet_framework=dotnet_framework, + build_plugin(path, output=bintemp, build_cfg=build_cfg, dotnet_config=dotnet_configuration, dotnet_framework=dotnet_framework, version=version, max_cpu_count=max_cpu_count) - filename = package_plugin(path, version=version, binary_path=bintemp, output=output) + filename = package_plugin(path, build_cfg=build_cfg, version=version, binary_path=bintemp, output=output) click.echo(filename)