3 # This script runs the staleness tests and uses them to update any stale
8 echo "::group::Regenerate stale files"
10 # Cd to the repo root.
13 readonly BazelBin
="${BAZEL:-bazel} ${BAZEL_STARTUP_FLAGS}"
16 "csharp:generated_csharp_defaults_staleness_test"
17 "java/core:generated_java_defaults_staleness_test"
18 "upb/reflection:bootstrap_upb_defaults_staleness_test"
19 "cmake:test_dependencies_staleness"
20 "src:cmake_lists_staleness_test"
21 "src/google/protobuf:well_known_types_staleness_test"
22 "objectivec:well_known_types_staleness_test"
23 "php:test_amalgamation_staleness"
24 "php:proto_staleness_test"
25 "ruby/ext/google/protobuf_c:test_amalgamation_staleness"
26 "upb/cmake:test_generated_files"
27 "upb/reflection:descriptor_upb_proto_staleness_test"
28 "upb_generator:plugin_upb_proto_staleness_test"
31 # Run and fix all staleness tests.
32 for test in ${STALENESS_TESTS[@]}; do
33 ${BazelBin} test $test "$@" || ./bazel-bin/${test%%:*}/${test#*:} --fix
37 # This doesn't currently have Bazel staleness tests, but there's an existing
38 # shell script that generates everything required. The output files are stable,
39 # so just regenerating in place should be harmless.
40 ${BazelBin} build src
/google
/protobuf
/compiler
:protoc
"$@"
41 (export PROTOC
=$PWD/bazel-bin
/protoc
&& cd csharp
&& .
/generate_protos.sh
)