Skip to content

Commit 0eeacde

Browse files
davvidgitster
authored andcommitted
Makefile: build libgit-rs and libgit-sys serially
"make -JN" with INCLUDE_LIBGIT_RS enabled causes cargo lock warnings and can trigger ld errors during the build. The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs. Make libgit-rs depend on libgit-sys so that "make" prevents them from running concurrently. Apply the same logic to the test invocations. Use cargo's "--manifest-path" option instead of "cd" in the recipes. Signed-off-by: David Aguilar <davvid@gmail.com> Acked-by: Kyle Lippincott <spectral@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 16bd9f2 commit 0eeacde

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3946,13 +3946,12 @@ unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X
39463946
$(MAKE) -C t/ unit-tests
39473947

39483948
.PHONY: libgit-sys libgit-rs
3949-
libgit-sys libgit-rs:
3950-
$(QUIET)(\
3951-
cd contrib/$@ && \
3952-
cargo build \
3953-
)
3949+
libgit-sys:
3950+
$(QUIET)cargo build --manifest-path contrib/libgit-sys/Cargo.toml
3951+
libgit-rs: libgit-sys
3952+
$(QUIET)cargo build --manifest-path contrib/libgit-rs/Cargo.toml
39543953
ifdef INCLUDE_LIBGIT_RS
3955-
all:: libgit-sys libgit-rs
3954+
all:: libgit-rs
39563955
endif
39573956

39583957
LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o

t/Makefile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,9 @@ perf:
190190

191191
.PHONY: libgit-sys-test libgit-rs-test
192192
libgit-sys-test:
193-
$(QUIET)(\
194-
cd ../contrib/libgit-sys && \
195-
cargo test \
196-
)
197-
libgit-rs-test:
198-
$(QUIET)(\
199-
cd ../contrib/libgit-rs && \
200-
cargo test \
201-
)
193+
$(QUIET)cargo test --manifest-path ../contrib/libgit-sys/Cargo.toml
194+
libgit-rs-test: libgit-sys-test
195+
$(QUIET)cargo test --manifest-path ../contrib/libgit-rs/Cargo.toml
202196
ifdef INCLUDE_LIBGIT_RS
203-
all:: libgit-sys-test libgit-rs-test
197+
all:: libgit-rs-test
204198
endif

0 commit comments

Comments
 (0)