1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/beyondstorage-beyond-tp

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Makefile 2.8 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Xuanwo Отправлено 13.08.2021 09:07 b83c731
SHELL := /bin/bash
GO_BUILD_OPTION := -trimpath
.PHONY: check format vet lint build test
help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " check to format code and vet check"
@echo " build to create bin directory and build beyondtp"
@echo " build-frontend to build flutter web and copy to api/ui directory"
@echo " generate to generate code"
@echo " test to run unit tests"
@echo " tidy to tidy and check the go mod files"
check: format vet
format:
@echo "go fmt"
@go fmt ./...
@echo "ok"
generate:
@echo "generate code"
@go generate ./...
@echo "ok"
vet:
@echo "go vet"
@go vet ./...
@echo "ok"
build-frontend:
@echo "build frontend"
cd ./ui && flutter build web --release
cp -r ui/build/web/* api/ui
@echo "ok"
# We remove check target to work around build failed in container build.
# If we build in container, we will meet errors like:
#
# > go fmt
# > go: not formatting packages in dependency modules
# > package github.com/google/flatbuffers/grpc/tests: C++ source files not allowed when not using cgo or SWIG: grpctest.cpp message_builder_test.cpp
# > package github.com/google/flatbuffers/samples: C++ source files not allowed when not using cgo or SWIG: sample_bfbs.cpp sample_binary.cpp sample_text.cpp
# > package github.com/google/flatbuffers/tests: C++ source files not allowed when not using cgo or SWIG: monster_test.grpc.fb.cc native_type_test_impl.cpp test.cpp test_assert.cpp test_builder.cpp
# > make: *** [Makefile:19: format] Error 1
build: tidy build-frontend
@echo "build beyondtp"
CGO_ENABLED=1 go build ${GO_BUILD_OPTION} -race -o ./bin/beyondtp ./cmd/beyondtp
@echo "ok"
release: generate tidy check build-frontend
@echo "release beyondtp"
@-rm ./releases/*
@mkdir -p ./releases
@echo "build for linux amd64"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${GO_BUILD_OPTION} -o ./bin/linux-amd64/beyondtp ./cmd/beyondtp
tar -C ./bin/linux-amd64/ -czf ./releases/beyondtp_linux_amd64.tar.gz beyondtp
@echo "build for macos amd64"
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${GO_BUILD_OPTION} -o ./bin/darwin-amd64/beyondtp ./cmd/beyondtp
tar -C ./bin/darwin-amd64/ -czf ./releases/beyondtp_darwin_amd64.tar.gz beyondtp
@echo "build for macos arm64"
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build ${GO_BUILD_OPTION} -o ./bin/darwin-arm64/beyondtp ./cmd/beyondtp
tar -C ./bin/darwin-arm64/ -czf ./releases/beyondtp_darwin_arm64.tar.gz beyondtp
@echo "build for windows amd64"
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ${GO_BUILD_OPTION} -o ./bin/windows-amd64/beyondtp ./cmd/beyondtp
tar -C ./bin/windows-amd64/ -czf ./releases/beyondtp_windows_amd64.tar.gz beyondtp
test:
@echo "run test"
@go test -race -v -count=1 ./...
@echo "ok"
tidy:
@echo "Tidy and check the go mod files"
@go mod tidy
@go mod verify
@echo "Done"

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/beyondstorage-beyond-tp.git
git@api.gitlife.ru:oschina-mirror/beyondstorage-beyond-tp.git
oschina-mirror
beyondstorage-beyond-tp
beyondstorage-beyond-tp
master