focalboard/Makefile

165 lines
6.3 KiB
Makefile
Raw Normal View History

2021-01-20 18:55:36 +01:00
.PHONY: prebuild clean cleanall ci server server-mac server-linux server-win server-linux-package generate watch-server webapp mac-app win-app linux-app
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
endif
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
all: server
2020-10-08 18:21:27 +02:00
prebuild:
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
server:
2021-01-26 23:13:46 +01:00
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=dev")
2021-01-19 23:10:14 +01:00
cd server; go build -ldflags '$(LDFLAGS)' -o ../bin/octoserver ./main
2020-10-08 18:21:27 +02:00
2020-11-07 19:50:34 +01:00
server-mac:
mkdir -p bin/mac
2021-01-26 23:13:46 +01:00
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=mac")
2021-01-19 23:10:14 +01:00
cd server; env GOOS=darwin GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/mac/octoserver ./main
2020-11-07 19:50:34 +01:00
server-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")
2021-01-19 23:10:14 +01:00
cd server; env GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/linux/octoserver ./main
2020-11-07 19:50:34 +01:00
server-win:
2021-01-26 23:13:46 +01:00
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=win")
2021-01-19 23:10:14 +01:00
cd server; env GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/win/octoserver.exe ./main
2020-11-03 23:37:29 +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-06 19:12:32 +01:00
cp bin/linux/octoserver 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-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
2020-12-04 16:03:09 +01:00
server-single-user:
2021-01-26 23:13:46 +01:00
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=dev")
2021-01-19 23:10:14 +01:00
cd server; go build -ldflags '$(LDFLAGS)' -o ../bin/octoserver ./main --single-user
2020-12-04 16:03:09 +01:00
server-mac-single-user:
mkdir -p bin/mac
2021-01-26 23:13:46 +01:00
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=mac")
2021-01-19 23:10:14 +01:00
cd server; env GOOS=darwin GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/mac/octoserver ./main --single-user
2020-12-04 16:03:09 +01:00
server-linux-single-user:
mkdir -p bin/linux
2021-01-26 23:13:46 +01:00
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=linux")
2021-01-19 23:10:14 +01:00
cd server; env GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/linux/octoserver ./main --single-user
2020-12-04 16:03:09 +01:00
server-win-single-user:
2021-01-26 23:13:46 +01:00
$(eval LDFLAGS += -X "github.com/mattermost/focalboard/server/model.Edition=win")
2021-01-19 23:10:14 +01:00
cd server; env GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/octoserver.exe ./main --single-user
2020-12-04 16:03:09 +01:00
generate:
cd server; go get -modfile=go.tools.mod github.com/golang/mock/mockgen
cd server; go get -modfile=go.tools.mod github.com/jteeuwen/go-bindata
cd server; go generate ./...
2020-10-21 09:59:02 +02:00
server-lint:
@if ! [ -x "$$(command -v golangci-lint)" ]; then \
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
exit 1; \
fi; \
cd server; golangci-lint run -p format -p unused -p complexity -p bugs -p performance -E asciicheck -E depguard -E dogsled -E dupl -E funlen -E gochecknoglobals -E gochecknoinits -E goconst -E gocritic -E godot -E godox -E goerr113 -E goheader -E golint -E gomnd -E gomodguard -E goprintffuncname -E gosimple -E interfacer -E lll -E misspell -E nlreturn -E nolintlint -E stylecheck -E unconvert -E whitespace -E wsl --skip-dirs services/store/sqlstore/migrations/ ./...
2020-10-21 09:59:02 +02:00
server-test:
2021-01-06 22:52:25 +01:00
cd server; go test -v ./...
server-doc:
cd server; go doc ./...
2020-10-16 19:20:43 +02:00
watch-server:
cd server; modd
2020-12-04 16:03:09 +01:00
watch-server-single-user:
cd server; env OCTOSERVER_ARGS=--single-user modd
2020-10-29 10:03:48 +01:00
webapp:
cd webapp; npm run pack
2020-11-07 19:50:34 +01:00
mac-app: server-mac webapp
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
cp bin/mac/octoserver mac/resources/bin/octoserver
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
2021-01-26 19:32:36 +01: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"
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
2020-11-07 19:50:34 +01:00
win-app: server-win webapp
2021-01-25 21:46:03 +01:00
rm -rf win/temp
rm -rf win/dist
2020-11-03 23:37:29 +01:00
cd win; make build
2021-01-21 00:23:33 +01:00
mkdir -p win/temp
2021-01-25 21:46:03 +01:00
cp bin/win/octoserver.exe win/temp
cp app-config.json win/temp/config.json
cp build/MIT-COMPILED-LICENSE.md win/temp
2021-01-26 22:51:38 +01:00
cp NOTICE.txt win/temp
2021-01-27 21:03:39 +01:00
cp webapp/NOTICE.txt win/temp/webapp-NOTICE.txt
2021-01-20 23:09:41 +01:00
cp -R webapp/pack win/temp/pack
2021-01-06 23:50:37 +01:00
mkdir -p win/dist
2021-01-26 19:33:42 +01:00
# cd win/temp; tar -acf ../dist/focalboard-win.zip .
cd win/temp; powershell "Compress-Archive * ../dist/focalboard-win.zip"
2020-11-03 23:37:29 +01:00
2020-10-29 10:03:48 +01:00
linux-app: server-linux webapp
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 bin/linux/octoserver 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
2020-10-08 18:21:27 +02:00
clean:
rm -rf bin
rm -rf dist
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
rm -rf win/dist
2020-10-08 18:21:27 +02:00
cleanall: clean
rm -rf webapp/node_modules