build_excel.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. echo "[EXCEL] build excel files..."
  3. # 检查并进入仓库根目录
  4. repo_root=$(git rev-parse --show-toplevel 2>/dev/null || true)
  5. if [[ -z "$repo_root" ]]; then
  6. echo "未检测到源码git仓库,请在项目仓库内运行此脚本。"
  7. exit 1
  8. fi
  9. if [[ -z "$repo_root/_excel/" ]]; then
  10. echo "未检测到_excel git仓库,请在项目仓库内运行此脚本。"
  11. exit 1
  12. fi
  13. excel_path="$repo_root/_excel/"
  14. excel_bin_path="$repo_root/_excel/bin/"
  15. data_path="$repo_root/etc/data"
  16. data_map_path="$repo_root/etc/data_map/"
  17. go_path="$repo_root/internal/data"
  18. echo "repo_root = $repo_root"
  19. echo "excel_path = $excel_path"
  20. echo "excel_bin_path = $excel_bin_path"
  21. echo "data_path = $data_path"
  22. echo "go_path = $go_path"
  23. echo ""
  24. pushd "$excel_bin_path"
  25. if [[ "$(uname -s)" == "MINGW"* ]]; then
  26. ./ee.exe --path=./server.json
  27. else
  28. ./ee_linux --path=./server.json
  29. fi
  30. popd
  31. echo "[EXCEL] copy json files to $data_path"
  32. cp -rf $excel_path/output/server_json/*.json $data_path
  33. echo "[EXCEL] copy go files to $go_path"
  34. cp -rf $excel_path/output/server_go/*.go $go_path
  35. rm -rf $excel_path/output
  36. echo "[EXCEL] copy embed data files"
  37. cp -rf $repo_root/etc/data_embed/*.json $data_path
  38. echo "[EXCEL] copy map data files"
  39. cp -rf $excel_path/data_map/* $data_map_path
  40. echo "[EXCEL] build excel files is complete!"