Skip to content

Commit

Permalink
ci: Stop building Go code twice (#4501)
Browse files Browse the repository at this point in the history
### Description

When we use the makefile, we build the Go code, then build the Rust
code, but the Rust code in turn builds the Go code again.

This PR stops that by removing `go-turbo` as a dependency of `turbo` in
the Makefile. Instead we rely on the build.rs script to kick off
compilation of the Go code.

### Testing Instructions

Existing CI should test it. And hopefully be faster.
  • Loading branch information
NicholasLYang authored Apr 10, 2023
1 parent c39a59f commit 81fc849
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ GO_FILES = $(shell find . -name "*.go")
SRC_FILES = $(shell find . -name "*.go" | grep -v "_test.go")
GENERATED_FILES = internal/turbodprotocol/turbod.pb.go internal/turbodprotocol/turbod_grpc.pb.go

turbo: go-turbo$(EXT)
cargo build --manifest-path ../crates/turborepo/Cargo.toml
# We do not set go-turbo as a dependency because the Rust build.rs
# script will call it for us and copy over the binary
turbo:
cargo build -p turbo

turbo-prod: go-turbo$(EXT)
turbo-prod:
cargo build --release --manifest-path ../crates/turborepo/Cargo.toml

go-turbo$(EXT): $(GENERATED_FILES) $(SRC_FILES) go.mod turborepo-ffi-install
CGO_ENABLED=1 go build -tags $(GO_TAG) -o go-turbo$(EXT) ./cmd/turbo


.PHONY: turborepo-ffi-install
turborepo-ffi-install: turborepo-ffi turborepo-ffi-copy-bindings
cp ../crates/turborepo-ffi/target/debug/libturborepo_ffi.a ./internal/ffi/libturborepo_ffi_$(GOOS)_$(GOARCH).a
Expand Down Expand Up @@ -131,7 +134,7 @@ ifeq ($(UNAME), Windows)
endif

clean-go:
go clean -testcache ./...
go clean -testcache -r

test-go: $(GENERATED_FILES) $(GO_FILES) go.mod go.sum turborepo-ffi-install
go test $(TURBO_RACE) -tags $(GO_TAG) ./...
Expand Down

0 comments on commit 81fc849

Please sign in to comment.