@@ -32,22 +32,39 @@ bazel run --action_env=GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes \
3232 --update_ci=false \
3333 --config_file=" ${PWD} /generator/integration_tests/golden_config.textproto"
3434
35- io::log_h2 " Running the generator to update the generated libraries"
36- bazel run --action_env=GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes \
37- //generator:google-cloud-cpp-codegen -- \
38- --protobuf_proto_path=" ${bazel_output_base} " /external/com_google_protobuf/src \
39- --googleapis_proto_path=" ${bazel_output_base} " /external/com_google_googleapis \
40- --output_path=" ${PROJECT_ROOT} " \
41- --config_file=" ${PROJECT_ROOT} /generator/generator_config.textproto"
42-
43- # TODO(#5821): The generator should run clang-format on its output files itself
44- # so we don't need this extra step.
45- io::log_h2 " Formatting generated code"
46- git ls-files -z -- ' *.h' ' *.cc' |
47- xargs -P " $( nproc) " -n 1 -0 clang-format -i
48-
49- io::log_h2 " Updating protobuf lists/deps"
50- external/googleapis/update_libraries.sh
35+ if [ -z " ${GENERATE_GOLDEN_ONLY} " ]; then
36+ io::log_h2 " Running the generator to update the generated libraries"
37+ bazel run --action_env=GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes \
38+ //generator:google-cloud-cpp-codegen -- \
39+ --protobuf_proto_path=" ${bazel_output_base} " /external/com_google_protobuf/src \
40+ --googleapis_proto_path=" ${bazel_output_base} " /external/com_google_googleapis \
41+ --output_path=" ${PROJECT_ROOT} " \
42+ --config_file=" ${PROJECT_ROOT} /generator/generator_config.textproto"
43+ else
44+ io::log_red " Skipping update of generated libraries."
45+ fi
46+
47+ if [ -z " ${GENERATE_GOLDEN_ONLY} " ]; then
48+ # TODO(#5821): The generator should run clang-format on its output files itself
49+ # so we don't need this extra step.
50+ io::log_h2 " Formatting generated code"
51+ git ls-files -z -- ' *.h' ' *.cc' |
52+ xargs -P " $( nproc) " -n 1 -0 clang-format -i
53+ else
54+ io::log_red " Only formatting generated golden code."
55+ git ls-files -z -- ' generator/integration_tests/golden/internal/*.h' \
56+ ' generator/integration_tests/golden/*.h' \
57+ ' generator/integration_tests/golden/internal/*.cc' \
58+ ' generator/integration_tests/golden/*.cc' |
59+ xargs -P " $( nproc) " -n 1 -0 clang-format -i
60+ fi
61+
62+ if [ -z " ${GENERATE_GOLDEN_ONLY} " ]; then
63+ io::log_h2 " Updating protobuf lists/deps"
64+ external/googleapis/update_libraries.sh
65+ else
66+ io::log_red " Skipping update of protobuf lists/deps."
67+ fi
5168
5269# This build should fail if any generated files differ from what was checked
5370# in. We only look in the google/ directory so that the build doesn't fail if
0 commit comments