mirror of
https://github.com/gmsec/gmsec.git
synced 2025-09-26 20:01:21 +08:00
1
This commit is contained in:
16
Makefile
16
Makefile
@@ -6,6 +6,7 @@ source_install:
|
||||
clear: # 删除proto文件夹下所有go文件(谨慎操作)
|
||||
rm -rf ./prc/**/*.go
|
||||
new: #make new service=example
|
||||
ifeq ($(OS),Windows_NT) # windows
|
||||
echo start install $(service)
|
||||
@# 开始替换文件
|
||||
@test -d $(service) || cp -r ./example/ ./$(service)/
|
||||
@@ -18,3 +19,18 @@ new: #make new service=example
|
||||
@test -d ./apidoc/proto/$(service)/ || cp -r ./apidoc/proto/example/ ./apidoc/proto/$(service)/
|
||||
@sed -i 's#example#$(service)#g' ./apidoc/proto/$(service)/*.proto
|
||||
@echo service $(service) success
|
||||
else
|
||||
echo start install $(service)
|
||||
@# 开始替换文件
|
||||
@test -d $(service) || cp -r ./example/ ./$(service)/
|
||||
find ./$(service)/ -type f -name "*.go" | xargs sed -i '' 's#example#$(service)#g'
|
||||
@sed -i '' 's#example#$(service)#g' ./$(service)/go.mod
|
||||
@sed -i '' 's#example#$(service)#g' ./$(service)/Makefile
|
||||
@sed -i '' 's#example#$(service)#g' ./$(service)/generate/proto_makefile
|
||||
@sed -i '' 's#example#$(service)#g' ./$(service)/conf/config.yml
|
||||
@# 开始更新apidoc
|
||||
@test -d ./apidoc/proto/$(service)/ || cp -r ./apidoc/proto/example/ ./apidoc/proto/$(service)/
|
||||
@sed -i '' 's#example#$(service)#g' ./apidoc/proto/$(service)/*.proto
|
||||
@echo service $(service) success
|
||||
endif
|
||||
|
||||
|
@@ -18,8 +18,14 @@ gen_build:# 自定义注册
|
||||
echo build $$file; \
|
||||
protoc --proto_path="$(APIDOCDIR)/proto/" --gmsec_out=plugins=gmsec:./ $(NAME)/$$file; \
|
||||
done;
|
||||
ifeq ($(OS),Windows_NT) # windows
|
||||
@sed -i 's/,omitempty//g' ./rpc/$(NAME)/*.pb.go #开始取消json omitempty
|
||||
cp -rf ./rpc/$(NAME)/ $(RPCCDIR)/ #子目录向父目录拷贝
|
||||
else
|
||||
@sed -i '' 's/,omitempty//g' ./rpc/$(NAME)/*.pb.go #开始取消json omitempty
|
||||
cp -rf ./rpc/$(NAME)/ $(RPCCDIR)/$(NAME)/ #子目录向父目录拷贝
|
||||
endif
|
||||
|
||||
#@sed -i 's#common "rpc/common"#common "$(NAME)/rpc/common"#g' ./rpc/$(NAME)/*.pb.go #开始替换common包
|
||||
#@sed -i 's#common "rpc/common"#common "$(NAME)/rpc/common"#g' ./rpc/$(NAME)/*.pb.gmsec.go #开始替换common包
|
||||
#@sed -i 's#_ "rpc/common"#_ "$(NAME)/rpc/common"#g' ./rpc/$(NAME)/*.pb.go #开始替换common包
|
||||
@@ -34,7 +40,9 @@ gen_base:# 基础库
|
||||
echo base $$file; \
|
||||
protoc --proto_path="$(APIDOCDIR)/proto/" --gmsec_out=plugins=gmsec:$(APIDOCDIR)/ common/$$file; \
|
||||
done;
|
||||
ifeq ($(OS),Windows_NT) # windows
|
||||
@sed -i 's/,omitempty//g' $(RPCCDIR)/common/*.pb.go #开始取消json omitempty
|
||||
else
|
||||
@sed -i '' 's/,omitempty//g' $(RPCCDIR)/common/*.pb.go #开始取消json omitempty
|
||||
endif
|
||||
#cp -rf $(RPCCDIR)/common/ ./rpc/ #父目录向当前目录拷贝
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user