Mike Kruskal | f589515 | 2022-12-20 18:43:30 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # This script runs the staleness tests and uses them to update any stale |
| 4 | # generated files. |
| 5 | |
| 6 | set -ex |
| 7 | |
Mike Kruskal | c399aec | 2023-02-06 21:09:07 -0800 | [diff] [blame] | 8 | echo "::group::Regenerate stale files" |
| 9 | |
Mike Kruskal | f589515 | 2022-12-20 18:43:30 -0800 | [diff] [blame] | 10 | # Cd to the repo root. |
| 11 | cd $(dirname -- "$0") |
| 12 | |
Mike Kruskal | f1e746c | 2023-02-02 17:42:30 -0800 | [diff] [blame] | 13 | readonly BazelBin="${BAZEL:-bazel} ${BAZEL_STARTUP_FLAGS}" |
| 14 | |
Mike Kruskal | f589515 | 2022-12-20 18:43:30 -0800 | [diff] [blame] | 15 | # Run and fix all staleness tests. |
Mike Kruskal | f1e746c | 2023-02-02 17:42:30 -0800 | [diff] [blame] | 16 | ${BazelBin} test src:cmake_lists_staleness_test "$@" || ./bazel-bin/src/cmake_lists_staleness_test --fix |
| 17 | ${BazelBin} test src/google/protobuf:well_known_types_staleness_test "$@" || ./bazel-bin/src/google/protobuf/well_known_types_staleness_test --fix |
Protobuf Team Bot | e2aa06e | 2023-02-10 14:11:22 -0800 | [diff] [blame] | 18 | ${BazelBin} test objectivec:well_known_types_staleness_test "$@" || ./bazel-bin/objectivec/well_known_types_staleness_test --fix |
Adam Cozzette | 0937be1 | 2023-08-29 17:49:57 -0700 | [diff] [blame] | 19 | ${BazelBin} test php:test_amalgamation_staleness "$@" || ./bazel-bin/php/test_amalgamation_staleness --fix |
| 20 | ${BazelBin} test ruby/ext/google/protobuf_c:test_amalgamation_staleness "$@" || ./bazel-bin/ruby/ext/google/protobuf_c/test_amalgamation_staleness --fix |
Adam Cozzette | 7286ffc | 2023-09-12 13:06:39 -0700 | [diff] [blame] | 21 | ${BazelBin} test upb/cmake:test_generated_files "$@" || ./bazel-bin/upb/cmake/test_generated_files --fix |
Protobuf Team Bot | 4e69c50 | 2023-01-16 02:28:39 -0800 | [diff] [blame] | 22 | |
| 23 | # Generate C# code. |
| 24 | # This doesn't currently have Bazel staleness tests, but there's an existing |
| 25 | # shell script that generates everything required. The output files are stable, |
| 26 | # so just regenerating in place should be harmless. |
Mike Kruskal | f1e746c | 2023-02-02 17:42:30 -0800 | [diff] [blame] | 27 | ${BazelBin} build src/google/protobuf/compiler:protoc "$@" |
Protobuf Team Bot | 4e69c50 | 2023-01-16 02:28:39 -0800 | [diff] [blame] | 28 | (export PROTOC=$PWD/bazel-bin/protoc && cd csharp && ./generate_protos.sh) |
Mike Kruskal | c399aec | 2023-02-06 21:09:07 -0800 | [diff] [blame] | 29 | |
| 30 | echo "::endgroup::" |