From b7f0d30adf39f6e7b720878ea0310a1168cbf135 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 23 Feb 2024 14:37:09 -0500 Subject: [PATCH] cargo: Abort if project has build-dependencies In that case build.rs cannot be used and must be ported manually. --- mesonbuild/cargo/interpreter.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mesonbuild/cargo/interpreter.py b/mesonbuild/cargo/interpreter.py index 5148fe384632..4325bbc429b6 100644 --- a/mesonbuild/cargo/interpreter.py +++ b/mesonbuild/cargo/interpreter.py @@ -534,6 +534,13 @@ def _create_cfg(cargo: Manifest, build: builder.Builder) -> T.List[mparser.BaseN # cfg = rust.cargo_cfg(features, skip_build_rs: has_meson_build, info: cargo_info) version_arr = cargo.package.version.split('.') version_arr += ['' * (4 - len(version_arr))] + has_build_deps_message = None + if cargo.build_dependencies: + has_build_deps_message = build.block([ + build.function('error', [ + build.string('Cannot use build.rs with build-dependencies. It should be ported manually in meson/meson.build'), + ]), + ]) return [ build.assign(build.dict({ # https://doc.rust-lang.org/cargo/reference/environment-variables.html @@ -559,7 +566,8 @@ def _create_cfg(cargo: Manifest, build: builder.Builder) -> T.List[mparser.BaseN build.assign(build.function('import', [build.string('fs')]), 'fs'), build.assign(build.method('is_dir', build.identifier('fs'), [build.string('meson')]), 'has_meson_build'), build.if_(build.identifier('has_meson_build'), - build.block([build.function('subdir', [build.string('meson')])])), + build.block([build.function('subdir', [build.string('meson')])]), + has_build_deps_message), build.assign( build.method( 'cargo_cfg',