mirror of
https://github.com/git/git.git
synced 2026-01-21 22:37:17 +09:00
Implement a trivial test balloon for our Rust build infrastructure by reimplementing the "varint.c" subsystem in Rust. This subsystem is chosen because it is trivial to convert and because it doesn't have any dependencies to other components of Git. If support for Rust is enabled, we stop compiling "varint.c" and instead compile and use "src/varint.rs". Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
42 lines
1013 B
Meson
42 lines
1013 B
Meson
libgit_rs_sources = [
|
|
'lib.rs',
|
|
'varint.rs',
|
|
]
|
|
|
|
# Unfortunately we must use a wrapper command to move the output file into the
|
|
# current build directory. This can fixed once `cargo build --artifact-dir`
|
|
# stabilizes. See https://github.com/rust-lang/cargo/issues/6790 for that
|
|
# effort.
|
|
cargo_command = [
|
|
shell,
|
|
meson.current_source_dir() / 'cargo-meson.sh',
|
|
meson.project_source_root(),
|
|
meson.current_build_dir(),
|
|
]
|
|
if get_option('buildtype') == 'release'
|
|
cargo_command += '--release'
|
|
endif
|
|
|
|
libgit_rs = custom_target('git_rs',
|
|
input: libgit_rs_sources + [
|
|
meson.project_source_root() / 'Cargo.toml',
|
|
],
|
|
output: 'libgitcore.a',
|
|
command: cargo_command,
|
|
)
|
|
libgit_dependencies += declare_dependency(link_with: libgit_rs)
|
|
|
|
if get_option('tests')
|
|
test('rust', cargo,
|
|
args: [
|
|
'test',
|
|
'--manifest-path',
|
|
meson.project_source_root() / 'Cargo.toml',
|
|
'--target-dir',
|
|
meson.current_build_dir() / 'target',
|
|
],
|
|
timeout: 0,
|
|
protocol: 'rust',
|
|
)
|
|
endif
|