blob: ace2350a2b19f15ed213431dfbf3a0c9a6bc6e73 [file] [log] [blame]
Dan Timoneya44e0b42017-10-06 09:52:29 -04001#!/bin/bash
2
3## Will update POM in workspace with release version
4
5if [ ! -e version.properties ]; then
6 echo "Missing version.properties"
7 exit 1
8fi
9
10## will setup variable release_version
11source ./version.properties
12
13RELEASE_VERSION=$release_version
14
15echo Changing POM version to $RELEASE_VERSION
16
17## handle POM
18for file in $(find . -name pom.xml); do
19 VERSION=$(xpath -q -e '//project/version/text()' $file)
20 PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
21 echo before changes VERSION=$VERSION PVERSION=$PVERSION file=$file
22 if [ "$VERSION" != "" ]; then
23 awk -v v=$RELEASE_VERSION '
24 /<version>/ {
25 if (! done) {
26 sub(/<version>.*</,"<version>" v "<",$0)
27 done = 1
28 }
29 }
30 { print $0 }
31 ' $file > $file.tmp
32 mv $file.tmp $file
33 fi
34 VERSION=$(xpath -q -e '//project/version/text()' $file)
35 PVERSION=$(xpath -q -e '//project/parent/version/text()' $file)
36 echo after changes VERSION=$VERSION PVERSION=$PVERSION file=$file
37done
38