Skip to content

Commit

Permalink
add Makefile, bazel support
Browse files Browse the repository at this point in the history
Add a Makefile and support generating bazel files to allow overriding
the dependency in CRDB.
  • Loading branch information
RaduBerinde committed Aug 30, 2024
1 parent 0c0dc30 commit ae293ba
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ go.work.sum

.idea/

# Bazel files, generated with 'make gen-bazel'.
/WORKSPACE
BUILD.bazel
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
GO := go
PKG := ./...
GOFLAGS :=
STRESSFLAGS :=
TAGS := crlib_invariants
TESTS := .

.PHONY: gen-bazel
gen-bazel:
@echo "Generating WORKSPACE"
@echo 'workspace(name = "com_github_cockroachdb_crlib")' > WORKSPACE
@echo 'Running gazelle...'
${GO} run github.com/bazelbuild/bazel-gazelle/cmd/[email protected] update --go_prefix=github.com/cockroachdb/crlib --repo_root=.
@echo 'You should now be able to build Cockroach using:'
@echo ' ./dev build short -- --override_repository=com_github_cockroachdb_crlib=${CURDIR}'

.PHONY: clean-bazel
clean-bazel:
git clean -dxf WORKSPACE BUILD.bazel '**/BUILD.bazel'

.PHONY: test
test:
${GO} test -tags '$(TAGS)' ${testflags} -run ${TESTS} ${PKG}

.PHONY: lint
lint:
${GO} test -tags '$(TAGS)' -run ${TESTS} ./internal/lint

.PHONY: stress
stress:
${GO} test -tags '$(TAGS)' -exec 'stress -p 2 -maxruns 1000' -v -run ${TESTS} ${PKG}

0 comments on commit ae293ba

Please sign in to comment.