summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Lund <lund@research.att.com>2017-03-04 14:23:29 +0000
committerCarsten Lund <lund@research.att.com>2017-03-04 14:37:42 +0000
commit64f2558ecc29b6e506f4b7e9b35173d01b96bb1b (patch)
tree54c9018e9ffb68620138ce75ee3a31824c8ff4a7
parent5a530b7ef8faff29b512e04b162febb296dea1ff (diff)
[DCAE-1] Change so version change script.
Change-Id: I6b0416c28bf60c4a1be5d90fdba4de4a17c4bf1e Signed-off-by: Carsten Lund <lund@research.att.com>
-rw-r--r--jjb/include-update-pom-versions.sh48
1 files changed, 33 insertions, 15 deletions
diff --git a/jjb/include-update-pom-versions.sh b/jjb/include-update-pom-versions.sh
index db1dd26cc..2d459d03b 100644
--- a/jjb/include-update-pom-versions.sh
+++ b/jjb/include-update-pom-versions.sh
@@ -10,24 +10,42 @@ fi
## will setup variable release_version
source ./version.properties
-VERSION=$release_version
+RELEASE_VERSION=$release_version
-echo Changing POM version to $VERSION
+echo Changing POM version to $RELEASE_VERSION
-## handle POM files with no parent
+## handle POM
for file in $(find . -name pom.xml); do
- if [ "$(grep -c '<parent>' $file)" == "0" ]; then
- echo Updating version in $file to $VERSION
- (
- cd $(dirname $file)
- ${MVN} versions:set versions:commit \
- -DnewVersion=$VERSION \
- -DprocessDependencies=false
- )
- grep version $file
- echo DONE $file
+ VERSION=$(xpath -q -e '//project/version/text()' $file)
+ PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
+ echo before changes VERSION=$VERSION PVERSION=$PVERSION file=$file
+ if [ "$VERSION" != "" ]; then
+ awk -v v=$RELEASE_VERSION '
+ /<version>/ {
+ if (! done) {
+ sub(/<version>.*</,"<version>" v "<",$0)
+ done = 1
+ }
+ }
+ { print $0 }
+ ' $file > $file.tmp
+ mv $file.tmp $file
fi
+ if [ "$PVERSION" != "" ]; then
+ awk -v v=$RELEASE_VERSION '
+ /<version>/ {
+ if (parent && ! done) {
+ sub(/<version>.*</,"<version>" v "<",$0)
+ done = 1
+ }
+ }
+ /<parent>/ { parent = 1 }
+ { print $0 }
+ ' $file > $file.tmp
+ mv $file.tmp $file
+ fi
+ VERSION=$(xpath -q -e '//project/version/text()' $file)
+ PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
+ echo after changes VERSION=$VERSION PVERSION=$PVERSION file=$file
done
-find . -name pom.xml.versionsBackup -delete
-