Merge branch 'make-rust-analyzer-work' into 'main'

Build: Use meson_Cargo.toml.in for setting up the build

See merge request World/Phosh/squeekboard!657
This commit is contained in:
Marge Bot
2024-08-11 08:32:59 +00:00
3 changed files with 22 additions and 5 deletions

11
.gitignore vendored
View File

@ -1,9 +1,20 @@
_build/
debian/.debhelper/
debian/cargo/registry/
debian/cargo/.*cache*
debian/debhelper-build-stamp
debian/files
debian/*.substvars
debian/squeekboard/
debian/squeekboard-devel/
debian/tmp/
meson_Cargo.toml.in
po/squeekboard.pot
po/*.mo
TAGS
tags
target/
vendor/
vgdump
*.swp
*~

View File

@ -5,21 +5,21 @@ edition = "2021"
[lib]
name = "rs"
path = "@path@/src/lib.rs"
path = "src/lib.rs"
crate-type = ["staticlib", "rlib"]
# Cargo can't do autodiscovery if Cargo.toml is not in the root.
[[bin]]
name = "test_layout"
path = "@path@/src/bin/test_layout.rs"
path = "src/bin/test_layout.rs"
[[example]]
name = "test_layout"
path = "@path@/examples/test_layout.rs"
path = "examples/test_layout.rs"
[[example]]
name = "find_orphan_layouts"
path = "@path@/examples/find_orphan_layouts.rs"
path = "examples/find_orphan_layouts.rs"
[features]
zbus_v1_5 = []

View File

@ -85,10 +85,16 @@ summary = [
]
message('\n'.join(summary))
# 'rust-analyzer' does not work correctly, when the paths in 'Cargo.toml' have '@path@' in them.
cp = find_program('cp')
sed = find_program('sed')
copy_cargo_toml = run_command('cp', 'Cargo.toml', 'meson_Cargo.toml.in')
prepare_cargo_toml = run_command('sed', '-i', 's/path = "/path = "@path@\//', 'meson_Cargo.toml.in')
path_data = configuration_data()
path_data.set('path', meson.source_root())
cargo_toml = configure_file(
input: 'Cargo.toml',
input: 'meson_Cargo.toml.in',
output: 'Cargo.toml',
configuration: path_data,
)