blob: c96693ac10199d7d27fc1f862a1f4c60c09f4e48 [file] [log] [blame]
Mike Kruskalf5895152022-12-20 18:43:30 -08001#!/bin/bash
2
3# This script runs the staleness tests and uses them to update any stale
4# generated files.
5
6set -ex
7
Mike Kruskalc399aec2023-02-06 21:09:07 -08008echo "::group::Regenerate stale files"
9
Mike Kruskalf5895152022-12-20 18:43:30 -080010# Cd to the repo root.
11cd $(dirname -- "$0")
12
Mike Kruskalf1e746c2023-02-02 17:42:30 -080013readonly BazelBin="${BAZEL:-bazel} ${BAZEL_STARTUP_FLAGS}"
14
Mike Kruskalf5895152022-12-20 18:43:30 -080015# Run and fix all staleness tests.
Mike Kruskalf1e746c2023-02-02 17:42:30 -080016${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 Bote2aa06e2023-02-10 14:11:22 -080018${BazelBin} test objectivec:well_known_types_staleness_test "$@" || ./bazel-bin/objectivec/well_known_types_staleness_test --fix
Adam Cozzette0937be12023-08-29 17:49:57 -070019${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 Cozzette7286ffc2023-09-12 13:06:39 -070021${BazelBin} test upb/cmake:test_generated_files "$@" || ./bazel-bin/upb/cmake/test_generated_files --fix
Protobuf Team Bot4e69c502023-01-16 02:28:39 -080022
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 Kruskalf1e746c2023-02-02 17:42:30 -080027${BazelBin} build src/google/protobuf/compiler:protoc "$@"
Protobuf Team Bot4e69c502023-01-16 02:28:39 -080028(export PROTOC=$PWD/bazel-bin/protoc && cd csharp && ./generate_protos.sh)
Mike Kruskalc399aec2023-02-06 21:09:07 -080029
30echo "::endgroup::"