Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce Go recompilation when libpreflight changes #220

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ endif
# it would need to distinguish when we are crosscompiling and when we are not
# (libpreflight.a is put at target/release-with-panic-unwind/ when not cross compiling)
CARGO_BUILD_TARGET ?= $(shell rustc -vV | sed -n 's|host: ||p')
LIBPREFLIGHT = target/$(CARGO_BUILD_TARGET)/release-with-panic-unwind/libpreflight.a

# update the Cargo.lock every time the Cargo.toml changes.
Cargo.lock: Cargo.toml
Cargo.lock: Cargo.toml ./cmd/soroban-rpc/lib/preflight/Cargo.toml
cargo update --workspace

install: build-libpreflight
install: $(LIBPREFLIGHT)
go install -ldflags="${GOLDFLAGS}" ${MACOS_MIN_VER} ./...


build: build-libpreflight
build: $(LIBPREFLIGHT)
go build -ldflags="${GOLDFLAGS}" ${MACOS_MIN_VER} ./...

build-libpreflight: Cargo.lock

build-libpreflight: $(LIBPREFLIGHT)

$(LIBPREFLIGHT): Cargo.lock cmd/soroban-rpc/lib/preflight/src/lib.rs
# invalidate golang's wrapper package to enforce a rebuild whenever libpreflight changes
go clean -cache -i ./cmd/soroban-rpc/internal/preflight
cd cmd/soroban-rpc/lib/preflight && cargo build --target $(CARGO_BUILD_TARGET) --profile release-with-panic-unwind

check: rust-check go-check
Expand All @@ -66,19 +72,19 @@ fmt:
rust-test:
cargo test

go-test: build-libpreflight
go-test: $(LIBPREFLIGHT)
go test ./...

test: go-test rust-test

clean:
cargo clean
go clean ./...
go clean -cache -testcache

# the build-soroban-rpc build target is an optimized build target used by
# https://github.com/stellar/pipelines/stellar-horizon/Jenkinsfile-soroban-rpc-package-builder
# as part of the package building.
build-soroban-rpc: build-libpreflight
build-soroban-rpc: $(LIBPREFLIGHT)
go build -ldflags="${GOLDFLAGS}" ${MACOS_MIN_VER} -o soroban-rpc -trimpath -v ./cmd/soroban-rpc

go-check-changes:
Expand Down
Loading