From 1c902ec876758b50d025ce161c6bb9382060012d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Mon, 6 May 2024 16:09:16 +0200 Subject: [PATCH] compat: Add Meson summary entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To make it less opaque what's actually going to be built, especially when set to auto. Co-authored-by: Håvard Sørbø --- compat/build.py | 28 ++++++++++++++++++++++------ compat/meson.build | 15 +++++++++------ meson.build | 7 +++++++ 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/compat/build.py b/compat/build.py index 327bdab9c..30402dad9 100644 --- a/compat/build.py +++ b/compat/build.py @@ -129,9 +129,17 @@ def setup(role: Role, auto_detect = "auto" in compat if auto_detect: - compat = {"native", "emulated"} if host_os in {"windows", "macos", "linux", "ios", "tvos", "android"} else set() + if host_os in {"windows", "macos", "linux", "ios", "tvos", "android"}: + summary = f"enabled by default for {host_os}-{host_arch}" + compat = {"native", "emulated"} + else: + summary = f"disabled by default for {host_os}-{host_arch}" + compat = set() elif "disabled" in compat: + summary = "disabled by user" compat = set() + else: + summary = "enabled by user" if "native" in compat: have_toolchain = True @@ -162,8 +170,10 @@ def setup(role: Role, except: pass - if not auto_detect and not have_toolchain: - raise ToolchainNotFoundError(f"unable to locate toolchain for {other_triplet}") + if not have_toolchain: + if not auto_detect: + raise ToolchainNotFoundError(f"unable to locate toolchain for {other_triplet}") + summary = "disabled due to missing toolchain for {other_triplet}" if host_os == "windows" and host_arch in {"x86_64", "x86"} and have_toolchain: if host_arch == "x86_64": @@ -294,10 +304,16 @@ def setup(role: Role, variable_names, output_names = zip(*[(output.identifier, output.name) \ for output in itertools.chain.from_iterable(outputs.values())]) - print(f"ok {','.join(variable_names)} {','.join(output_names)} {DEPFILE_FILENAME} {serialized_state}") + print("ok") + print(summary) + print(f"{','.join(variable_names)}") + print(f"{','.join(output_names)}") + print(DEPFILE_FILENAME) + print(serialized_state) except Exception as e: - details = "\n".join(traceback.format_exception(e)) - print(f"error {e}\n\n{details}") + print(f"error {e}") + print("") + traceback.print_exception(e) class ToolchainNotFoundError(Exception): diff --git a/compat/meson.build b/compat/meson.build index a6b38cbaa..137d3482c 100644 --- a/compat/meson.build +++ b/compat/meson.build @@ -53,12 +53,13 @@ if no_overridden_compat_bits if setup_output.startswith('error ') error('compat/build.py setup failed:', setup_output.substring(6)) endif - assert(setup_output.startswith('ok ')) - tokens = setup_output.substring(3).split(' ') - varnames = tokens[0].split(',') - outputs = tokens[1].split(',') - depfile = tokens[2] - state = tokens[3] + lines = setup_output.split('\n') + assert(lines[0] == 'ok') + compat_summary = lines[1] + varnames = lines[2].split(',') + outputs = lines[3].split(',') + depfile = lines[4] + state = lines[5] if host_os_family == 'darwin' install = false @@ -113,4 +114,6 @@ if no_overridden_compat_bits i += 1 endforeach +else + compat_summary = 'not available due to externally provided helper/agent assets' endif diff --git a/meson.build b/meson.build index 624eaf0b2..fde0715db 100644 --- a/meson.build +++ b/meson.build @@ -663,3 +663,10 @@ endif if build_tests subdir('tests') endif + +summary( + { + 'compat': compat_summary, + }, + section: 'Features', +)