Files
git/src/meson.build
brian m. carlson 39e4dcf77d rust: add a small wrapper around the hashfile code
Our new binary object map code avoids needing to be intimately involved
with file handling by simply writing data to an object implement Write.
This makes it very easy to test by writing to a Cursor wrapping a Vec
for tests, and thus decouples it from intimate knowledge about how we
handle files.

However, we will actually want to write our data to an actual file,
since that's the most practical way to persist data.  Implement a
wrapper around the hashfile code that implements the Write trait so that
we can write our object map into a file.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-07 17:41:03 -08:00

45 lines
1.0 KiB
Meson

libgit_rs_sources = [
'csum_file.rs',
'hash.rs',
'lib.rs',
'loose.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