-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include shaded protobuf directly (#1063)
* include shaded protobuf directly Signed-off-by: Gregor Zeitlinger <[email protected]> * include shaded protobuf directly Signed-off-by: Gregor Zeitlinger <[email protected]> � Conflicts: � prometheus-metrics-shaded-dependencies/pom.xml * remove shaded deps Signed-off-by: Gregor Zeitlinger <[email protected]> * format Signed-off-by: Gregor Zeitlinger <[email protected]> * fix shading Signed-off-by: Gregor Zeitlinger <[email protected]> * fix shading Signed-off-by: Gregor Zeitlinger <[email protected]> * fix shading Signed-off-by: Gregor Zeitlinger <[email protected]> * re-enable shading Signed-off-by: Gregor Zeitlinger <[email protected]> * re-enable shading Signed-off-by: Gregor Zeitlinger <[email protected]> * only build proto on CI Signed-off-by: Gregor Zeitlinger <[email protected]> * only build proto on CI Signed-off-by: Gregor Zeitlinger <[email protected]> * update protobuf Signed-off-by: Gregor Zeitlinger <[email protected]> * update protobuf Signed-off-by: Gregor Zeitlinger <[email protected]> * update protobuf Signed-off-by: Gregor Zeitlinger <[email protected]> * update protobuf Signed-off-by: Gregor Zeitlinger <[email protected]> --------- Signed-off-by: Gregor Zeitlinger <[email protected]>
- Loading branch information
1 parent
cdcf2d2
commit c9bb30b
Showing
22 changed files
with
2,114 additions
and
2,773 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 24 additions & 10 deletions
34
prometheus-metrics-exposition-formats/generate-protobuf.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -euo pipefail | ||
|
||
# We use the shaded protobuf JAR from the protobuf-shaded module. | ||
# I could not figure out how to use a protoc Maven plugin to use the shaded module, so I ran this command to generate the sources manually. | ||
|
||
# The version string must be the same as in protobuf-shaded/pom.xml. | ||
#export PROTOBUF_VERSION_STRING="3_21_7" | ||
export PROTOBUF_VERSION_STRING="3_25_3" | ||
TARGET_DIR=$1 | ||
PROTO_DIR=src/main/protobuf | ||
PROTOBUF_VERSION_STRING=$2 | ||
|
||
rm -rf src/main/protobuf/* | ||
curl -sL https://raw.githubusercontent.com/prometheus/client_model/master/io/prometheus/client/metrics.proto -o src/main/protobuf/metrics.proto | ||
sed -i "s/java_package = \"io.prometheus.client\"/java_package = \"io.prometheus.metrics.expositionformats.generated.com_google_protobuf_${PROTOBUF_VERSION_STRING}\"/" src/main/protobuf/metrics.proto | ||
rm -rf src/main/generated/* | ||
protoc --java_out src/main/generated src/main/protobuf/metrics.proto | ||
sed -i "s/com\\.google\\.protobuf/io.prometheus.metrics.shaded.com_google_protobuf_${PROTOBUF_VERSION_STRING}/g" "src/main/generated/io/prometheus/metrics/expositionformats/generated/com_google_protobuf_${PROTOBUF_VERSION_STRING}/Metrics.java" | ||
echo "Generating protobuf sources for version $PROTOBUF_VERSION_STRING in $TARGET_DIR" | ||
|
||
rm -rf TARGET_DIR || true | ||
mkdir -p $TARGET_DIR | ||
rm -rf $PROTO_DIR || true | ||
mkdir -p $PROTO_DIR | ||
|
||
curl -sL https://raw.githubusercontent.com/prometheus/client_model/master/io/prometheus/client/metrics.proto -o $PROTO_DIR/metrics.proto | ||
sed -i "s/java_package = \"io.prometheus.client\"/java_package = \"io.prometheus.metrics.expositionformats.generated.com_google_protobuf_${PROTOBUF_VERSION_STRING}\"/" $PROTO_DIR/metrics.proto | ||
protoc --java_out $TARGET_DIR $PROTO_DIR/metrics.proto | ||
|
||
# stop the build if there class is not up-to-date | ||
# show local changes | ||
DIFF=$(git diff) | ||
if [[ ${REQUIRE_PROTO_UP_TO_DATE:-false} == "true" && -n "$DIFF" ]]; then | ||
echo "Generated protobuf sources are not up-to-date. Please run 'PROTO_GENERATION=true mvn clean install' and commit the changes." | ||
echo "Local changes:" | ||
echo "$DIFF" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
protobuf/ |
Oops, something went wrong.