mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
libgit: add higher-level libgit crate
The C functions exported by libgit-sys do not provide an idiomatic Rust interface. To make it easier to use these functions via Rust, add a higher-level "libgit" crate, that wraps the lower-level configset API with an interface that is more Rust-y. This combination of $X and $X-sys crates is a common pattern for FFI in Rust, as documented in "The Cargo Book" [1]. [1] https://doc.rust-lang.org/cargo/reference/build-scripts.html#-sys-packages Co-authored-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
d76eb0dccc
commit
65c10aa8d5
12
Makefile
12
Makefile
@@ -417,7 +417,7 @@ include shared.mak
|
||||
# programs in oss-fuzz/.
|
||||
#
|
||||
# Define INCLUDE_LIBGIT_RS if you want `make all` and `make test` to build and
|
||||
# test the Rust crate in contrib/libgit-sys.
|
||||
# test the Rust crates in contrib/libgit-sys and contrib/libgit-rs.
|
||||
#
|
||||
# === Optional library: libintl ===
|
||||
#
|
||||
@@ -3742,7 +3742,7 @@ clean: profile-clean coverage-clean cocciclean
|
||||
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
|
||||
$(MAKE) -C Documentation/ clean
|
||||
$(RM) Documentation/GIT-EXCLUDED-PROGRAMS
|
||||
$(RM) -r contrib/libgit-sys/target
|
||||
$(RM) -r contrib/libgit-sys/target contrib/libgit-rs/target
|
||||
$(RM) contrib/libgit-sys/partial_symbol_export.o
|
||||
$(RM) contrib/libgit-sys/hidden_symbol_export.o
|
||||
$(RM) contrib/libgit-sys/libgitpub.a
|
||||
@@ -3908,14 +3908,14 @@ build-unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
|
||||
unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X
|
||||
$(MAKE) -C t/ unit-tests
|
||||
|
||||
.PHONY: libgit-sys
|
||||
libgit-sys:
|
||||
.PHONY: libgit-sys libgit-rs
|
||||
libgit-sys libgit-rs:
|
||||
$(QUIET)(\
|
||||
cd contrib/libgit-sys && \
|
||||
cd contrib/$@ && \
|
||||
cargo build \
|
||||
)
|
||||
ifdef INCLUDE_LIBGIT_RS
|
||||
all:: libgit-sys
|
||||
all:: libgit-sys libgit-rs
|
||||
endif
|
||||
|
||||
LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o
|
||||
|
||||
Reference in New Issue
Block a user