Skip to content

Commit

Permalink
cargo: Abort if project has build-dependencies
Browse files Browse the repository at this point in the history
In that case build.rs cannot be used and must be ported manually.
  • Loading branch information
xclaesse committed Feb 26, 2024
1 parent 7c3a0f8 commit b068532
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mesonbuild/cargo/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,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
Expand All @@ -558,7 +565,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',
Expand Down

0 comments on commit b068532

Please sign in to comment.