[quarkus-next] Align dependency versions before build (#32467)

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
This commit is contained in:
Peter Zaoral 2024-09-05 09:16:55 +02:00 committed by GitHub
parent d28adcb81b
commit 83a57892ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 10 deletions

View file

@ -50,8 +50,7 @@ add_repository "pom.xml" "repository"
add_repository "quarkus/pom.xml" "pluginRepository" add_repository "quarkus/pom.xml" "pluginRepository"
add_repository "operator/pom.xml" "pluginRepository" add_repository "operator/pom.xml" "pluginRepository"
./mvnw -B versions:set-property -Dproperty=quarkus.version -DnewVersion=999-SNAPSHOT ./quarkus/scripts/set-quarkus-version.sh
./mvnw -B versions:set-property -Dproperty=quarkus.build.version -DnewVersion=999-SNAPSHOT
git commit -am "Set quarkus version to 999-SNAPSHOT" git commit -am "Set quarkus version to 999-SNAPSHOT"
snapshot_version_hash=$(git log origin/quarkus-next --grep="Set quarkus version to 999-SNAPSHOT" --format="%H" -n 1) snapshot_version_hash=$(git log origin/quarkus-next --grep="Set quarkus version to 999-SNAPSHOT" --format="%H" -n 1)

View file

@ -31,10 +31,16 @@ if [ "$1" == "--revert" ]; then
exit exit
fi fi
DEFAULT_QUARKUS_VERSION="999.0.0-SNAPSHOT" SCRIPT_DIR=$(dirname "$0")
DEFAULT_QUARKUS_VERSION="999-SNAPSHOT"
QUARKUS_VERSION=${1:-"$DEFAULT_QUARKUS_VERSION"} QUARKUS_VERSION=${1:-"$DEFAULT_QUARKUS_VERSION"}
QUARKUS_BRANCH="$QUARKUS_VERSION" QUARKUS_BRANCH="$QUARKUS_VERSION"
EXCLUDED_DEPENDENCIES=(
"infinispan"
"jakarta.mail"
)
if [ "$QUARKUS_BRANCH" == "$DEFAULT_QUARKUS_VERSION" ]; then if [ "$QUARKUS_BRANCH" == "$DEFAULT_QUARKUS_VERSION" ]; then
QUARKUS_BRANCH="main" QUARKUS_BRANCH="main"
fi fi
@ -49,23 +55,31 @@ fi
QUARKUS_BOM=$(curl -f -s "$QUARKUS_BOM_URL") QUARKUS_BOM=$(curl -f -s "$QUARKUS_BOM_URL")
echo "Setting Quarkus version: $QUARKUS_VERSION" echo "Setting Quarkus version: $QUARKUS_VERSION"
$(mvn versions:set-property -f ../pom.xml -Dproperty=quarkus.version,quarkus.build.version -DnewVersion="$QUARKUS_VERSION" 1> /dev/null)
DEPENDENCIES_LIST=$(grep -oP '(?<=\</).*(?=\.version\>)' ../pom.xml) $SCRIPT_DIR/../mvnw -B versions:set-property -f $SCRIPT_DIR/../pom.xml -Dproperty=quarkus.version -DnewVersion="$QUARKUS_VERSION" 1> /dev/null
$SCRIPT_DIR/../mvnw -B versions:set-property -f $SCRIPT_DIR/../pom.xml -Dproperty=quarkus.build.version -DnewVersion="$QUARKUS_VERSION" 1> /dev/null
DEPENDENCIES_LIST=$(grep -oP '(?<=\</).*(?=\.version\>)' "$SCRIPT_DIR/../pom.xml")
echo "Changing dependencies: $DEPENDENCIES_LIST" echo "Changing dependencies: $DEPENDENCIES_LIST"
$(mvn -f ./pom.xml versions:revert 1> /dev/null) $SCRIPT_DIR/../mvnw -f $SCRIPT_DIR/pom.xml versions:revert 1> /dev/null
for dependency in $DEPENDENCIES_LIST; do for dependency in $DEPENDENCIES_LIST; do
for excluded in "${EXCLUDED_DEPENDENCIES[@]}"; do
if [[ $dependency =~ $excluded ]]; then
echo "Skipping $dependency because it is listed as an excluded dependency"
continue 2
fi
done
VERSION=$(grep -oP "(?<=<$dependency.version>).*(?=</$dependency.version)" <<< "$QUARKUS_BOM") VERSION=$(grep -oP "(?<=<$dependency.version>).*(?=</$dependency.version)" <<< "$QUARKUS_BOM")
if [ "$VERSION" == "" ]; then if [ "$VERSION" == "" ]; then
echo "Failed to resolve version for dependency '$dependency'" echo "Failed to resolve version for dependency '$dependency'"
continue; continue
fi fi
echo "Setting $dependency to $VERSION" echo "Setting $dependency to $VERSION"
mvn versions:set-property -f ../pom.xml -Dproperty="$dependency".version -DnewVersion="$VERSION" 1> /dev/null $SCRIPT_DIR/../mvnw versions:set-property -f $SCRIPT_DIR/../pom.xml -Dproperty="$dependency".version -DnewVersion="$VERSION" 1> /dev/null
mvn versions:set-property -f ./pom.xml -Dproperty="$dependency".version -DnewVersion="$VERSION" 1> /dev/null $SCRIPT_DIR/../mvnw versions:set-property -f $SCRIPT_DIR/pom.xml -Dproperty="$dependency".version -DnewVersion="$VERSION" 1> /dev/null
done done
echo "" echo ""
echo "Done!" echo "Done!"