scripts fix change scripts to script, and create dependencies

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw) 2023-05-11 18:08:45 +08:00 committed by Xinwei Xiong(cubxxw-openim)
parent c85bbe0488
commit b613a045d5
10 changed files with 75 additions and 21 deletions

View File

@ -23,13 +23,13 @@ VERSION_PACKAGE=github.com/OpenIMSDK/Open-IM-Server/pkg/version
# ============================================================================== # ==============================================================================
# Includes # Includes
include scripts/make-rules/common.mk # make sure include common.mk at the first include line include script/make-rules/common.mk # make sure include common.mk at the first include line
include scripts/make-rules/golang.mk include script/make-rules/golang.mk
include scripts/make-rules/image.mk include script/make-rules/image.mk
include scripts/make-rules/copyright.mk include script/make-rules/copyright.mk
include scripts/make-rules/gen.mk include script/make-rules/gen.mk
include scripts/make-rules/dependencies.mk include script/make-rules/dependencies.mk
include scripts/make-rules/tools.mk include script/make-rules/tools.mk
# ============================================================================== # ==============================================================================
# Usage # Usage

View File

@ -138,7 +138,7 @@ all services build success
### SCRIPT DESCRIPTION ### 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 - 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 - 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

View File

@ -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. #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"] 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/script /Open-IM-Server/script
COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin

View File

@ -31,14 +31,14 @@ endef
# Here are some examples of builds # Here are some examples of builds
define MAKEFILE_EXAMPLE 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 -j $(nproc) all Run tidy gen add-copyright format lint cover build concurrently.
# make gen Generate all necessary files. # make gen Generate all necessary files.
# make linux.arm64 imctl is compiled on arm64 platform. # make linux.arm64 imctl is compiled on arm64 platform.
# make verify-copyright Verify the license headers for all files. # make verify-copyright Verify the license headers for all files.
# make install-deepcopy-gen Install deepcopy-gen tools if the license is missing. # 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 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 endef
export MAKEFILE_EXAMPLE export MAKEFILE_EXAMPLE

View File

@ -17,7 +17,7 @@
# Makefile helper functions for copyright # Makefile helper functions for copyright
# #
LICENSE_TEMPLATE ?= $(ROOT_DIR)/scripts/LICENSE_TEMPLATE LICENSE_TEMPLATE ?= $(ROOT_DIR)/script/LICENSE_TEMPLATE
# TODO: GOBIN -> TOOLS_DIR # TODO: GOBIN -> TOOLS_DIR
# Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181 # 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 ## copyright.help: Show copyright help
.PHONY: copyright.help .PHONY: copyright.help
copyright.help: scripts/make-rules/copyright.mk copyright.help: script/make-rules/copyright.mk
$(call smallhelp) $(call smallhelp)

View File

@ -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))

View File

@ -16,4 +16,10 @@
# Makefile helper functions for generate necessary files and docs # Makefile helper functions for generate necessary files and docs
# https://cloud.redhat.com/blog/kubernetes-deep-dive-code-generation-customresources # https://cloud.redhat.com/blog/kubernetes-deep-dive-code-generation-customresources
# ! The stock of code generated by `make gen` should be idempotent # ! The stock of code generated by `make gen` should be idempotent
# #
## gen.help: show help for gen
.PHONY: gen.help
gen.help: script/make-rules/gen.mk
$(call smallhelp)

View File

@ -14,4 +14,10 @@
# ============================================================================== # ==============================================================================
# Build management helpers. These functions help to set, save and load the # Build management helpers. These functions help to set, save and load the
# #
## copyright.help: Show copyright help
.PHONY: go.help
go.help: script/make-rules/golang.mk
$(call smallhelp)

View File

@ -16,6 +16,12 @@
# Makefile helper functions for docker image # 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 # 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/<image-name>:<tag> # docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/<image-name>:<tag>
# #
## image.help: Print help for image targets
.PHONY: image.help
image.help: script/make-rules/image.mk
$(call smallhelp)

View File

@ -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. ## install.gvm: Install gvm, gvm is a Go version manager, built on top of the official go tool.
.PHONY: install.gvm .PHONY: install.gvm
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) @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 ## install.golines: Install golines, used to format long lines
.PHONY: install.golines .PHONY: install.golines
@ -164,7 +164,7 @@ install.protoc-gen-go:
## install.cfssl: Install cfssl, used to generate certificates ## install.cfssl: Install cfssl, used to generate certificates
.PHONY: install.cfssl .PHONY: install.cfssl
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 ## install.depth: Install depth, used to check dependency tree
.PHONY: install.depth .PHONY: install.depth
@ -198,5 +198,5 @@ install.codegen:
## tools.help: Display help information about the tools package ## tools.help: Display help information about the tools package
.PHONY: tools.help .PHONY: tools.help
tools.help: scripts/make-rules/tools.mk tools.help: script/make-rules/tools.mk
$(call smallhelp) $(call smallhelp)