forked from ixre/go2o
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththrift-generate-code.sh
More file actions
executable file
·44 lines (33 loc) · 1.19 KB
/
thrift-generate-code.sh
File metadata and controls
executable file
·44 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# generate api docs
rm -rf api_docs &&
apidoc -i $(find . -name 'apidoc.json' -print -quit | xargs dirname) -o api_docs/
# 生成服务代码
# author : liuming
# data : 2017-11-26 11:00
java_target_path="./tmp/java"
cs_target_path="./tmp/csharp"
if [[ $GO2O_JAVA_HOME != "" ]]; then java_target_path=$GO2O_JAVA_HOME; fi
thrift_path=$(find . -name "service.thrift" -print -quit)
cmd=$1
if [[ ${cmd} == "csharp" || ${cmd} == "all" ]]; then
rm -rf ${cs_target_path}/*
thrift -r -gen csharp -out ${cs_target_path} ${thrift_path}
fi
if [[ ${cmd} == "java" || ${cmd} == "all" ]]; then
mkdir -p ${java_target_path}
rm -rf ${java_target_path}/proto/*
thrift -r -gen java -out ${java_target_path} ${thrift_path}
fi
#if [[ ${cmd} = "go" || ${cmd} = "all" ]];then
rm -rf ./go2o/core/service/thrift/auto_gen/rpc
thrift -r -gen go -out ../ ${thrift_path}
#fi
if [[ ${cmd} == "all" ]] || [[ ${cmd} == "format" ]]; then
cd ${go_target_path}
#find ./ -name *.go |xargs sed -i \
# 's/"ttype"/"go2o\/core\/service\/auto-gen\/thrift\/ttype"/g'
#find ./ -name *.go |xargs sed -i \
# 's/"\(.\{3,\}\)_service"/"go2o\/core\/service\/auto-gen\/thrift\/\1_service"/g'
#cd - >/dev/null
fi