Use git checkout to rever changes

Closes #15644
This commit is contained in:
Pedro Igor 2022-12-15 16:20:30 -03:00
parent 857b02be63
commit 4d00da2df7

View file

@ -15,12 +15,22 @@
# limitations under the License. # limitations under the License.
# #
function revertChanges() {
echo "Reverting version changes."
git checkout ../.
}
if [ "$1" == "-h" ]; then if [ "$1" == "-h" ]; then
echo "Change the Quarkus version to a specific version." echo "Change the Quarkus version to a specific version."
echo "Usage: set-quarkus-version <version>" echo "Usage: set-quarkus-version <version>"
exit exit
fi fi
if [ "$1" == "--revert" ]; then
revertChanges
exit
fi
DEFAULT_QUARKUS_VERSION="999-SNAPSHOT" 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"
@ -39,7 +49,6 @@ fi
QUARKUS_BOM=$(curl -s "$QUARKUS_BOM_URL") QUARKUS_BOM=$(curl -s "$QUARKUS_BOM_URL")
echo "Setting Quarkus version: $QUARKUS_VERSION" echo "Setting Quarkus version: $QUARKUS_VERSION"
$(mvn -f ../pom.xml versions:revert 1> /dev/null)
$(mvn versions:set-property -f ../pom.xml -Dproperty=quarkus.version -DnewVersion="$QUARKUS_VERSION" 1> /dev/null) $(mvn versions:set-property -f ../pom.xml -Dproperty=quarkus.version -DnewVersion="$QUARKUS_VERSION" 1> /dev/null)
DEPENDENCIES_LIST="resteasy jackson-bom hibernate-orm mysql-jdbc postgresql-jdbc microprofile-metrics-api wildfly-common wildfly-elytron" DEPENDENCIES_LIST="resteasy jackson-bom hibernate-orm mysql-jdbc postgresql-jdbc microprofile-metrics-api wildfly-common wildfly-elytron"
@ -54,7 +63,8 @@ for dependency in $DEPENDENCIES_LIST; do
exit 1 exit 1
fi fi
echo "Setting $VERSION to $dependency" echo "Setting $VERSION to $dependency"
$(mvn versions:set-property -pl . -Dproperty="$dependency".version -DnewVersion="$VERSION" 1> /dev/null) mvn versions:set-property -f ../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
done done
echo "" echo ""