Build tooling enhancements (#10429)
* Add LDFLAGS variable * Replace curl by wget * Revert "Replace curl by wget" This reverts commit f40323c3d2e693f74a4a3f8705ab011feb3e378a. * Use curl instead of wget * Merge GO_LINKER_FLAGS into LDFLAGS
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
7f7f511d1c
Коммит
64562d53c0
21
Makefile
21
Makefile
@@ -48,12 +48,11 @@ GOPATH ?= $(shell go env GOPATH)
|
||||
GOFLAGS ?= $(GOFLAGS:)
|
||||
GO=go
|
||||
DELVE=dlv
|
||||
GO_LINKER_FLAGS ?= -ldflags \
|
||||
"-X github.com/mattermost/mattermost-server/model.BuildNumber=$(BUILD_NUMBER)\
|
||||
-X 'github.com/mattermost/mattermost-server/model.BuildDate=$(BUILD_DATE)'\
|
||||
-X github.com/mattermost/mattermost-server/model.BuildHash=$(BUILD_HASH)\
|
||||
-X github.com/mattermost/mattermost-server/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)\
|
||||
-X github.com/mattermost/mattermost-server/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)"
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildNumber=$(BUILD_NUMBER)"
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildDate=$(BUILD_DATE)"
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildHash=$(BUILD_HASH)"
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)"
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-server/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)"
|
||||
|
||||
# GOOS/GOARCH of the build host, used to determine whether we're cross-compiling or not
|
||||
BUILDER_GOOS_GOARCH="$(shell $(GO) env GOOS)_$(shell $(GO) env GOARCH)"
|
||||
@@ -429,7 +428,7 @@ cover: ## Runs the golang coverage tool. You must run the unit tests first.
|
||||
$(GO) tool cover -html=ecover.out
|
||||
|
||||
test-data: start-docker ## Add test data to the local instance.
|
||||
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) sampledata -w 1
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) sampledata -w 1
|
||||
|
||||
@echo You may need to restart the Mattermost server before using the following
|
||||
@echo ========================================================================
|
||||
@@ -441,8 +440,8 @@ run-server: start-docker ## Starts the server.
|
||||
@echo Running mattermost for development
|
||||
|
||||
mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
|
||||
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) --disableconfigwatch | \
|
||||
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) logs --logrus &
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) --disableconfigwatch | \
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) logs --logrus &
|
||||
|
||||
debug-server: start-docker
|
||||
mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
|
||||
@@ -457,7 +456,7 @@ run-cli: start-docker ## Runs CLI.
|
||||
@echo Running mattermost for development
|
||||
@echo Example should be like 'make ARGS="-version" run-cli'
|
||||
|
||||
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) ${ARGS}
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) ${ARGS}
|
||||
|
||||
run-client: ## Runs the webapp.
|
||||
@echo Running mattermost client for development
|
||||
@@ -506,7 +505,7 @@ restart-client: | stop-client run-client ## Restarts the webapp.
|
||||
|
||||
run-job-server: ## Runs the background job server.
|
||||
@echo Running job server for development
|
||||
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) jobserver --disableconfigwatch &
|
||||
$(GO) run $(GOFLAGS) -ldflags '$(LDFLAGS)' $(PLATFORM_FILES) jobserver --disableconfigwatch &
|
||||
|
||||
config-ldap: ## Configures LDAP.
|
||||
@echo Setting up configuration for local LDAP
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM golang:1.12
|
||||
|
||||
RUN apt-get update && apt-get install -y make git apt-transport-https ca-certificates curl software-properties-common build-essential zip wget xmlsec1
|
||||
RUN apt-get update && apt-get install -y make git apt-transport-https ca-certificates curl software-properties-common build-essential zip xmlsec1
|
||||
|
||||
@@ -3,15 +3,15 @@ dist: | check-style test package
|
||||
|
||||
build-linux:
|
||||
@echo Build Linux amd64
|
||||
env GOOS=linux GOARCH=amd64 $(GO) install -i $(GOFLAGS) $(GO_LINKER_FLAGS) ./...
|
||||
env GOOS=linux GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
||||
|
||||
build-osx:
|
||||
@echo Build OSX amd64
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) install -i $(GOFLAGS) $(GO_LINKER_FLAGS) ./...
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
||||
|
||||
build-windows:
|
||||
@echo Build Windows amd64
|
||||
env GOOS=windows GOARCH=amd64 $(GO) install -i $(GOFLAGS) $(GO_LINKER_FLAGS) ./...
|
||||
env GOOS=windows GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
||||
|
||||
build: build-linux build-windows build-osx
|
||||
|
||||
@@ -65,7 +65,7 @@ endif
|
||||
|
||||
@# Download prepackaged plugins
|
||||
@for plugin_package in $(PLUGIN_PACKAGES) ; do \
|
||||
curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | grep browser_download_url | cut -d '"' -f 4 | wget -qi - -P $(DIST_PATH)/prepackaged_plugins/ ;\
|
||||
curl -s https://api.github.com/repos/mattermost/$$plugin_package/releases/latest | awk -F\" '/browser_download_url/ { system("cd $(DIST_PATH)/prepackaged_plugins; curl -O " $$4) }';\
|
||||
done
|
||||
|
||||
@# ----- PLATFORM SPECIFIC -----
|
||||
|
||||
Ссылка в новой задаче
Block a user