Skip to content

Commit

Permalink
MULE-12945: Branch all the repositories for Mozart Beta (mulesoft#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
anosenzo authored Jul 20, 2017
1 parent 846bf7c commit 0d81735
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions update_deps_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

set -o nounset

updatePropertiesVersion() {
VERSION_TO_PROPERTY="$1"
POM_PROPERTY_PATH="$2"

# PROPERTIES argument should be passed as a literal "arrayName[@]" without $ because here using the ! it is double expanded
# to obtiain the values and declare again the array.
PROPERTIES=("${!3}")

echo "Updating deps in pom: $POM_PROPERTY_PATH"

for PROPERTY_NAME in "${PROPERTIES[@]}"
do

perl -0777 -i -pe "s/(<properties>.*<$PROPERTY_NAME)(.*)(\/$PROPERTY_NAME>.*<\/properties>)/\${1}>$VERSION_TO_PROPERTY<\${3}/s" "$POM_PROPERTY_PATH"
echo "- Updating property '$PROPERTY_NAME' version to '$VERSION_TO_PROPERTY'"

done
}

updateParentVersion() {
VERSION_TO="$1"
POM_PROPERTY_PATH="$2"

echo "Updating version to $VERSION_TO..."
perl -0777 -i -pe "s/(<parent>.*<version)(.*)(\/version>.*<\/parent>)/\${1}>$VERSION_TO<\${3}/s" "$POM_PROPERTY_PATH"
}

VERSION_TO_DEPS=$1

updateParentVersion "$VERSION_TO_DEPS" pom.xml

0 comments on commit 0d81735

Please sign in to comment.