bazel_build.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. type=${1}
  3. echo "$(date) build..." >> /data/gitlab-runner/build.log
  4. function compileall()
  5. {
  6. make build-keep-going
  7. }
  8. function compilepart()
  9. {
  10. pkgs=`.rider/changepkgs.sh`
  11. exitCode=$?
  12. if [[ ${exitCode} -ne 0 ]]; then
  13. echo ".rider/changepkgs.sh fail"
  14. exit ${exitCode}
  15. fi
  16. if [[ "${pkgs}" = "" ]]; then
  17. echo "no changepkgs"
  18. exit 0
  19. fi
  20. echo -e "change packages:\n${pkgs}\n"
  21. paths=""
  22. for pkg in ${pkgs}
  23. do
  24. if [[ "${paths}" != "" ]]; then
  25. paths="${paths} union allpaths(//app/..., //${pkg}:all)"
  26. else
  27. paths="allpaths(//app/..., //${pkg}:all)"
  28. fi
  29. done
  30. echo "bazel build..."
  31. query=`bazel query "${paths}"`
  32. echo -e "${query}\n"
  33. bazel build --config=ci --watchfs -k $(echo -e "${query}" | grep -v all-srcs | grep -v package-srcs | grep -v _proto)
  34. #bazel build $(bazel query "${paths}" |grep -v all-srcs |grep -v package-srcs)
  35. }
  36. if [[ "${type}" = "part" ]]; then
  37. compilepart
  38. else
  39. compileall
  40. fi