2022-03-31 00:10:11 +02:00
|
|
|
.PHONY: prebuild clean cleanall ci server server-mac server-linux server-win server-linux-package generate watch-server webapp mac-app win-app-wpf linux-app modd-precheck templates-archive
|
2020-12-16 20:20:11 +01:00
|
|
|
|
2021-01-26 19:48:32 +01:00
|
|
|
PACKAGE_FOLDER = focalboard
|
2020-10-08 18:21:27 +02:00
|
|
|
|
2021-01-19 23:10:14 +01:00
|
|
|
# Build Flags
|
|
|
|
BUILD_NUMBER ?= $(BUILD_NUMBER:)
|
|
|
|
BUILD_DATE = $(shell date -u)
|
|
|
|
BUILD_HASH = $(shell git rev-parse HEAD)
|
|
|
|
# If we don't set the build number it defaults to dev
|
|
|
|
ifeq ($(BUILD_NUMBER),)
|
|
|
|
BUILD_NUMBER := dev
|
2021-09-21 18:51:04 +02:00
|
|
|
BUILD_DATE := n/a
|
2021-01-19 23:10:14 +01:00
|
|
|
endif
|
|
|
|
|
2022-03-22 15:24:34 +01:00
|
|
|
BUILD_TAGS += json1
|
|
|
|
|
2021-01-26 23:13:46 +01:00
|
|
|
LDFLAGS += -X "github.com/mattermost/focalboard/server/model.BuildNumber=$(BUILD_NUMBER)"
|
|
|
|
LDFLAGS += -X "github.com/mattermost/focalboard/server/model.BuildDate=$(BUILD_DATE)"
|
|
|
|
LDFLAGS += -X "github.com/mattermost/focalboard/server/model.BuildHash=$(BUILD_HASH)"
|
2021-01-19 23:10:14 +01:00
|
|
|
|
2022-01-25 10:42:56 +01:00
|
|
|
# MAC cpu architecture
|
|
|
|
ifeq ($(shell uname -m),arm64)
|
|
|
|
MAC_GO_ARCH := arm64
|
|
|
|
else
|
|
|
|
MAC_GO_ARCH := amd64
|
|
|
|
endif
|
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
all: webapp server ## Build server and webapp.
|
2020-10-08 18:21:27 +02:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
prebuild: ## Run prebuild actions (install dependencies etc.).
|
2020-11-03 23:37:29 +01:00
|
|
|
cd webapp; npm install
|
2020-10-08 18:21:27 +02:00
|
|
|
|
2021-01-20 18:55:36 +01:00
|
|
|
ci: server-test
|
|
|
|
cd webapp; npm run check
|
|
|
|
cd webapp; npm run test
|
|
|
|
cd webapp; npm run cypress:ci
|
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
templates-archive: ## Build templates archive file
|
2022-04-14 00:36:20 +02:00
|
|
|
cd server/assets/build-template-archive; go run -tags '$(BUILD_TAGS)' main.go --dir="../templates-boardarchive" --out="../templates.boardarchive"
|
2022-03-31 00:10:11 +02:00
|
|
|
|
|
|
|
server: templates-archive ## Build server for local environment.
|
2021-01-26 23:13:46 +01:00
|
|
|
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=dev")
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; go build -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' -o ../bin/focalboard-server ./main
|
2020-10-08 18:21:27 +02:00
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-mac: templates-archive ## Build server for Mac.
|
2020-11-07 19:50:34 +01:00
|
|
|
mkdir -p bin/mac
|
2021-01-26 23:13:46 +01:00
|
|
|
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=mac")
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; env GOOS=darwin GOARCH=$(MAC_GO_ARCH) go build -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' -o ../bin/mac/focalboard-server ./main
|
2020-11-07 19:50:34 +01:00
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-linux: templates-archive ## Build server for Linux.
|
2020-11-07 19:50:34 +01:00
|
|
|
mkdir -p bin/linux
|
2021-01-26 23:13:46 +01:00
|
|
|
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=linux")
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; env GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' -o ../bin/linux/focalboard-server ./main
|
2020-10-20 20:48:22 +02:00
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-win: templates-archive ## Build server for Windows.
|
2021-01-26 23:13:46 +01:00
|
|
|
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=win")
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; env GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' -o ../bin/win/focalboard-server.exe ./main
|
2020-11-03 23:37:29 +01:00
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-dll: templates-archive ## Build server as Windows DLL.
|
2021-03-01 20:36:36 +01:00
|
|
|
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=win")
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; env GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -tags '$(BUILD_TAGS)' -buildmode=c-shared -o ../bin/win-dll/focalboard-server.dll ./main
|
2021-03-01 20:36:36 +01:00
|
|
|
|
2020-12-16 20:20:11 +01:00
|
|
|
server-linux-package: server-linux webapp
|
|
|
|
rm -rf package
|
|
|
|
mkdir -p package/${PACKAGE_FOLDER}/bin
|
2021-01-28 23:23:52 +01:00
|
|
|
cp bin/linux/focalboard-server package/${PACKAGE_FOLDER}/bin
|
2020-12-16 20:20:11 +01:00
|
|
|
cp -R webapp/pack package/${PACKAGE_FOLDER}/pack
|
2021-01-28 19:29:57 +01:00
|
|
|
cp server-config.json package/${PACKAGE_FOLDER}/config.json
|
2021-01-25 21:46:03 +01:00
|
|
|
cp build/MIT-COMPILED-LICENSE.md package/${PACKAGE_FOLDER}
|
2021-05-26 12:34:42 +02:00
|
|
|
cp NOTICE.txt package/${PACKAGE_FOLDER}
|
|
|
|
cp webapp/NOTICE.txt package/${PACKAGE_FOLDER}/webapp-NOTICE.txt
|
|
|
|
mkdir -p dist
|
|
|
|
cd package && tar -czvf ../dist/focalboard-server-linux-amd64.tar.gz ${PACKAGE_FOLDER}
|
|
|
|
rm -rf package
|
|
|
|
|
|
|
|
server-linux-package-docker:
|
|
|
|
rm -rf package
|
|
|
|
mkdir -p package/${PACKAGE_FOLDER}/bin
|
|
|
|
cp bin/linux/focalboard-server package/${PACKAGE_FOLDER}/bin
|
|
|
|
cp -R webapp/pack package/${PACKAGE_FOLDER}/pack
|
|
|
|
cp server-config.json package/${PACKAGE_FOLDER}/config.json
|
|
|
|
cp build/MIT-COMPILED-LICENSE.md package/${PACKAGE_FOLDER}
|
2021-01-26 22:51:38 +01:00
|
|
|
cp NOTICE.txt package/${PACKAGE_FOLDER}
|
2021-01-27 21:03:39 +01:00
|
|
|
cp webapp/NOTICE.txt package/${PACKAGE_FOLDER}/webapp-NOTICE.txt
|
2020-12-16 20:20:11 +01:00
|
|
|
mkdir -p dist
|
2021-01-26 19:48:32 +01:00
|
|
|
cd package && tar -czvf ../dist/focalboard-server-linux-amd64.tar.gz ${PACKAGE_FOLDER}
|
2020-12-16 20:20:11 +01:00
|
|
|
rm -rf package
|
2020-11-03 23:37:29 +01:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
generate: ## Install and run code generators.
|
2020-10-21 09:56:03 +02:00
|
|
|
cd server; go get -modfile=go.tools.mod github.com/golang/mock/mockgen
|
2020-10-18 01:17:17 +02:00
|
|
|
cd server; go generate ./...
|
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-lint: templates-archive ## Run linters on server code.
|
2020-10-21 09:59:02 +02:00
|
|
|
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
|
2021-02-10 19:13:04 +01:00
|
|
|
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
|
|
|
|
exit 1; \
|
2021-07-30 13:32:02 +02:00
|
|
|
fi;
|
2021-06-24 06:58:01 +02:00
|
|
|
cd server; golangci-lint run ./...
|
2021-07-14 15:36:18 +02:00
|
|
|
cd mattermost-plugin; golangci-lint run ./...
|
2020-10-21 09:59:02 +02:00
|
|
|
|
2021-09-22 15:40:04 +02:00
|
|
|
modd-precheck:
|
|
|
|
@if ! [ -x "$$(command -v modd)" ]; then \
|
|
|
|
echo "modd is not installed. Please see https://github.com/cortesi/modd#install for installation instructions"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
|
|
|
|
watch: modd-precheck ## Run both server and webapp watching for changes
|
2022-03-22 15:24:34 +01:00
|
|
|
env FOCALBOARD_BUILD_TAGS='$(BUILD_TAGS)' modd
|
2020-10-21 22:23:01 +02:00
|
|
|
|
2021-09-22 15:40:04 +02:00
|
|
|
watch-single-user: modd-precheck ## Run both server and webapp in single user mode watching for changes
|
2022-03-22 15:24:34 +01:00
|
|
|
env FOCALBOARDSERVER_ARGS=--single-user FOCALBOARD_BUILD_TAGS='$(BUILD_TAGS)' modd
|
2020-10-16 19:20:43 +02:00
|
|
|
|
2021-09-22 15:40:04 +02:00
|
|
|
watch-server-test: modd-precheck ## Run server tests watching for changes
|
2022-03-22 15:24:34 +01:00
|
|
|
env FOCALBOARD_BUILD_TAGS='$(BUILD_TAGS)' modd -f modd-servertest.conf
|
2021-09-22 15:40:04 +02:00
|
|
|
|
2022-01-05 17:37:42 +01:00
|
|
|
server-test: server-test-sqlite server-test-mysql server-test-postgres ## Run server tests
|
2021-12-17 18:30:47 +01:00
|
|
|
|
2022-04-08 13:46:16 +02:00
|
|
|
server-test-sqlite: export FB_UNIT_TESTING=1
|
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-test-sqlite: templates-archive ## Run server tests using sqlite
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
2021-12-17 18:30:47 +01:00
|
|
|
|
2022-04-14 00:36:20 +02:00
|
|
|
server-test-mini-sqlite: export FB_UNIT_TESTING=1
|
|
|
|
|
|
|
|
server-test-mini-sqlite: templates-archive ## Run server tests using sqlite
|
|
|
|
cd server/integrationtests; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
|
|
|
|
2021-12-17 18:30:47 +01:00
|
|
|
server-test-mysql: export FB_UNIT_TESTING=1
|
|
|
|
server-test-mysql: export FB_STORE_TEST_DB_TYPE=mysql
|
|
|
|
server-test-mysql: export FB_STORE_TEST_DOCKER_PORT=44445
|
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-test-mysql: templates-archive ## Run server tests using mysql
|
2021-12-17 18:30:47 +01:00
|
|
|
@echo Starting docker container for mysql
|
2022-03-22 15:24:34 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans
|
2021-12-17 18:30:47 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-mysql.yml run start_dependencies
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
2022-04-20 17:01:40 +02:00
|
|
|
cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
2022-01-25 10:42:56 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-mysql.yml down -v --remove-orphans
|
2021-12-17 18:30:47 +01:00
|
|
|
|
|
|
|
server-test-postgres: export FB_UNIT_TESTING=1
|
|
|
|
server-test-postgres: export FB_STORE_TEST_DB_TYPE=postgres
|
|
|
|
server-test-postgres: export FB_STORE_TEST_DOCKER_PORT=44446
|
|
|
|
|
2022-03-31 00:10:11 +02:00
|
|
|
server-test-postgres: templates-archive ## Run server tests using postgres
|
2021-12-17 18:30:47 +01:00
|
|
|
@echo Starting docker container for postgres
|
2022-03-22 15:24:34 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans
|
2021-12-17 18:30:47 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-postgres.yml run start_dependencies
|
2022-03-22 15:24:34 +01:00
|
|
|
cd server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
2022-04-20 17:01:40 +02:00
|
|
|
cd mattermost-plugin/server; go test -tags '$(BUILD_TAGS)' -race -v -count=1 -timeout=30m ./...
|
2022-01-25 10:42:56 +01:00
|
|
|
docker-compose -f ./docker-testing/docker-compose-postgres.yml down -v --remove-orphans
|
2021-12-17 18:30:47 +01:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
webapp: ## Build webapp.
|
2020-10-29 10:03:48 +01:00
|
|
|
cd webapp; npm run pack
|
|
|
|
|
2022-02-07 16:41:07 +01:00
|
|
|
webapp-test: ## jest tests for webapp
|
|
|
|
cd webapp; npm run test
|
|
|
|
|
2021-09-22 17:08:24 +02:00
|
|
|
watch-plugin: modd-precheck ## Run and upload the plugin to a development server
|
2022-03-22 15:24:34 +01:00
|
|
|
env FOCALBOARD_BUILD_TAGS='$(BUILD_TAGS)' modd -f modd-watchplugin.conf
|
2021-09-22 17:08:24 +02:00
|
|
|
|
2021-10-04 10:06:54 +02:00
|
|
|
live-watch-plugin: modd-precheck ## Run and update locally the plugin in the development server
|
|
|
|
cd mattermost-plugin; make live-watch
|
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
mac-app: server-mac webapp ## Build Mac application.
|
2021-01-25 21:46:03 +01:00
|
|
|
rm -rf mac/temp
|
|
|
|
rm -rf mac/dist
|
2020-10-26 20:45:40 +01:00
|
|
|
rm -rf mac/resources/bin
|
|
|
|
rm -rf mac/resources/pack
|
2020-11-07 19:50:34 +01:00
|
|
|
mkdir -p mac/resources/bin
|
2021-01-28 23:23:52 +01:00
|
|
|
cp bin/mac/focalboard-server mac/resources/bin/focalboard-server
|
2021-01-25 21:46:03 +01:00
|
|
|
cp app-config.json mac/resources/config.json
|
2020-10-26 20:45:40 +01:00
|
|
|
cp -R webapp/pack mac/resources/pack
|
|
|
|
mkdir -p mac/temp
|
2022-04-12 18:20:36 +02:00
|
|
|
xcodebuild archive -workspace mac/Focalboard.xcworkspace -scheme Focalboard -archivePath mac/temp/focalboard.xcarchive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED="NO" CODE_SIGNING_ALLOWED="NO" \
|
|
|
|
|| { echo "xcodebuild failed, did you install the full Xcode and not just the CLI tools?"; exit 1; }
|
2021-01-06 21:32:28 +01:00
|
|
|
mkdir -p mac/dist
|
2021-01-26 19:32:36 +01:00
|
|
|
cp -R mac/temp/focalboard.xcarchive/Products/Applications/Focalboard.app mac/dist/
|
|
|
|
# xcodebuild -exportArchive -archivePath mac/temp/focalboard.xcarchive -exportPath mac/dist -exportOptionsPlist mac/export.plist
|
2021-01-25 21:46:03 +01:00
|
|
|
cp build/MIT-COMPILED-LICENSE.md mac/dist
|
2021-01-26 22:51:38 +01:00
|
|
|
cp NOTICE.txt mac/dist
|
2021-01-27 21:03:39 +01:00
|
|
|
cp webapp/NOTICE.txt mac/dist/webapp-NOTICE.txt
|
|
|
|
cd mac/dist; zip -r focalboard-mac.zip Focalboard.app MIT-COMPILED-LICENSE.md NOTICE.txt webapp-NOTICE.txt
|
2020-10-26 20:45:40 +01:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
win-wpf-app: server-dll webapp ## Build Windows WPF application.
|
2021-06-09 12:03:19 +02:00
|
|
|
cd win-wpf && ./build.bat
|
|
|
|
cd win-wpf && ./package.bat
|
2021-03-23 20:08:30 +01:00
|
|
|
cd win-wpf && ./package-zip.bat
|
2021-03-01 20:36:36 +01:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
linux-app: webapp ## Build Linux application.
|
2020-10-29 10:03:48 +01:00
|
|
|
rm -rf linux/temp
|
2021-01-25 21:46:03 +01:00
|
|
|
rm -rf linux/dist
|
2020-10-29 10:03:48 +01:00
|
|
|
mkdir -p linux/dist
|
2021-01-26 19:48:32 +01:00
|
|
|
mkdir -p linux/temp/focalboard-app
|
|
|
|
cp app-config.json linux/temp/focalboard-app/config.json
|
|
|
|
cp build/MIT-COMPILED-LICENSE.md linux/temp/focalboard-app/
|
2021-01-26 22:51:38 +01:00
|
|
|
cp NOTICE.txt linux/temp/focalboard-app/
|
2021-01-27 21:03:39 +01:00
|
|
|
cp webapp/NOTICE.txt linux/temp/focalboard-app/webapp-NOTICE.txt
|
2021-01-26 19:48:32 +01:00
|
|
|
cp -R webapp/pack linux/temp/focalboard-app/pack
|
2020-10-29 10:03:48 +01:00
|
|
|
cd linux; make build
|
2021-01-26 19:48:32 +01:00
|
|
|
cp -R linux/bin/focalboard-app linux/temp/focalboard-app/
|
|
|
|
cd linux/temp; tar -zcf ../dist/focalboard-linux.tar.gz focalboard-app
|
2020-10-29 10:03:48 +01:00
|
|
|
rm -rf linux/temp
|
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
swagger: ## Generate swagger API spec and clients based on it.
|
2021-02-17 20:29:20 +01:00
|
|
|
mkdir -p server/swagger/docs
|
|
|
|
mkdir -p server/swagger/clients
|
|
|
|
cd server && swagger generate spec -m -o ./swagger/swagger.yml
|
|
|
|
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g html2 -o docs/html
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g go -o clients/go
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g javascript -o clients/javascript
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g typescript-fetch -o clients/typescript
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g swift5 -o clients/swift
|
|
|
|
cd server/swagger && openapi-generator generate -i swagger.yml -g python -o clients/python
|
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
clean: ## Clean build artifacts.
|
2020-10-08 18:21:27 +02:00
|
|
|
rm -rf bin
|
|
|
|
rm -rf dist
|
2020-10-20 20:48:22 +02:00
|
|
|
rm -rf webapp/pack
|
2020-10-26 20:45:40 +01:00
|
|
|
rm -rf mac/temp
|
|
|
|
rm -rf mac/dist
|
2020-11-07 19:50:34 +01:00
|
|
|
rm -rf linux/dist
|
2021-03-05 02:08:05 +01:00
|
|
|
rm -rf win-wpf/msix
|
2021-07-29 20:08:39 +02:00
|
|
|
rm -f win-wpf/focalboard.msix
|
2020-10-08 18:21:27 +02:00
|
|
|
|
2021-07-30 13:32:02 +02:00
|
|
|
cleanall: clean ## Clean all build artifacts and dependencies.
|
2020-10-20 20:48:22 +02:00
|
|
|
rm -rf webapp/node_modules
|
2021-07-30 13:32:02 +02:00
|
|
|
|
|
|
|
## Help documentatin à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
|
|
|
help:
|
|
|
|
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|