parent
2e99b509d5
commit
15e6c2a987
@ -0,0 +1,196 @@
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for common tasks
|
||||
#
|
||||
|
||||
SHELL := /bin/bash
|
||||
GO:=go
|
||||
DIRS=$(shell ls)
|
||||
DEBUG ?= 0
|
||||
GIT_TAG := $(shell git describe --exact-match --tags --abbrev=0 2> /dev/null || echo untagged)
|
||||
GIT_COMMIT ?= $(shell git rev-parse --short HEAD || echo "0.0.0")
|
||||
BUILD_DATE ?=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') # Blank error: date '+%FT %T %z':"buildDate":"2023-03-31T 20:05:43 +0800"
|
||||
|
||||
# include the common makefile
|
||||
COMMON_SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
||||
|
||||
# ROOT_DIR: root directory of the code base
|
||||
ifeq ($(origin ROOT_DIR),undefined)
|
||||
ROOT_DIR := $(abspath $(shell cd $(COMMON_SELF_DIR)/../.. && pwd -P))
|
||||
endif
|
||||
|
||||
# OUTPUT_DIR: The directory where the build output is stored.
|
||||
ifeq ($(origin OUTPUT_DIR),undefined)
|
||||
OUTPUT_DIR := $(ROOT_DIR)/_output
|
||||
$(shell mkdir -p $(OUTPUT_DIR))
|
||||
endif
|
||||
|
||||
# BIN_DIR: Directory where executable files are stored.
|
||||
ifeq ($(origin BIN_DIR),undefined)
|
||||
BIN_DIR := $(OUTPUT_DIR)/bin
|
||||
$(shell mkdir -p $(BIN_DIR))
|
||||
endif
|
||||
|
||||
# BIN_TOOLS_DIR: Directory where executable files are stored.
|
||||
ifeq ($(origin BIN_TOOLS_DIR),undefined)
|
||||
BIN_TOOLS_DIR := $(BIN_DIR)/tools
|
||||
$(shell mkdir -p $(BIN_TOOLS_DIR))
|
||||
endif
|
||||
|
||||
# LOGS_DIR: Directory where log files are stored.
|
||||
ifeq ($(origin LOGS_DIR),undefined)
|
||||
LOGS_DIR := $(OUTPUT_DIR)/logs
|
||||
$(shell mkdir -p $(LOGS_DIR))
|
||||
endif
|
||||
|
||||
# TOOLS_DIR: The directory where tools are stored for build and testing.
|
||||
ifeq ($(origin TOOLS_DIR),undefined)
|
||||
TOOLS_DIR := $(OUTPUT_DIR)/tools
|
||||
$(shell mkdir -p $(TOOLS_DIR))
|
||||
endif
|
||||
|
||||
# TMP_DIR: directory where temporary files are stored.
|
||||
ifeq ($(origin TMP_DIR),undefined)
|
||||
TMP_DIR := $(OUTPUT_DIR)/tmp
|
||||
$(shell mkdir -p $(TMP_DIR))
|
||||
endif
|
||||
|
||||
ifeq ($(origin VERSION), undefined)
|
||||
# VERSION := $(shell git describe --tags --always --match='v*')
|
||||
# git describe --tags --always --match="v*" --dirty
|
||||
# VERSION := $(shell git describe --tags --always --match="v*" --dirty | sed 's/-/./g') #v2.3.3.631.g00abdc9b.dirty
|
||||
VERSION := $(shell git describe --tags --always --match='v*')
|
||||
# v2.3.3: git tag
|
||||
endif
|
||||
|
||||
# Helper function to get dependency version from go.mod
|
||||
get_gomod_version = $(shell go list -m $1 | awk '{print $$2}')
|
||||
define go_install
|
||||
$(info ===========> Installing $(1)@$(2))
|
||||
$(GO) install $(1)@$(2)
|
||||
endef
|
||||
|
||||
# Check if the tree is dirty. default to dirty(maybe u should commit?)
|
||||
GIT_TREE_STATE:="dirty"
|
||||
ifeq (, $(shell git status --porcelain 2>/dev/null))
|
||||
GIT_TREE_STATE="clean"
|
||||
endif
|
||||
GIT_COMMIT:=$(shell git rev-parse HEAD)
|
||||
|
||||
# Minimum test coverage
|
||||
# can u use make cover COVERAGE=90
|
||||
ifeq ($(origin COVERAGE),undefined)
|
||||
COVERAGE := 60
|
||||
endif
|
||||
|
||||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
|
||||
ifeq (,$(shell go env GOBIN))
|
||||
GOBIN=$(shell go env GOPATH)/bin
|
||||
else
|
||||
GOBIN=$(shell go env GOBIN)
|
||||
endif
|
||||
|
||||
# The OS must be linux when building docker images
|
||||
# PLATFORMS ?= linux_amd64 linux_arm64
|
||||
# The OS can be linux/windows/darwin when building binaries
|
||||
PLATFORMS ?= linux_s390x linux_mips64 linux_mips64le darwin_amd64 darwin_arm64 windows_amd64 linux_amd64 linux_arm64 linux_ppc64le # wasip1_wasm
|
||||
|
||||
# set a specific PLATFORM, defaults to the host platform
|
||||
ifeq ($(origin PLATFORM), undefined)
|
||||
ifeq ($(origin GOARCH), undefined)
|
||||
GOARCH := $(shell go env GOARCH)
|
||||
endif
|
||||
# Determine the host OS
|
||||
GOOS := $(shell go env GOOS)
|
||||
PLATFORM := $(GOOS)_$(GOARCH)
|
||||
# Use the host OS and GOARCH as the default when building images
|
||||
IMAGE_PLAT := $(PLATFORM)
|
||||
else
|
||||
# Parse the PLATFORM variable
|
||||
GOOS := $(word 1, $(subst _, ,$(PLATFORM)))
|
||||
GOARCH := $(word 2, $(subst _, ,$(PLATFORM)))
|
||||
IMAGE_PLAT := $(PLATFORM)
|
||||
endif
|
||||
|
||||
|
||||
# Protobuf file storage path
|
||||
APIROOT=$(ROOT_DIR)/pkg/proto
|
||||
|
||||
# Linux command settings
|
||||
# TODO: Whether you need to join utils?
|
||||
FIND := find . ! -path './utils/*' ! -path './vendor/*' ! -path './third_party/*' ! -path './components/*' ! -path './logs/*'
|
||||
XARGS := xargs -r --no-run-if-empty
|
||||
|
||||
# Linux command settings-CODE DIRS Copyright
|
||||
CODE_DIRS := $(ROOT_DIR)/pkg $(ROOT_DIR)/cmd $(ROOT_DIR)/config $(ROOT_DIR)/internal $(ROOT_DIR)/scripts $(ROOT_DIR)/test $(ROOT_DIR)/.github $(ROOT_DIR)/build $(ROOT_DIR)/tools $(ROOT_DIR)/deployments
|
||||
FINDS := find $(CODE_DIRS)
|
||||
|
||||
# Makefile settings: Select different behaviors by determining whether V option is set
|
||||
ifndef V
|
||||
MAKEFLAGS += --no-print-directory
|
||||
endif
|
||||
|
||||
# COMMA: Concatenate multiple strings to form a list of strings
|
||||
COMMA := ,
|
||||
# SPACE: Used to separate strings
|
||||
SPACE :=
|
||||
# SPACE: Replace multiple consecutive Spaces with a single space
|
||||
SPACE +=
|
||||
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for common tasks
|
||||
|
||||
# Help information for the makefile package
|
||||
define makehelp
|
||||
@printf "\n\033[1mUsage: make <TARGETS> <OPTIONS> ...\033[0m\n\n\\033[1mTargets:\\033[0m\n\n"
|
||||
@sed -n 's/^##//p' $< | awk -F':' '{printf "\033[36m%-28s\033[0m %s\n", $$1, $$2}' | sed -e 's/^/ /'
|
||||
@printf "\n\033[1m$$USAGE_OPTIONS\033[0m\n"
|
||||
endef
|
||||
|
||||
# Here are some examples of builds
|
||||
define MAKEFILE_EXAMPLE
|
||||
# make build BINS=openim-api Only a single openim-api binary is built.
|
||||
# make -j (nproc) all Run tidy gen add-copyright format lint cover build concurrently.
|
||||
# make gen Generate all necessary files.
|
||||
# make release Build release binaries for all platforms.
|
||||
# make verify-copyright Verify the license headers for all files.
|
||||
# make install-deepcopy-gen Install deepcopy-gen tools if the license is missing.
|
||||
# make build BINS=openim-api V=1 DEBUG=1 Build debug binaries for only openim-api.
|
||||
# make multiarch -j PLATFORMS="linux_arm64 linux_amd64" V=1 Build binaries for both platforms.
|
||||
# make image
|
||||
endef
|
||||
export MAKEFILE_EXAMPLE
|
||||
|
||||
# Define all help functions @printf "\n\033[1mCurrent openim-api version information: $(shell openim-api version):\033[0m\n\n"
|
||||
define makeallhelp
|
||||
@printf "\n\033[1mMake example:\033[0m\n\n"
|
||||
$(call MAKEFILE_EXAMPLE)
|
||||
@printf "\n\033[1mAriables:\033[0m\n\n"
|
||||
@echo " DEBUG: $(DEBUG)"
|
||||
@echo " BINS: $(BINS)"
|
||||
@echo " PLATFORMS: $(PLATFORMS)"
|
||||
@echo " V: $(V)"
|
||||
endef
|
||||
|
||||
# Help information for other makefile packages
|
||||
CUT_OFF?="---------------------------------------------------------------------------------"
|
||||
HELP_NAME:=$(shell basename $(MAKEFILE_LIST))
|
||||
define smallhelp
|
||||
@sed -n 's/^##//p' $< | awk -F':' '{printf "\033[36m%-35s\033[0m %s\n", $$1, $$2}' | sed -e 's/^/ /'
|
||||
@echo $(CUT_OFF)
|
||||
endef
|
@ -0,0 +1,63 @@
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# ==============================================================================
|
||||
# wget https://github.com/google/addlicense/releases/download/v1.0.0/addlicense_1.0.0_Linux_x86_64.tar.gz
|
||||
# Makefile helper functions for copyright
|
||||
#
|
||||
|
||||
LICENSE_TEMPLATE ?= $(ROOT_DIR)/scripts/template/LICENSE_TEMPLATES
|
||||
|
||||
## copyright.verify: Validate boilerplate headers for assign files
|
||||
.PHONY: copyright.verify
|
||||
copyright.verify: tools.verify.addlicense
|
||||
@echo "===========> Validate boilerplate headers for assign files starting in the $(ROOT_DIR) directory"
|
||||
@$(TOOLS_DIR)/addlicense -v -check -ignore **/test/** -ignore **pb** -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
|
||||
@echo "===========> End of boilerplate headers check..."
|
||||
|
||||
## copyright.add: Add the boilerplate headers for all files
|
||||
.PHONY: copyright.add
|
||||
copyright.add: tools.verify.addlicense
|
||||
@echo "===========> Adding $(LICENSE_TEMPLATE) the boilerplate headers for all files"
|
||||
@$(TOOLS_DIR)/addlicense -y $(shell date +"%Y") -ignore **pb** -v -c "OpenIM." -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
|
||||
@echo "===========> End the copyright is added..."
|
||||
|
||||
# Addlicense Flags:
|
||||
# -c string
|
||||
# copyright holder (default "Google LLC")
|
||||
# -check
|
||||
# check only mode: verify presence of license headers and exit with non-zero code if missing
|
||||
# -f string
|
||||
# license file
|
||||
# -ignore value
|
||||
# file patterns to ignore, for example: -ignore **/*.go -ignore vendor/**
|
||||
# -l string
|
||||
# license type: apache, bsd, mit, mpl (default "apache")
|
||||
# -s Include SPDX identifier in license header. Set -s=only to only include SPDX identifier.
|
||||
# -skip value
|
||||
# [deprecated: see -ignore] file extensions to skip, for example: -skip rb -skip go
|
||||
# -v verbose mode: print the name of the files that are modified or were skipped
|
||||
# -y string
|
||||
# copyright year(s) (default "2023")
|
||||
|
||||
## copyright.advertise: Advertise the license of the project
|
||||
.PHONY: copyright.advertise
|
||||
copyright.advertise:
|
||||
@chmod +x $(ROOT_DIR)/scripts/advertise.sh
|
||||
@$(ROOT_DIR)/scripts/advertise.sh
|
||||
|
||||
## copyright.help: Show copyright help
|
||||
.PHONY: copyright.help
|
||||
copyright.help: scripts/make-rules/copyright.mk
|
||||
$(call smallhelp)
|
@ -0,0 +1,41 @@
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for dependencies
|
||||
#
|
||||
|
||||
.PHONY: dependencies.run
|
||||
dependencies.run: dependencies.packages dependencies.tools
|
||||
|
||||
.PHONY: dependencies.packages
|
||||
dependencies.packages:
|
||||
@$(GO) mod tidy
|
||||
|
||||
.PHONY: dependencies.tools
|
||||
dependencies.tools: dependencies.tools.blocker dependencies.tools.critical
|
||||
|
||||
.PHONY: dependencies.tools.blocker
|
||||
dependencies.tools.blocker: go.build.verify $(addprefix tools.verify., $(BLOCKER_TOOLS))
|
||||
|
||||
.PHONY: dependencies.tools.critical
|
||||
dependencies.tools.critical: $(addprefix tools.verify., $(CRITICAL_TOOLS))
|
||||
|
||||
.PHONY: dependencies.tools.trivial
|
||||
dependencies.tools.trivial: $(addprefix tools.verify., $(TRIVIAL_TOOLS))
|
||||
|
||||
## dependencies.help: Print help for dependencies targets
|
||||
.PHONY: dependencies.help
|
||||
dependencies.help: scripts/make-rules/dependencies.mk
|
||||
$(call smallhelp)
|
@ -0,0 +1,100 @@
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for generate necessary files and docs
|
||||
# https://cloud.redhat.com/blog/kubernetes-deep-dive-code-generation-customresources
|
||||
# ! The stock of code generated by `make gen` should be idempotent
|
||||
#
|
||||
# Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for generate necessary files
|
||||
#
|
||||
|
||||
## gen.init: Initialize openim server project ✨
|
||||
.PHONY: gen.init
|
||||
gen.init:
|
||||
@echo "===========> Initializing openim server project"
|
||||
@${ROOT_DIR}/scripts/init-config.sh
|
||||
|
||||
## gen.init-githooks: Initialize git hooks ✨
|
||||
.PHONY: gen.init-githooks
|
||||
gen.init-githooks:
|
||||
@echo "===========> Initializing git hooks"
|
||||
@${ROOT_DIR}/scripts/init-githooks.sh
|
||||
|
||||
## gen.run: Generate necessary files and docs ✨
|
||||
.PHONY: gen.run
|
||||
#gen.run: gen.errcode gen.docgo
|
||||
gen.run: gen.clean gen.errcode gen.docgo.doc
|
||||
|
||||
## gen.errcode: Generate necessary files and docs ✨
|
||||
.PHONY: gen.errcode
|
||||
gen.errcode: gen.errcode.code gen.errcode.doc
|
||||
|
||||
## gen.errcode.code: Generate openim error code go source files ✨
|
||||
.PHONY: gen.errcode.code
|
||||
gen.errcode.code: tools.verify.codegen
|
||||
@echo "===========> Generating openim error code go source files"
|
||||
@codegen -type=int ${ROOT_DIR}/internal/pkg/code
|
||||
|
||||
## gen.errcode.doc: Generate openim error code markdown documentation ✨
|
||||
.PHONY: gen.errcode.doc
|
||||
gen.errcode.doc: tools.verify.codegen
|
||||
@echo "===========> Generating error code markdown documentation"
|
||||
@codegen -type=int -doc \
|
||||
-output ${ROOT_DIR}/docs/guide/zh-CN/api/error_code_generated.md ${ROOT_DIR}/internal/pkg/code
|
||||
|
||||
## gen.docgo: Generate missing doc.go for go packages ✨
|
||||
.PHONY: gen.ca.%
|
||||
gen.ca.%:
|
||||
$(eval CA := $(word 1,$(subst ., ,$*)))
|
||||
@echo "===========> Generating CA files for $(CA)"
|
||||
@${ROOT_DIR}/scripts/gencerts.sh generate-openim-cert $(OUTPUT_DIR)/cert $(CA)
|
||||
|
||||
## gen.ca: Generate CA files for all certificates ✨
|
||||
.PHONY: gen.ca
|
||||
gen.ca: $(addprefix gen.ca., $(CERTIFICATES))
|
||||
|
||||
## gen.docgo: Generate missing doc.go for go packages ✨
|
||||
.PHONY: gen.docgo.doc
|
||||
gen.docgo.doc:
|
||||
@echo "===========> Generating missing doc.go for go packages"
|
||||
@${ROOT_DIR}/scripts/gendoc.sh
|
||||
|
||||
## gen.docgo.check: Check if there are untracked doc.go files ✨
|
||||
.PHONY: gen.docgo.check
|
||||
gen.docgo.check: gen.docgo.doc
|
||||
@n="$$(git ls-files --others '*/doc.go' | wc -l)"; \
|
||||
if test "$$n" -gt 0; then \
|
||||
git ls-files --others '*/doc.go' | sed -e 's/^/ /'; \
|
||||
echo "$@: untracked doc.go file(s) exist in working directory" >&2 ; \
|
||||
false ; \
|
||||
fi
|
||||
|
||||
## gen.docgo.add: Add untracked doc.go files to git index ✨
|
||||
.PHONY: gen.docgo.add
|
||||
gen.docgo.add:
|
||||
@git ls-files --others '*/doc.go' | $(XARGS) -- git add
|
||||
|
||||
## gen.docgo: Generate missing doc.go for go packages ✨
|
||||
.PHONY: gen.clean
|
||||
gen.clean:
|
||||
@rm -rf ./api/client/{clientset,informers,listers}
|
||||
@$(FIND) -type f -name '*_generated.go' -delete
|
||||
|
||||
## gen.help: show help for gen
|
||||
.PHONY: gen.help
|
||||
gen.help: scripts/make-rules/gen.m
|
||||
$(call smallhelp)
|
@ -0,0 +1,183 @@
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for docker image
|
||||
# ==============================================================================
|
||||
# Path: scripts/make-rules/image.mk
|
||||
# docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/<image-name>:<tag>
|
||||
# https://docs.docker.com/build/building/multi-platform/
|
||||
#
|
||||
|
||||
DOCKER := docker
|
||||
|
||||
# read: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md
|
||||
REGISTRY_PREFIX ?= registry.cn-hangzhou.aliyuncs.com/openimsdk
|
||||
# REGISTRY_PREFIX ?= ghcr.io/openimsdk
|
||||
|
||||
BASE_IMAGE ?= ghcr.io/openim-sigs/openim-bash-image
|
||||
|
||||
IMAGE_PLAT ?= $(subst $(SPACE),$(COMMA),$(subst _,/,$(PLATFORMS)))
|
||||
|
||||
EXTRA_ARGS ?= --no-cache
|
||||
_DOCKER_BUILD_EXTRA_ARGS :=
|
||||
|
||||
ifdef HTTP_PROXY
|
||||
_DOCKER_BUILD_EXTRA_ARGS += --build-arg HTTP_PROXY=${HTTP_PROXY}
|
||||
endif
|
||||
|
||||
ifneq ($(EXTRA_ARGS), )
|
||||
_DOCKER_BUILD_EXTRA_ARGS += $(EXTRA_ARGS)
|
||||
endif
|
||||
|
||||
# Determine image files by looking into build/images/*/Dockerfile
|
||||
IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/images/*)
|
||||
# Determine images names by stripping out the dir names, and filter out the undesired directories
|
||||
# IMAGES ?= $(filter-out Dockerfile,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
||||
IMAGES ?= $(filter-out Dockerfile openim-tools openim-rpc-extend-msg openim-rpc-encryption openim-cmdutils,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
||||
# IMAGES ?= $(filter-out Dockerfile openim-tools openim-cmdutils,$(foreach image,${IMAGES_DIR},$(notdir ${image}))) # !pro
|
||||
|
||||
ifeq (${IMAGES},)
|
||||
$(error Could not determine IMAGES, set ROOT_DIR or run in source dir)
|
||||
endif
|
||||
|
||||
# ==============================================================================
|
||||
# Image targets
|
||||
# ==============================================================================
|
||||
|
||||
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
|
||||
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
|
||||
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
|
||||
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
|
||||
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
|
||||
# To properly provided solutions that supports more than one platform you should use this option.
|
||||
## image.docker-buildx: Build and push docker image for the manager for cross-platform support
|
||||
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
|
||||
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
|
||||
.PHONY: image.docker-buildx
|
||||
image.docker-buildx:
|
||||
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
|
||||
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
|
||||
$(CONTAINER_TOOL) buildx use project-v3-builder
|
||||
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMAGES} -f Dockerfile.cross .
|
||||
- $(CONTAINER_TOOL) buildx rm project-v3-builder
|
||||
rm Dockerfile.cross
|
||||
|
||||
## image.verify: Verify docker version
|
||||
.PHONY: image.verify
|
||||
image.verify:
|
||||
@$(ROOT_DIR)/scripts/lib/util.sh openim::util::check_docker_and_compose_versions
|
||||
|
||||
## image.daemon.verify: Verify docker daemon experimental features
|
||||
.PHONY: image.daemon.verify
|
||||
image.daemon.verify:
|
||||
@$(ROOT_DIR)/scripts/lib/util.sh openim::util::ensure_docker_daemon_connectivity
|
||||
@$(ROOT_DIR)/scripts/lib/util.sh openim::util::ensure-docker-buildx
|
||||
|
||||
# If you wish built the manager image targeting other platforms you can use the --platform flag.
|
||||
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
|
||||
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
|
||||
## image.build: Build docker images
|
||||
.PHONY: image.build
|
||||
image.build: image.verify $(addprefix image.build., $(addprefix $(PLATFORM)., $(IMAGES)))
|
||||
|
||||
.PHONY: image.build.multiarch
|
||||
image.build.multiarch: image.verify $(foreach p,$(PLATFORMS),$(addprefix image.build., $(addprefix $(p)., $(IMAGES))))
|
||||
|
||||
## image.build.%: Build docker image for a specific platform
|
||||
.PHONY: image.build.%
|
||||
image.build.%: go.build.%
|
||||
$(eval IMAGE := $(COMMAND))
|
||||
$(eval IMAGE_PLAT := $(subst _,/,$(PLATFORM)))
|
||||
$(eval ARCH := $(word 2,$(subst _, ,$(PLATFORM))))
|
||||
@echo "===========> Building docker image $(IMAGE) $(VERSION) for $(IMAGE_PLAT)"
|
||||
@mkdir -p $(TMP_DIR)/$(IMAGE)/$(PLATFORM)
|
||||
@cat $(ROOT_DIR)/build/images/Dockerfile\
|
||||
| sed "s#BASE_IMAGE#$(BASE_IMAGE)#g" \
|
||||
| sed "s#BINARY_NAME#$(IMAGE)#g" >$(TMP_DIR)/$(IMAGE)/Dockerfile
|
||||
@cp $(BIN_DIR)/platforms/$(IMAGE_PLAT)/$(IMAGE) $(TMP_DIR)/$(IMAGE)
|
||||
$(eval BUILD_SUFFIX := $(_DOCKER_BUILD_EXTRA_ARGS) --pull -t $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) $(TMP_DIR)/$(IMAGE))
|
||||
@echo $(DOCKER) build --platform $(IMAGE_PLAT) $(BUILD_SUFFIX)
|
||||
@if [ $(shell $(GO) env GOARCH) != $(ARCH) ] ; then \
|
||||
$(MAKE) image.daemon.verify ;\
|
||||
$(DOCKER) build --platform $(IMAGE_PLAT) $(BUILD_SUFFIX) ; \
|
||||
else \
|
||||
$(DOCKER) build $(BUILD_SUFFIX) ; \
|
||||
fi
|
||||
@rm -rf $(TMP_DIR)/$(IMAGE)
|
||||
|
||||
# https://docs.docker.com/build/building/multi-platform/
|
||||
# busybox image supports amd64, arm32v5, arm32v6, arm32v7, arm64v8, i386, ppc64le, and s390x
|
||||
## image.buildx.%: Build docker images with buildx
|
||||
.PHONY: image.buildx.%
|
||||
image.buildx.%:
|
||||
$(eval IMAGE := $(word 1,$(subst ., ,$*)))
|
||||
echo "===========> Building docker image $(IMAGE) $(VERSION)"
|
||||
$(DOCKER) buildx build -f $(ROOT_DIR)/Dockerfile --pull --no-cache --platform=$(PLATFORMS) --push . -t $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION)
|
||||
|
||||
## image.push: Push docker images
|
||||
.PHONY: image.push
|
||||
image.push: image.verify go.build.verify $(addprefix image.push., $(addprefix $(IMAGE_PLAT)., $(IMAGES)))
|
||||
|
||||
## image.push.multiarch: Push docker images for all platforms
|
||||
.PHONY: image.push.multiarch
|
||||
image.push.multiarch: image.verify go.build.verify $(foreach p,$(PLATFORMS),$(addprefix image.push., $(addprefix $(p)., $(IMAGES))))
|
||||
|
||||
## image.push.%: Push docker image for a specific platform
|
||||
.PHONY: image.push.%
|
||||
image.push.%: image.build.%
|
||||
@echo "===========> Pushing image $(IMAGE) $(VERSION) to $(REGISTRY_PREFIX)"
|
||||
$(DOCKER) push $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION)
|
||||
|
||||
## image.manifest.push: Push manifest list for multi-arch images
|
||||
.PHONY: image.manifest.push
|
||||
image.manifest.push: export DOCKER_CLI_EXPERIMENTAL := enabled
|
||||
image.manifest.push: image.verify go.build.verify \
|
||||
$(addprefix image.manifest.push., $(addprefix $(IMAGE_PLAT)., $(IMAGES)))
|
||||
|
||||
## image.manifest.push.%: Push manifest list for multi-arch images for a specific platform
|
||||
.PHONY: image.manifest.push.%
|
||||
image.manifest.push.%: image.push.% image.manifest.remove.%
|
||||
@echo "===========> Pushing manifest $(IMAGE) $(VERSION) to $(REGISTRY_PREFIX) and then remove the local manifest list"
|
||||
@$(DOCKER) manifest create $(REGISTRY_PREFIX)/$(IMAGE):$(VERSION) \
|
||||
$(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION)
|
||||
@$(DOCKER) manifest annotate $(REGISTRY_PREFIX)/$(IMAGE):$(VERSION) \
|
||||
$(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) \
|
||||
--os $(OS) --arch ${ARCH}
|
||||
@$(DOCKER) manifest push --purge $(REGISTRY_PREFIX)/$(IMAGE):$(VERSION)
|
||||
|
||||
# Docker cli has a bug: https://github.com/docker/cli/issues/954
|
||||
# If you find your manifests were not updated,
|
||||
# Please manually delete them in $HOME/.docker/manifests/
|
||||
# and re-run.
|
||||
## image.manifest.remove.%: Remove local manifest list
|
||||
.PHONY: image.manifest.remove.%
|
||||
image.manifest.remove.%:
|
||||
@rm -rf ${HOME}/.docker/manifests/docker.io_$(REGISTRY_PREFIX)_$(IMAGE)-$(VERSION)
|
||||
|
||||
## image.manifest.push.multiarch: Push manifest list for multi-arch images for all platforms
|
||||
.PHONY: image.manifest.push.multiarch
|
||||
image.manifest.push.multiarch: image.push.multiarch $(addprefix image.manifest.push.multiarch., $(IMAGES))
|
||||
|
||||
## image.manifest.push.multiarch.%: Push manifest list for multi-arch images for all platforms for a specific image
|
||||
.PHONY: image.manifest.push.multiarch.%
|
||||
image.manifest.push.multiarch.%:
|
||||
@echo "===========> Pushing manifest $* $(VERSION) to $(REGISTRY_PREFIX) and then remove the local manifest list"
|
||||
REGISTRY_PREFIX=$(REGISTRY_PREFIX) PLATFORMS="$(PLATFORMS)" IMAGE=$* VERSION=$(VERSION) DOCKER_CLI_EXPERIMENTAL=enabled \
|
||||
$(ROOT_DIR)/build/lib/create-manifest.sh
|
||||
|
||||
## image.help: Print help for image targets
|
||||
.PHONY: image.help
|
||||
image.help: scripts/make-rules/image.mk
|
||||
$(call smallhelp)
|
@ -0,0 +1,42 @@
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for release
|
||||
# Versions are used after merging
|
||||
#
|
||||
|
||||
## release.run: release the project
|
||||
.PHONY: release.run
|
||||
release.run: release.verify release.ensure-tag
|
||||
@scripts/release.sh
|
||||
|
||||
## release.verify: Check if a tool is installed and install it
|
||||
.PHONY: release.verify
|
||||
release.verify: tools.verify.git-chglog tools.verify.github-release tools.verify.coscmd tools.verify.coscli
|
||||
|
||||
## release.tag: release the project
|
||||
.PHONY: release.tag
|
||||
release.tag: tools.verify.gsemver release.ensure-tag
|
||||
@git push origin `git describe --tags --abbrev=0`
|
||||
|
||||
## release.ensure-tag: ensure tag
|
||||
.PHONY: release.ensure-tag
|
||||
release.ensure-tag: tools.verify.gsemver
|
||||
@scripts/ensure-tag.sh
|
||||
|
||||
## release.help: Display help information about the release package
|
||||
.PHONY: release.help
|
||||
release.help: scripts/make-rules/release.mk
|
||||
$(call smallhelp)
|
@ -0,0 +1,19 @@
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for swagger
|
||||
#
|
||||
|
||||
## swagger.run: Generate swagger document.
|
||||
.PHONY: swagger.run
|
||||
swagger.run: tools.verify.swagger
|
||||
@echo "===========> Generating swagger API docs"
|
||||
@$(TOOLS_DIR)/swagger generate spec --scan-models -w $(ROOT_DIR)/cmd/genswaggertypedocs -o $(ROOT_DIR)/api/swagger/swagger.yaml
|
||||
|
||||
## swagger.serve: Serve swagger spec and docs.
|
||||
.PHONY: swagger.serve
|
||||
swagger.serve: tools.verify.swagger
|
||||
@$(TOOLS_DIR)/swagger serve -F=redoc --no-open --port 36666 $(ROOT_DIR)/api/swagger/swagger.yaml
|
||||
|
||||
## swagger.help: Display help information about the release package
|
||||
.PHONY: swagger.help
|
||||
swagger.help: scripts/make-rules/swagger.mk
|
||||
$(call smallhelp)
|
@ -0,0 +1,280 @@
|
||||
# Copyright © 2023 OpenIMSDK.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# ==============================================================================
|
||||
# Makefile helper functions for tools(https://github.com/avelino/awesome-go) -> DIR: {TOOT_DIR}/tools | (go >= 1.19)
|
||||
# Why download to the tools directory, thinking we might often switch Go versions using gvm.
|
||||
#
|
||||
|
||||
# openim build use BUILD_TOOLS
|
||||
BUILD_TOOLS ?= golangci-lint goimports addlicense deepcopy-gen conversion-gen ginkgo go-junit-report go-gitlint
|
||||
# Code analysis tools
|
||||
ANALYSIS_TOOLS = golangci-lint goimports golines go-callvis kube-score
|
||||
# Code generation tools
|
||||
GENERATION_TOOLS = deepcopy-gen conversion-gen protoc-gen-go cfssl rts codegen
|
||||
# Testing tools
|
||||
TEST_TOOLS = ginkgo go-junit-report gotests
|
||||
# tenxun cos tools
|
||||
COS_TOOLS = coscli coscmd
|
||||
# Version control tools
|
||||
VERSION_CONTROL_TOOLS = addlicense go-gitlint git-chglog github-release gsemver
|
||||
# Utility tools
|
||||
UTILITY_TOOLS = go-mod-outdated mockgen gothanks richgo kubeconform
|
||||
# All tools
|
||||
ALL_TOOLS ?= $(ANALYSIS_TOOLS) $(GENERATION_TOOLS) $(TEST_TOOLS) $(VERSION_CONTROL_TOOLS) $(UTILITY_TOOLS) $(COS_TOOLS)
|
||||
|
||||
## tools.install: Install a must tools
|
||||
.PHONY: tools.install
|
||||
tools.install: $(addprefix tools.verify., $(BUILD_TOOLS))
|
||||
|
||||
## tools.install-all: Install all tools
|
||||
.PHONY: tools.install-all
|
||||
tools.install-all: $(addprefix tools.install-all., $(ALL_TOOLS))
|
||||
|
||||
## tools.install.%: Install a single tool in $GOBIN/
|
||||
.PHONY: tools.install.%
|
||||
tools.install.%:
|
||||
@echo "===========> Installing $,The default installation path is $(GOBIN)/$*"
|
||||
@$(MAKE) install.$*
|
||||
|
||||
## tools.install-all.%: Parallelism install a single tool in ./tools/*
|
||||
.PHONY: tools.install-all.%
|
||||
tools.install-all.%:
|
||||
@echo "===========> Installing $,The default installation path is $(TOOLS_DIR)/$*"
|
||||
@$(MAKE) -j $(nproc) install.$*
|
||||
|
||||
## tools.verify.%: Check if a tool is installed and install it
|
||||
.PHONY: tools.verify.%
|
||||
tools.verify.%:
|
||||
@echo "===========> Verifying $* is installed"
|
||||
@if [ ! -f $(TOOLS_DIR)/$* ]; then GOBIN=$(TOOLS_DIR) $(MAKE) tools.install.$*; fi
|
||||
@echo "===========> $* is install in $(TOOLS_DIR)/$*"
|
||||
|
||||
## install.golangci-lint: Install golangci-lint
|
||||
.PHONY: install.golangci-lint
|
||||
install.golangci-lint:
|
||||
@$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
||||
|
||||
## install.goimports: Install goimports, used to format go source files
|
||||
.PHONY: install.goimports
|
||||
install.goimports:
|
||||
@$(GO) install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
|
||||
|
||||
## install.addlicense: Install addlicense, used to add license header to source files
|
||||
.PHONY: install.addlicense
|
||||
install.addlicense:
|
||||
@$(GO) install github.com/google/addlicense@$(ADDLICENSE_VERSION)
|
||||
|
||||
## install.deepcopy-gen: Install deepcopy-gen, used to generate deep copy functions
|
||||
.PHONY: install.deepcopy-gen
|
||||
install.deepcopy-gen:
|
||||
@$(GO) install k8s.io/code-generator/cmd/deepcopy-gen@$(DEEPCOPY_GEN_VERSION)
|
||||
|
||||
## install.conversion-gen: Install conversion-gen, used to generate conversion functions
|
||||
.PHONY: install.conversion-gen
|
||||
install.conversion-gen:
|
||||
@$(GO) install k8s.io/code-generator/cmd/conversion-gen@$(CONVERSION_GEN_VERSION)
|
||||
|
||||
## install.ginkgo: Install ginkgo to run a single test or set of tests
|
||||
.PHONY: install.ginkgo
|
||||
install.ginkgo:
|
||||
@$(GO) install github.com/onsi/ginkgo/ginkgo@$(GINKGO_VERSION)
|
||||
|
||||
## install.go-gitlint: Install go-gitlint, used to check git commit message
|
||||
.PHONY: install.go-gitlint
|
||||
install.go-gitlint:
|
||||
@$(GO) install github.com/marmotedu/go-gitlint/cmd/go-gitlint@$(GO_GITLINT_VERSION)
|
||||
|
||||
## install.go-junit-report: Install go-junit-report, used to convert go test output to junit xml
|
||||
.PHONY: install.go-junit-report
|
||||
install.go-junit-report:
|
||||
@$(GO) install github.com/jstemmer/go-junit-report@$(GO_JUNIT_REPORT_VERSION)
|
||||
|
||||
## install.gotests: Install gotests, used to generate go tests
|
||||
.PHONY: install.gotests
|
||||
install.gotests:
|
||||
@$(GO) install github.com/cweill/gotests/gotests@$(GO_TESTS_VERSION)
|
||||
|
||||
## install.kafkactl: Install kafkactl command line tool.
|
||||
.PHONY: install.kafkactl
|
||||
install.kafkactl:
|
||||
@$(GO) install github.com/deviceinsight/kafkactl@$(KAFKACTL_VERSION)
|
||||
|
||||
## install.go-apidiff: Install go-apidiff, used to check api changes
|
||||
.PHONY: install.go-apidiff
|
||||
install.go-apidiff:
|
||||
@$(GO) install github.com/joelanford/go-apidiff@$(GO_APIDIFF_VERSION)
|
||||
|
||||
## install.swagger: Install swagger, used to generate swagger documentation
|
||||
.PHONY: install.swagger
|
||||
install.swagger:
|
||||
@$(GO) install github.com/go-swagger/go-swagger/cmd/swagger@$(SWAGGER_VERSION)
|
||||
|
||||
# ==============================================================================
|
||||
# Tools that might be used include go gvm
|
||||
#
|
||||
|
||||
## install.gotestsum: Install gotestsum, used to run go tests
|
||||
.PHONY: install.gotestsum
|
||||
install.gotestsum:
|
||||
@$(GO) install gotest.tools/gotestsum@$(GOTESTSUM_VERSION)
|
||||
|
||||
## install.kube-score: Install kube-score, used to check kubernetes yaml files
|
||||
.PHONY: install.kube-score
|
||||
install.kube-score:
|
||||
@$(GO) install github.com/zegl/kube-score/cmd/kube-score@$(KUBE_SCORE_VERSION)
|
||||
|
||||
## install.kubeconform: Install kubeconform, used to check kubernetes yaml files
|
||||
.PHONY: install.kubeconform
|
||||
install.kubeconform:
|
||||
@$(GO) install github.com/yannh/kubeconform/cmd/kubeconform@$(KUBECONFORM_VERSION)
|
||||
|
||||
## install.gsemver: Install gsemver, used to generate semver
|
||||
.PHONY: install.gsemver
|
||||
install.gsemver:
|
||||
@$(GO) install github.com/arnaud-deprez/gsemver@$(GSEMVER_VERSION)
|
||||
|
||||
## install.git-chglog: Install git-chglog, used to generate changelog
|
||||
.PHONY: install.git-chglog
|
||||
install.git-chglog:
|
||||
@$(GO) install github.com/git-chglog/git-chglog/cmd/git-chglog@$(GIT_CHGLOG_VERSION)
|
||||
|
||||
## install.ko: Install ko, used to build go program into container images
|
||||
.PHONY: install.ko
|
||||
install.ko:
|
||||
@$(GO) install github.com/google/ko@$(KO_VERSION)
|
||||
|
||||
## install.github-release: Install github-release, used to create github release
|
||||
.PHONY: install.github-release
|
||||
install.github-release:
|
||||
@$(GO) install github.com/github-release/github-release@$(GITHUB_RELEASE_VERSION)
|
||||
|
||||
## install.coscli: Install coscli, used to upload files to cos
|
||||
# example: ./coscli cp/sync -r /home/off-line/docker-off-line/ cos://openim-1306374445/openim/image/amd/off-line/off-line/ -e cos.ap-guangzhou.myqcloud.com
|
||||
# https://cloud.tencent.com/document/product/436/71763
|
||||
# amd64
|
||||
.PHONY: install.coscli
|
||||
install.coscli:
|
||||
@wget -q https://github.com/tencentyun/coscli/releases/download/$(COSCLI_VERSION)/coscli-linux -O ${TOOLS_DIR}/coscli
|
||||
@chmod +x ${TOOLS_DIR}/coscli
|
||||
|
||||
## install.coscmd: Install coscmd, used to upload files to cos
|
||||
.PHONY: install.coscmd
|
||||
install.coscmd:
|
||||
@if which pip &>/dev/null; then pip install coscmd; else pip3 install coscmd; fi
|
||||
|
||||
## install.minio: Install minio, used to upload files to minio
|
||||
.PHONY: install.minio
|
||||
install.minio:
|
||||
@$(GO) install github.com/minio/minio@$(MINIO_VERSION)
|
||||
|
||||
## install.delve: Install delve, used to debug go program
|
||||
.PHONY: install.delve
|
||||
install.delve:
|
||||
@$(GO) install github.com/go-delve/delve/cmd/dlv@$(DELVE_VERSION)
|
||||
|
||||
## install.air: Install air, used to hot reload go program
|
||||
.PHONY: install.air
|
||||
install.air:
|
||||
@$(GO) install github.com/cosmtrek/air@$(AIR_VERSION)
|
||||
|
||||
## install.gvm: Install gvm, gvm is a Go version manager, built on top of the official go tool.
|
||||
.PHONY: install.gvm
|
||||
install.gvm:
|
||||
@echo "===========> Installing gvm, The default installation path is ~/.gvm/scripts/gvm"
|
||||
@bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||
@source /root/.gvm/scripts/gvm
|
||||
|
||||
## install.golines: Install golines, used to format long lines
|
||||
.PHONY: install.golines
|
||||
install.golines:
|
||||
@$(GO) install github.com/segmentio/golines@$(GOLINES_VERSION)
|
||||
|
||||
## install.go-mod-outdated: Install go-mod-outdated, used to check outdated dependencies
|
||||
.PHONY: install.go-mod-outdated
|
||||
install.go-mod-outdated:
|
||||
@$(GO) install github.com/psampaz/go-mod-outdated@$(GO_MOD_OUTDATED_VERSION)
|
||||
|
||||
## install.mockgen: Install mockgen, used to generate mock functions
|
||||
.PHONY: install.mockgen
|
||||
install.mockgen:
|
||||
@$(GO) install github.com/golang/mock/mockgen@$(MOCKGEN_VERSION)
|
||||
|
||||
## install.wire: Install wire, used to generate wire files
|
||||
.PHONY: install.wire
|
||||
install.wire:
|
||||
@$(GO) install github.com/google/wire/cmd/wire@$(WIRE_VERSION)
|
||||
|
||||
|
||||
## install.protoc-gen-go: Install protoc-gen-go, used to generate go source files from protobuf files
|
||||
.PHONY: install.protoc-gen-go
|
||||
install.protoc-gen-go:
|
||||
@$(GO) install github.com/golang/protobuf/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
|
||||
|
||||
## install.cfssl: Install cfssl, used to generate certificates
|
||||
.PHONY: install.cfssl
|
||||
install.cfssl:
|
||||
@$(ROOT_DIR)/scripts/install/install.sh openim::install::install_cfssl
|
||||
|
||||
## install.depth: Install depth, used to check dependency tree
|
||||
.PHONY: install.depth
|
||||
install.depth:
|
||||
@$(GO) install github.com/KyleBanks/depth/cmd/depth@$(DEPTH_VERSION)
|
||||
|
||||
## install.go-callvis: Install go-callvis, used to visualize call graph
|
||||
.PHONY: install.go-callvis
|
||||
install.go-callvis:
|
||||
@$(GO) install github.com/ofabry/go-callvis@$(GO_CALLVIS_VERSION)
|
||||
|
||||
## install.misspell: Install misspell
|
||||
.PHONY: install.misspell
|
||||
install.misspell:
|
||||
@$(GO) install github.com/client9/misspell/cmd/misspell@$(MISSPELL_VERSION)
|
||||
|
||||
## install.gothanks: Install gothanks, used to thank go dependencies
|
||||
.PHONY: install.gothanks
|
||||
install.gothanks:
|
||||
@$(GO) install github.com/psampaz/gothanks@$(GOTHANKS_VERSION)
|
||||
|
||||
## install.richgo: Install richgo
|
||||
.PHONY: install.richgo
|
||||
install.richgo:
|
||||
@$(GO) install github.com/kyoh86/richgo@$(RICHGO_VERSION)
|
||||
|
||||
## install.rts: Install rts
|
||||
.PHONY: install.rts
|
||||
install.rts:
|
||||
@$(GO) install github.com/galeone/rts/cmd/rts@$(RTS_VERSION)
|
||||
|
||||
# ================= kubecub openim tools =========================================
|
||||
# https://github.com/kubecub
|
||||
## install.typecheck: Install kubecub typecheck, checks for go code
|
||||
.PHONY: install.typecheck
|
||||
install.typecheck:
|
||||
@$(GO) install github.com/kubecub/typecheck@$(TYPECHECK_VERSION)
|
||||
|
||||
## install.comment-lang-detector: Install kubecub comment-lang-detector, checks for go code comment language
|
||||
.PHONY: install.comment-lang-detector
|
||||
install.comment-lang-detector:
|
||||
@$(GO) install github.com/kubecub/comment-lang-detector/cmd/cld@$(COMMENT_LANG_DETECTOR_VERSION)
|
||||
|
||||
## install.standardizer: Install kubecub standardizer, checks for go code standardization
|
||||
.PHONY: install.standardizer
|
||||
install.standardizer:
|
||||
@$(GO) install github.com/kubecub/standardizer@$(STANDARDIZER_VERSION)
|
||||
|
||||
## tools.help: Display help information about the tools package
|
||||
.PHONY: tools.help
|
||||
tools.help: scripts/make-rules/tools.mk
|
||||
$(call smallhelp)
|
Loading…
Reference in new issue