2018-07-16 23:25:50 +03:00
|
|
|
all: build
|
|
|
|
|
2019-02-20 23:56:33 +03:00
|
|
|
GIT_COMMIT:=$(shell git rev-list -1 HEAD)
|
|
|
|
GIT_LAST_TAG:=$(shell git describe --abbrev=0 --tags)
|
|
|
|
GIT_EXACT_TAG:=$(shell git name-rev --name-only --tags HEAD)
|
2019-11-05 23:29:15 +03:00
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
XARGS:=xargs -r
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
XARGS:=xargs
|
|
|
|
endif
|
|
|
|
|
2024-08-24 18:08:00 +03:00
|
|
|
COMMANDS_PATH:=github.com/git-bug/git-bug/commands
|
2019-02-20 23:56:33 +03:00
|
|
|
LDFLAGS:=-X ${COMMANDS_PATH}.GitCommit=${GIT_COMMIT} \
|
|
|
|
-X ${COMMANDS_PATH}.GitLastTag=${GIT_LAST_TAG} \
|
|
|
|
-X ${COMMANDS_PATH}.GitExactTag=${GIT_EXACT_TAG}
|
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: build
|
2018-07-16 23:39:25 +03:00
|
|
|
build:
|
2018-07-16 23:25:50 +03:00
|
|
|
go generate
|
2019-02-20 23:56:33 +03:00
|
|
|
go build -ldflags "$(LDFLAGS)" .
|
2018-07-16 23:25:50 +03:00
|
|
|
|
2018-09-25 19:52:46 +03:00
|
|
|
# produce a build debugger friendly
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: debug-build
|
2018-09-25 19:52:46 +03:00
|
|
|
debug-build:
|
|
|
|
go generate
|
2019-02-20 23:56:33 +03:00
|
|
|
go build -ldflags "$(LDFLAGS)" -gcflags=all="-N -l" .
|
2018-09-25 19:52:46 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: install
|
2018-07-16 23:25:50 +03:00
|
|
|
install:
|
|
|
|
go generate
|
2019-02-24 19:40:52 +03:00
|
|
|
go install -ldflags "$(LDFLAGS)" .
|
2018-07-16 23:25:50 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: releases
|
2020-01-22 16:14:24 +03:00
|
|
|
releases:
|
|
|
|
go generate
|
2022-11-20 18:26:43 +03:00
|
|
|
go run github.com/mitchellh/gox@v1.0.1 -ldflags "$(LDFLAGS)" -osarch '!darwin/386' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
|
2020-01-22 16:14:24 +03:00
|
|
|
|
2022-09-09 00:20:51 +03:00
|
|
|
secure: secure-practices secure-vulnerabilities
|
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: secure-practices
|
2022-09-09 00:20:51 +03:00
|
|
|
secure-practices:
|
2023-03-04 16:11:58 +03:00
|
|
|
go run github.com/praetorian-inc/gokart scan
|
2022-09-09 00:20:51 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: secure-vulnerabilities
|
2022-09-09 00:20:51 +03:00
|
|
|
secure-vulnerabilities:
|
2023-03-04 16:11:58 +03:00
|
|
|
go run golang.org/x/vuln/cmd/govulncheck ./...
|
2022-09-09 00:20:51 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: test
|
2018-08-19 21:40:50 +03:00
|
|
|
test:
|
2019-06-07 03:35:40 +03:00
|
|
|
go test -v -bench=. ./...
|
2018-07-17 00:20:23 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: pack-webui
|
2018-08-06 15:15:27 +03:00
|
|
|
pack-webui:
|
2018-07-17 03:10:04 +03:00
|
|
|
npm run --prefix webui build
|
2018-08-06 15:15:27 +03:00
|
|
|
go run webui/pack_webui.go
|
2018-07-17 03:10:04 +03:00
|
|
|
|
2018-09-02 01:06:50 +03:00
|
|
|
# produce a build that will fetch the web UI from the filesystem instead of from the binary
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: debug-webui
|
2018-09-02 01:06:50 +03:00
|
|
|
debug-webui:
|
2019-02-24 19:40:52 +03:00
|
|
|
go build -ldflags "$(LDFLAGS)" -tags=debugwebui
|
2018-09-02 01:06:50 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: clean-local-bugs
|
2018-08-16 19:20:11 +03:00
|
|
|
clean-local-bugs:
|
2019-11-05 23:29:15 +03:00
|
|
|
git for-each-ref refs/bugs/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
|
|
|
|
git for-each-ref refs/remotes/origin/bugs/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
|
2019-02-23 15:02:53 +03:00
|
|
|
rm -f .git/git-bug/bug-cache
|
2018-08-16 19:20:11 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: clean-remote-bugs
|
2018-08-17 13:51:55 +03:00
|
|
|
clean-remote-bugs:
|
2019-11-05 23:29:15 +03:00
|
|
|
git ls-remote origin "refs/bugs/*" | cut -f 2 | $(XARGS) git push origin -d
|
2018-08-17 13:51:55 +03:00
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: clean-local-identities
|
2019-02-23 15:02:53 +03:00
|
|
|
clean-local-identities:
|
2019-11-05 23:29:15 +03:00
|
|
|
git for-each-ref refs/identities/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
|
|
|
|
git for-each-ref refs/remotes/origin/identities/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
|
2019-02-23 15:02:53 +03:00
|
|
|
rm -f .git/git-bug/identity-cache
|
|
|
|
|
2022-10-11 21:20:51 +03:00
|
|
|
.PHONY: clean-local-identities
|
2020-03-06 00:02:58 +03:00
|
|
|
clean-remote-identities:
|
|
|
|
git ls-remote origin "refs/identities/*" | cut -f 2 | $(XARGS) git push origin -d
|