add ability to pass builds flags/tags to go via make, update bra config (#46787)

This commit is contained in:
Dan Cech 2022-04-01 19:01:05 -04:00 committed by GitHub
parent 4c89c8c468
commit 5c3308c6f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -1,8 +1,8 @@
[run] [run]
init_cmds = [ init_cmds = [
["make", "gen-go"], ["make", "gen-go"],
["go", "run", "build.go", "-dev", "build-cli"], ["GO_BUILD_DEV=1", "make", "build-cli"],
["go", "run", "build.go", "-dev", "build-server"], ["GO_BUILD_DEV=1", "make", "build-server"],
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"] ["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
] ]
watch_all = true watch_all = true
@ -13,10 +13,10 @@ watch_dirs = [
"$WORKDIR/conf", "$WORKDIR/conf",
] ]
watch_exts = [".go", ".ini", ".toml", ".template.html"] watch_exts = [".go", ".ini", ".toml", ".template.html"]
ignore_files = ["wire_gen.go"] ignore_files = ["wire_gen.go"]
build_delay = 1500 build_delay = 1500
cmds = [ cmds = [
["make", "gen-go"], ["make", "gen-go"],
["go", "run", "build.go", "-dev", "build-server"], ["GO_BUILD_DEV=1", "make", "build-server"],
["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"] ["./bin/grafana-server", "-packaging=dev", "cfg:app_mode=development"]
] ]

View File

@ -14,6 +14,8 @@ GO_FILES ?= ./pkg/...
SH_FILES ?= $(shell find ./scripts -name *.sh) SH_FILES ?= $(shell find ./scripts -name *.sh)
API_DEFINITION_FILES = $(shell find ./pkg/api/docs/definitions -name '*.go' -print) API_DEFINITION_FILES = $(shell find ./pkg/api/docs/definitions -name '*.go' -print)
SWAGGER_TAG ?= latest SWAGGER_TAG ?= latest
GO_BUILD_FLAGS += $(if $(GO_BUILD_DEV),-dev)
GO_BUILD_FLAGS += $(if $(GO_BUILD_TAGS),-build-tags=$(GO_BUILD_TAGS))
all: deps build all: deps build
@ -87,15 +89,15 @@ gen-go: $(WIRE)
build-go: $(MERGED_SPEC_TARGET) gen-go ## Build all Go binaries. build-go: $(MERGED_SPEC_TARGET) gen-go ## Build all Go binaries.
@echo "build go files" @echo "build go files"
$(GO) run build.go build $(GO) run build.go $(GO_BUILD_FLAGS) build
build-server: ## Build Grafana server. build-server: ## Build Grafana server.
@echo "build server" @echo "build server"
$(GO) run build.go build-server $(GO) run build.go $(GO_BUILD_FLAGS) build-server
build-cli: ## Build Grafana CLI application. build-cli: ## Build Grafana CLI application.
@echo "build grafana-cli" @echo "build grafana-cli"
$(GO) run build.go build-cli $(GO) run build.go $(GO_BUILD_FLAGS) build-cli
build-js: ## Build frontend assets. build-js: ## Build frontend assets.
@echo "build frontend" @echo "build frontend"