2_Export-server.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash
  2. # 服务器使用的导出脚本
  3. cd `dirname $0`
  4. curdir=$(cd `dirname $0`;pwd)
  5. source ../bin/functions.sh
  6. start_time=$(date +%s)
  7. #echo "cur system "$OSTYPE
  8. if [[ "$OSTYPE" == "msys"* ]]; then
  9. echo "WINDOWS"
  10. exporter=../bin/exporter.exe
  11. elif [[ "$OSTYPE" == "darwin"* ]]; then
  12. echo "MAC"
  13. exporter=../bin/exporter
  14. chmod 777 $exporter
  15. else
  16. echo "config not support system "$OSTYPE
  17. exit
  18. fi
  19. ret=0
  20. function ExportText() {
  21. $exporter -skip-check=true $* &
  22. if [ "$?" != "0" ]; then
  23. ret=1
  24. fi
  25. }
  26. function CheckRet() {
  27. if [ "$?" != "0" ]; then
  28. ret=1
  29. fi
  30. }
  31. datadir=./TestServer/Data
  32. codedir=./TestServer/Parser
  33. #echo "===export tuo la==="
  34. datafmt=fmt/json.data.tpl
  35. gosheetfmt=fmt/json.go.sheet.tpl
  36. gotypefmt=fmt/json.go.type.tpl
  37. component=fmt/json.go.all.tpl
  38. #files="GlobalConfig.xlsx UIConfig.xlsx"
  39. $exporter -t=TypeDefine -tags=v,s, -outs='[
  40. {"Form":"json","Out":"'$datadir'","Tpl":"'$datafmt'","AllInOne":false,"Tags":",s","Ext":".json"},
  41. {"Form":"raw","Out":"'$codedir'","Tpl":"'$component'","AllInOne":true,"Ext":"component.go"},
  42. {"Form":"raw","Out":"'$codedir'","Tpl":"'$gosheetfmt'","TypeTpl":"'$gotypefmt'","Ext":".go","TypeAligns":"int32:int","TypeAlignTpl":"go"}
  43. ]' ./LogicConfig/lua_*.xlsx
  44. CheckRet
  45. wait
  46. end_time=$(date +%s)
  47. cost_time=$[ $end_time-$start_time ]
  48. echo "use time: $(($cost_time/60))min $(($cost_time%60))s"
  49. if [ "$ret" = "0" ]; then
  50. #CountDownExit 2
  51. echo "complete!"
  52. sleep 1
  53. else
  54. echo "******************parse error occured****************"
  55. Pause 'Press any key to continue...'
  56. sleep 0.5
  57. fi
  58. #Pause 'Press any key to continue...'