build.sh 801 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. #
  3. # Build file to set up and run tests
  4. set -ex
  5. # Install the latest Bazel version available
  6. use_bazel.sh latest
  7. bazel version
  8. # Print bazel testlogs to stdout when tests failed.
  9. function print_test_logs {
  10. # TODO(yannic): Only print logs of failing tests.
  11. testlogs_dir=$(bazel info bazel-testlogs)
  12. testlogs=$(find "${testlogs_dir}" -name "*.log")
  13. for log in $testlogs; do
  14. cat "${log}"
  15. done
  16. }
  17. # Change to repo root
  18. cd $(dirname $0)/../../..
  19. git submodule update --init --recursive
  20. trap print_test_logs EXIT
  21. bazel test --copt=-Werror --host_copt=-Werror \
  22. //:build_files_updated_unittest \
  23. //java/... \
  24. //:protoc \
  25. //:protobuf \
  26. //:protobuf_python \
  27. //:protobuf_test \
  28. @com_google_protobuf//:cc_proto_blacklist_test
  29. trap - EXIT
  30. cd examples
  31. bazel build //...