summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/updParentVersion.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/updParentVersion.sh b/tools/updParentVersion.sh
new file mode 100755
index 00000000..8740a89c
--- /dev/null
+++ b/tools/updParentVersion.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+updatePom() {
+cat $1 | xsltproc -o $1 /tmp/rebase-pom.xslt -
+}
+
+export -f updatePom
+
+# Create XSLT script
+newVersion=$2
+echo "newVersion is $newVersion"
+cat <<END > /tmp/rebase-pom.xslt
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:pom="http://maven.apache.org/POM/4.0.0"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ exclude-result-prefixes="pom">
+ <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
+
+ <!-- Copy everything that does not match a rewrite rule -->
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" />
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- Change ccsdk parent pom version -->
+ <xsl:template match="//pom:parent[pom:groupId='org.onap.ccsdk.parent']/pom:version">
+ <version>$newVersion</version>
+ </xsl:template>
+</xsl:stylesheet>
+END
+
+if [ $# -ne 2 ]
+then
+ echo "Usage: $0 <directory> <version>"
+ exit 1
+fi
+
+find $1 -name pom.xml -exec bash -c 'updatePom "$0" $1' '{}' \;