Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Webster2013-02-20 21:01:02 -0500
committerPaul Webster2013-02-20 21:02:22 -0500
commitbfdfdcc68308ff751d8311c5c5f77e78c4cdf99e (patch)
tree447e6a5de4719ac3c69b6a202fcf561a716d206f /scripts
parent148655768c455f3a2e3e2071f51493d7004c4fff (diff)
downloadeclipse.platform.releng.aggregator-bfdfdcc68308ff751d8311c5c5f77e78c4cdf99e.tar.gz
eclipse.platform.releng.aggregator-bfdfdcc68308ff751d8311c5c5f77e78c4cdf99e.tar.xz
eclipse.platform.releng.aggregator-bfdfdcc68308ff751d8311c5c5f77e78c4cdf99e.zip
Bug 397850 - [CBI] use the correct group IDs for all artifacts
Record the scripts that I used to update groupIds
Diffstat (limited to 'scripts')
-rw-r--r--scripts/xsl/fix-feature-pom.xsl48
-rw-r--r--scripts/xsl/fix-pom.xsl47
-rwxr-xr-xscripts/xsl/groupId.sh35
-rw-r--r--scripts/xsl/run-xsl.xml9
4 files changed, 139 insertions, 0 deletions
diff --git a/scripts/xsl/fix-feature-pom.xsl b/scripts/xsl/fix-feature-pom.xsl
new file mode 100644
index 00000000..4d28934f
--- /dev/null
+++ b/scripts/xsl/fix-feature-pom.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xs="http://www.w3.org/2001/XMLSchema"
+xmlns:my="http://maven.apache.org/POM/4.0.0"
+exclude-result-prefixes="my xs"
+version="2.0">
+ <!--xsl:output omit-xml-declaration="yes" indent="yes"/>
+ <xsl:output indent="yes"/>
+ <xsl:strip-space elements="*"/-->
+<xsl:output method="xml"
+ encoding="UTF-8"/>
+
+<xsl:template name="group-id">
+ <xsl:param name="pText" select="."/>
+ <xsl:param name="pCount" select="0"/>
+ <xsl:if test="$pCount &lt; 3">
+ <xsl:value-of select="substring-before(concat($pText, '.'), '.')"/>
+ <xsl:if test="$pCount &lt; 2"><xsl:text>.</xsl:text></xsl:if>
+ <xsl:call-template name="group-id">
+ <xsl:with-param name="pText" select="substring-after($pText, '.')"/>
+ <xsl:with-param name="pCount" select="$pCount + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$pCount = 3"><xsl:text>.feature</xsl:text></xsl:if>
+</xsl:template>
+
+<xsl:template match="/my:project/my:groupId">
+ <groupId xmlns="http://maven.apache.org/POM/4.0.0"><xsl:call-template name="group-id">
+<xsl:with-param name="pText" select="/my:project/my:artifactId/text()"/>
+<xsl:with-param name="pCount" select="0"/>
+</xsl:call-template></groupId>
+</xsl:template>
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!--xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*">
+ <xsl:sort select="name()" />
+ <xsl:sort select="@*" />
+ </xsl:apply-templates>
+ </xsl:copy>
+</xsl:template-->
+</xsl:stylesheet>
diff --git a/scripts/xsl/fix-pom.xsl b/scripts/xsl/fix-pom.xsl
new file mode 100644
index 00000000..e065d49b
--- /dev/null
+++ b/scripts/xsl/fix-pom.xsl
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:xs="http://www.w3.org/2001/XMLSchema"
+xmlns:my="http://maven.apache.org/POM/4.0.0"
+exclude-result-prefixes="my xs"
+version="2.0">
+ <!--xsl:output omit-xml-declaration="yes" indent="yes"/>
+ <xsl:output indent="yes"/>
+ <xsl:strip-space elements="*"/-->
+<xsl:output method="xml"
+ encoding="UTF-8"/>
+
+<xsl:template name="group-id">
+ <xsl:param name="pText" select="."/>
+ <xsl:param name="pCount" select="0"/>
+ <xsl:if test="$pCount &lt; 3">
+ <xsl:value-of select="substring-before(concat($pText, '.'), '.')"/>
+ <xsl:if test="$pCount &lt; 2"><xsl:text>.</xsl:text></xsl:if>
+ <xsl:call-template name="group-id">
+ <xsl:with-param name="pText" select="substring-after($pText, '.')"/>
+ <xsl:with-param name="pCount" select="$pCount + 1"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="/my:project/my:groupId">
+ <groupId xmlns="http://maven.apache.org/POM/4.0.0"><xsl:call-template name="group-id">
+<xsl:with-param name="pText" select="/my:project/my:artifactId/text()"/>
+<xsl:with-param name="pCount" select="0"/>
+</xsl:call-template></groupId>
+</xsl:template>
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!--xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="node()|@*">
+ <xsl:sort select="name()" />
+ <xsl:sort select="@*" />
+ </xsl:apply-templates>
+ </xsl:copy>
+</xsl:template-->
+</xsl:stylesheet>
diff --git a/scripts/xsl/groupId.sh b/scripts/xsl/groupId.sh
new file mode 100755
index 00000000..9d8d3e14
--- /dev/null
+++ b/scripts/xsl/groupId.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+ECLIPSE=/opt/local/e4-self/R421/eclipse/eclipse
+
+if [ $# -gt 0 ]; then
+ ECLIPSE="$1" ; shift
+fi
+
+find * -name pom.xml -print0 | xargs -0 grep eclipse-plugin | cut -f1 -d: | sort -u >/tmp/t1_$$.txt
+
+for POM in $( cat /tmp/t1_$$.txt ); do
+$ECLIPSE -noSplash \
+-application org.eclipse.ant.core.antRunner -v \
+-buildfile run-xsl.xml \
+-Dfile.sheet="fix-pom.xsl" \
+-Dfile.in="$(pwd)/$POM" \
+-Dfile.out="$(pwd)/${POM}.out"
+xmllint --format "${POM}.out" >"${POM}"
+rm "${POM}.out"
+done
+
+find * -name pom.xml -print0 | xargs -0 grep eclipse-feature | cut -f1 -d: | sort -u >/tmp/t1_$$.txt
+
+for POM in $( cat /tmp/t1_$$.txt ); do
+$ECLIPSE -noSplash \
+-application org.eclipse.ant.core.antRunner -v \
+-buildfile run-xsl.xml \
+-Dfile.sheet="fix-feature-pom.xsl" \
+-Dfile.in="$(pwd)/$POM" \
+-Dfile.out="$(pwd)/${POM}.out"
+xmllint --format "${POM}.out" >"${POM}"
+rm "${POM}.out"
+done
+
+
diff --git a/scripts/xsl/run-xsl.xml b/scripts/xsl/run-xsl.xml
new file mode 100644
index 00000000..926cde12
--- /dev/null
+++ b/scripts/xsl/run-xsl.xml
@@ -0,0 +1,9 @@
+<project name="Run stylesheet" default="all" basedir=".">
+ <property name="file.in" value="content.xml"/>
+ <property name="file.out" value="out_${file.in}"/>
+ <property name="file.sheet" value="sort.xsl"/>
+
+ <target name="all">
+ <xslt in="${file.in}" out="${file.out}" style="${file.sheet}"/>
+ </target>
+</project>

Back to the top