Skip to content

Commit ae293ba

Browse files
committed
add Makefile, bazel support
Add a Makefile and support generating bazel files to allow overriding the dependency in CRDB.
1 parent 0c0dc30 commit ae293ba

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ go.work.sum
2323

2424
.idea/
2525

26+
# Bazel files, generated with 'make gen-bazel'.
27+
/WORKSPACE
28+
BUILD.bazel

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
GO := go
2+
PKG := ./...
3+
GOFLAGS :=
4+
STRESSFLAGS :=
5+
TAGS := crlib_invariants
6+
TESTS := .
7+
8+
.PHONY: gen-bazel
9+
gen-bazel:
10+
@echo "Generating WORKSPACE"
11+
@echo 'workspace(name = "com_github_cockroachdb_crlib")' > WORKSPACE
12+
@echo 'Running gazelle...'
13+
${GO} run github.com/bazelbuild/bazel-gazelle/cmd/[email protected] update --go_prefix=github.com/cockroachdb/crlib --repo_root=.
14+
@echo 'You should now be able to build Cockroach using:'
15+
@echo ' ./dev build short -- --override_repository=com_github_cockroachdb_crlib=${CURDIR}'
16+
17+
.PHONY: clean-bazel
18+
clean-bazel:
19+
git clean -dxf WORKSPACE BUILD.bazel '**/BUILD.bazel'
20+
21+
.PHONY: test
22+
test:
23+
${GO} test -tags '$(TAGS)' ${testflags} -run ${TESTS} ${PKG}
24+
25+
.PHONY: lint
26+
lint:
27+
${GO} test -tags '$(TAGS)' -run ${TESTS} ./internal/lint
28+
29+
.PHONY: stress
30+
stress:
31+
${GO} test -tags '$(TAGS)' -exec 'stress -p 2 -maxruns 1000' -v -run ${TESTS} ${PKG}

0 commit comments

Comments
 (0)