diff --git a/Makefile b/Makefile index 834bdcfc7..496c9166d 100644 --- a/Makefile +++ b/Makefile @@ -23,13 +23,13 @@ VERSION_PACKAGE=github.com/OpenIMSDK/Open-IM-Server/pkg/version # ============================================================================== # Includes -include scripts/make-rules/common.mk # make sure include common.mk at the first include line -include scripts/make-rules/golang.mk -include scripts/make-rules/image.mk -include scripts/make-rules/copyright.mk -include scripts/make-rules/gen.mk -include scripts/make-rules/dependencies.mk -include scripts/make-rules/tools.mk +include script/make-rules/common.mk # make sure include common.mk at the first include line +include script/make-rules/golang.mk +include script/make-rules/image.mk +include script/make-rules/copyright.mk +include script/make-rules/gen.mk +include script/make-rules/dependencies.mk +include script/make-rules/tools.mk # ============================================================================== # Usage diff --git a/README.md b/README.md index daf430313..4c42c6768 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ all services build success ### SCRIPT DESCRIPTION -> Open-IM script provides service compilation, start, and stop scripts. There are four Open-IM script start modules, one is the http+rpc service start module, the second is the websocket service start module, then the msg_transfer module, and the last is the push module +> Open-IM script provides service compilation, start, and stop script. There are four Open-IM script start modules, one is the http+rpc service start module, the second is the websocket service start module, then the msg_transfer module, and the last is the push module - path_info.cfg&&style_info.cfg&&functions.sh - Contains the path information of each module, including the path where the source code is located, the name of the service startup, the shell print font style, and some functions for processing shell strings diff --git a/deploy.Dockerfile b/deploy.Dockerfile index 1738bda80..2ddc7237c 100644 --- a/deploy.Dockerfile +++ b/deploy.Dockerfile @@ -30,7 +30,7 @@ RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure #set directory to map logs,config file,script file. VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"] -#Copy scripts files and binary files to the blank image +#Copy script files and binary files to the blank image COPY --from=build /Open-IM-Server/script /Open-IM-Server/script COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin diff --git a/script/make-rules/common.mk b/script/make-rules/common.mk index f65d62acf..63d16debc 100644 --- a/script/make-rules/common.mk +++ b/script/make-rules/common.mk @@ -31,14 +31,14 @@ endef # Here are some examples of builds define MAKEFILE_EXAMPLE -# make build BINS=imctl Only a single imctl binary is built. +# make build BINS=imctl Only a single imctl binary is built. # make -j $(nproc) all Run tidy gen add-copyright format lint cover build concurrently. # make gen Generate all necessary files. # make linux.arm64 imctl is compiled on arm64 platform. # 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=imctl V=1 DEBUG=1 Build debug binaries for only imctl. -# make build.multiarch PLATFORMS="linux_arm64 linux_amd64" V=1 Build binaries for both platforms. +# make multiarch PLATFORMS="linux_arm64 linux_amd64" V=1 Build binaries for both platforms. endef export MAKEFILE_EXAMPLE diff --git a/script/make-rules/copyright.mk b/script/make-rules/copyright.mk index 00277ad48..40a6c9a67 100644 --- a/script/make-rules/copyright.mk +++ b/script/make-rules/copyright.mk @@ -17,7 +17,7 @@ # Makefile helper functions for copyright # -LICENSE_TEMPLATE ?= $(ROOT_DIR)/scripts/LICENSE_TEMPLATE +LICENSE_TEMPLATE ?= $(ROOT_DIR)/script/LICENSE_TEMPLATE # TODO: GOBIN -> TOOLS_DIR # Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181 @@ -55,5 +55,5 @@ copyright.add: tools.verify.addlicense ## copyright.help: Show copyright help .PHONY: copyright.help -copyright.help: scripts/make-rules/copyright.mk +copyright.help: script/make-rules/copyright.mk $(call smallhelp) \ No newline at end of file diff --git a/script/make-rules/dependencies.mk b/script/make-rules/dependencies.mk new file mode 100644 index 000000000..ba54ce38e --- /dev/null +++ b/script/make-rules/dependencies.mk @@ -0,0 +1,36 @@ +# 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)) diff --git a/script/make-rules/gen.mk b/script/make-rules/gen.mk index 61489373b..c875223c4 100644 --- a/script/make-rules/gen.mk +++ b/script/make-rules/gen.mk @@ -16,4 +16,10 @@ # 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 -# \ No newline at end of file +# + + +## gen.help: show help for gen +.PHONY: gen.help +gen.help: script/make-rules/gen.mk + $(call smallhelp) \ No newline at end of file diff --git a/script/make-rules/golang.mk b/script/make-rules/golang.mk index d140e86f8..1eb0b1aba 100644 --- a/script/make-rules/golang.mk +++ b/script/make-rules/golang.mk @@ -14,4 +14,10 @@ # ============================================================================== # Build management helpers. These functions help to set, save and load the -# \ No newline at end of file +# + + +## copyright.help: Show copyright help +.PHONY: go.help +go.help: script/make-rules/golang.mk + $(call smallhelp) diff --git a/script/make-rules/image.mk b/script/make-rules/image.mk index 0eb46137e..25c2a9c07 100644 --- a/script/make-rules/image.mk +++ b/script/make-rules/image.mk @@ -16,6 +16,12 @@ # Makefile helper functions for docker image # TODO: For the time being only used for compilation, it can be arm or amd, please do not delete it, it can be extended with new functions # ============================================================================== -# Path: scripts/make-rules/image.mk +# Path: script/make-rules/image.mk # docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/: -# \ No newline at end of file +# + + +## image.help: Print help for image targets +.PHONY: image.help +image.help: script/make-rules/image.mk + $(call smallhelp) \ No newline at end of file diff --git a/script/make-rules/tools.mk b/script/make-rules/tools.mk index 645621f4f..f5036a980 100644 --- a/script/make-rules/tools.mk +++ b/script/make-rules/tools.mk @@ -132,9 +132,9 @@ install.github-release: ## 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" + @echo "===========> Installing gvm,The default installation path is ~/.gvm/script/gvm" @bash < <(curl -s -S -L https://raw.gitee.com/moovweb/gvm/master/binscripts/gvm-installer) - @$(shell source /root/.gvm/scripts/gvm) + @$(shell source /root/.gvm/script/gvm) ## install.golines: Install golines, used to format long lines .PHONY: install.golines @@ -164,7 +164,7 @@ install.protoc-gen-go: ## install.cfssl: Install cfssl, used to generate certificates .PHONY: install.cfssl install.cfssl: - @$(ROOT_DIR)/scripts/install/install.sh iam::install::install_cfssl + @$(ROOT_DIR)/script/install/install.sh iam::install::install_cfssl ## install.depth: Install depth, used to check dependency tree .PHONY: install.depth @@ -198,5 +198,5 @@ install.codegen: ## tools.help: Display help information about the tools package .PHONY: tools.help -tools.help: scripts/make-rules/tools.mk +tools.help: script/make-rules/tools.mk $(call smallhelp) \ No newline at end of file