Only build binary for current architecture in dev mode (#161)
This commit is contained in:
parent
05c25c4c47
commit
0f9b8ba790
6 changed files with 899 additions and 391 deletions
25
Makefile
25
Makefile
|
@ -8,6 +8,8 @@ GO_TEST_FLAGS ?= -race
|
|||
GO_BUILD_FLAGS ?=
|
||||
MM_UTILITIES_DIR ?= ../mattermost-utilities
|
||||
DLV_DEBUG_PORT := 2346
|
||||
DEFAULT_GOOS := $(shell go env GOOS)
|
||||
DEFAULT_GOARCH := $(shell go env GOARCH)
|
||||
|
||||
export GO111MODULE=on
|
||||
|
||||
|
@ -53,25 +55,34 @@ ifneq ($(HAS_SERVER),)
|
|||
golangci-lint run ./...
|
||||
endif
|
||||
|
||||
## Builds the server, if it exists, for all supported architectures.
|
||||
## Builds the server, if it exists, for all supported architectures, unless MM_SERVICESETTINGS_ENABLEDEVELOPER is set.
|
||||
.PHONY: server
|
||||
server:
|
||||
ifneq ($(HAS_SERVER),)
|
||||
mkdir -p server/dist;
|
||||
ifeq ($(MM_DEBUG),)
|
||||
ifneq ($(MM_SERVICESETTINGS_ENABLEDEVELOPER),)
|
||||
@echo Building plugin only for $(DEFAULT_GOOS)-$(DEFAULT_GOARCH) because MM_SERVICESETTINGS_ENABLEDEVELOPER is enabled
|
||||
cd server && $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-$(DEFAULT_GOOS)-$(DEFAULT_GOARCH);
|
||||
else
|
||||
cd server && env GOOS=linux GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-linux-amd64;
|
||||
cd server && env GOOS=linux GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-linux-arm64;
|
||||
cd server && env GOOS=darwin GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-darwin-amd64;
|
||||
cd server && env GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-darwin-arm64;
|
||||
cd server && env GOOS=windows GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-windows-amd64.exe;
|
||||
endif
|
||||
else
|
||||
$(info DEBUG mode is on; to disable, unset MM_DEBUG)
|
||||
|
||||
cd server && env GOOS=linux GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -gcflags "all=-N -l" -o dist/plugin-linux-amd64;
|
||||
cd server && env GOOS=linux GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -gcflags "all=-N -l" -o dist/plugin-linux-arm64;
|
||||
cd server && env GOOS=darwin GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -gcflags "all=-N -l" -o dist/plugin-darwin-amd64;
|
||||
cd server && env GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -gcflags "all=-N -l" -o dist/plugin-darwin-arm64;
|
||||
cd server && env GOOS=windows GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -gcflags "all=-N -l" -o dist/plugin-windows-amd64.exe;
|
||||
ifneq ($(MM_SERVICESETTINGS_ENABLEDEVELOPER),)
|
||||
@echo Building plugin only for $(DEFAULT_GOOS)-$(DEFAULT_GOARCH) because MM_SERVICESETTINGS_ENABLEDEVELOPER is enabled
|
||||
cd server && $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-$(DEFAULT_GOOS)-$(DEFAULT_GOARCH);
|
||||
else
|
||||
cd server && env GOOS=linux GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-linux-amd64;
|
||||
cd server && env GOOS=linux GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-linux-arm64;
|
||||
cd server && env GOOS=darwin GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-darwin-amd64;
|
||||
cd server && env GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-darwin-arm64;
|
||||
cd server && env GOOS=windows GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-windows-amd64.exe;
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ module github.com/mattermost/mattermost-plugin-starter-template/build
|
|||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/go-git/go-git/v5 v5.1.0
|
||||
github.com/mattermost/mattermost-server/v6 v6.0.0-20210906125346-b41b7eae1026
|
||||
github.com/go-git/go-git/v5 v5.4.2
|
||||
github.com/mattermost/mattermost-server/v6 v6.2.1
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
)
|
||||
|
|
638
build/go.sum
638
build/go.sum
File diff suppressed because it is too large
Load diff
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module github.com/mattermost/mattermost-plugin-starter-template
|
|||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/mattermost/mattermost-server/v6 v6.0.0-20210906125346-b41b7eae1026
|
||||
github.com/mattermost/mattermost-server/v6 v6.2.1
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"release_notes_url": "https://github.com/mattermost/mattermost-plugin-starter-template/releases/tag/v0.1.0",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.1.0",
|
||||
"min_server_version": "5.12.0",
|
||||
"min_server_version": "5.37.0",
|
||||
"server": {
|
||||
"executables": {
|
||||
"linux-amd64": "server/dist/plugin-linux-amd64",
|
||||
|
|
Reference in a new issue