Skip to content

Commit 0a7e5d3

Browse files
committed
build
1 parent 92f4403 commit 0a7e5d3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

prometheus-metrics-exposition-formats/generate-protobuf.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ mkdir -p $PROTO_DIR
2020
OLD_PACKAGE=$(sed -nE 's/import (io.prometheus.metrics.expositionformats.generated.*).Metrics;/\1/p' src/main/java/io/prometheus/metrics/expositionformats/internal/PrometheusProtobufWriterImpl.java)
2121
PACKAGE="io.prometheus.metrics.expositionformats.generated.com_google_protobuf_${PROTOBUF_VERSION_STRING}"
2222

23-
if [[ $OLD_PACKAGE != "$PACKAGE" ]]; then
24-
echo "Replacing package $OLD_PACKAGE with $PACKAGE in all java files"
25-
find .. -type f -name "*.java" -exec sed -i "s/$OLD_PACKAGE/$PACKAGE/g" {} +
23+
if [[ $OLD_PACKAGE == "$PACKAGE" ]]; then
24+
echo "No new protobuf version detected. Skipping protobuf generation."
25+
exit 0
2626
fi
2727

28+
echo "Replacing package $OLD_PACKAGE with $PACKAGE in all java files"
29+
find .. -type f -name "*.java" -exec sed -i "s/$OLD_PACKAGE/$PACKAGE/g" {} +
30+
2831
curl -sL https://raw.githubusercontent.com/prometheus/client_model/master/io/prometheus/client/metrics.proto -o $PROTO_DIR/metrics.proto
2932

3033
sed -i "s/java_package = \"io.prometheus.client\"/java_package = \"$PACKAGE\"/" $PROTO_DIR/metrics.proto

0 commit comments

Comments
 (0)