Skip to content

Commit e4095d0

Browse files
authored
[tooling] Add scripts that build+run tools and put them in the path (#3878)
1 parent d6ce7ec commit e4095d0

8 files changed

+35
-27
lines changed

.envrc

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ use flake
33
# Repo-local commands like ginkgo and tmpnetctl
44
PATH_add bin
55

6-
# Built binaries like avalanchego and xsvm
7-
PATH_add build
8-
96
# Configure the explicit built path of avalanchego for tmpnet usage
10-
export AVALANCHEGO_PATH=$PWD/build/avalanchego
7+
export AVALANCHEGO_PATH=$PWD/bin/avalanchego
118

129
# Configure the local plugin directory for both avalanchego and tmpnet usage
1310
mkdir -p $PWD/build/plugins # avalanchego will FATAL if the directory does not exist

bin/avalanchego

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../scripts/run_avalanchego.sh

bin/ginkgo

-10
This file was deleted.

bin/ginkgo

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../scripts/run_ginkgo.sh

bin/tmpnetctl

-10
This file was deleted.

bin/tmpnetctl

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../scripts/run_tmpnetctl.sh

scripts/build.sh

-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ source "${REPO_ROOT}"/scripts/constants.sh
3131
# Determine the git commit hash to use for the build
3232
source "${REPO_ROOT}"/scripts/git_commit.sh
3333

34-
echo "Downloading dependencies..."
35-
go mod download
36-
3734
echo "Building AvalancheGo with [$(go version)]..."
3835
go build ${race} -o "${avalanchego_path}" \
3936
-ldflags "-X github.com/ava-labs/avalanchego/version.GitCommit=$git_commit $static_ld_flags" \

scripts/run_avalanchego.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
AVALANCHE_PATH=$(cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
6+
cd "${AVALANCHE_PATH}"
7+
8+
# Build the binary before execution to ensure it is always up-to-date. Faster than `go run`.
9+
./scripts/build.sh
10+
./build/avalanchego "${@}"

scripts/run_ginkgo.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# Ensure the go command is run from the root of the repository so that its go.mod file is used
6+
AVALANCHE_PATH=$(cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
7+
cd "${AVALANCHE_PATH}"
8+
9+
# Installing and then running is faster than `go run`.
10+
GOBIN="${AVALANCHE_PATH}/build" go install github.com/onsi/ginkgo/v2/ginkgo
11+
./build/ginkgo "${@}"

scripts/run_tmpnetctl.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
AVALANCHE_PATH=$(cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
6+
cd "${AVALANCHE_PATH}"
7+
8+
# Build the binary before execution to ensure it is always up-to-date. Faster than `go run`.
9+
./scripts/build_tmpnetctl.sh
10+
./build/tmpnetctl "${@}"

0 commit comments

Comments
 (0)