Accepting request 963092 from Java:packages

Build with source/target levels 8 + rewamp the build system a bit

OBS-URL: https://build.opensuse.org/request/show/963092
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/jaxen-bootstrap?expand=0&rev=15
This commit is contained in:
Dominique Leuenberger 2022-03-28 14:59:18 +00:00 committed by Git OBS Bridge
commit 5de8942719
8 changed files with 56 additions and 547 deletions

View File

@ -8,43 +8,25 @@
<property file="${user.home}/build.properties"></property> <property file="${user.home}/build.properties"></property>
<!--Build properties--> <!--Build properties-->
<property name="defaulttargetdir" value="${basedir}/target"></property> <property name="defaulttargetdir" value="${basedir}/target"></property>
<property name="libdir" value="${user.home}/.maven/repository"></property> <property name="libdir" value="lib"></property>
<property name="classesdir" value="${basedir}/target/classes"></property> <property name="classesdir" value="${basedir}/target/classes"></property>
<property name="testclassesdir" value="${basedir}/target/test-classes"></property> <property name="testclassesdir" value="${basedir}/target/test-classes"></property>
<property name="testreportdir" value="${basedir}/target/test-reports"></property> <property name="testreportdir" value="${basedir}/target/test-reports"></property>
<property name="distdir" value="${basedir}/dist"></property> <property name="distdir" value="${basedir}/dist"></property>
<property name="javadocdir" value="${basedir}/dist/docs/api"></property> <property name="javadocdir" value="${basedir}/dist/docs/api"></property>
<property name="final.name" value="jaxen-1.1-beta-7"></property> <property name="final.name" value="jaxen-1.1-beta-7"></property>
<property name="proxy.host" value=""></property>
<property name="proxy.port" value=""></property>
<property name="proxy.username" value=""></property>
<property name="proxy.password" value=""></property>
<path id="build.classpath"> <path id="build.classpath">
<pathelement location="${libdir}/JPP/jars/dom4j.jar"></pathelement> <fileset dir="${libdir}">
<pathelement location="${libdir}/JPP/jars/jdom.jar"></pathelement> <include name="**/*.jar"/>
<pathelement location="${libdir}/JPP/jars/xml-commons-apis.jar"></pathelement> </fileset>
<pathelement location="${libdir}/JPP/jars/xerces-j2.jar"></pathelement>
<pathelement location="${libdir}/JPP/jars/xom.jar"></pathelement>
<pathelement location="${libdir}/JPP/jars/junit.jar"></pathelement>
</path> </path>
<target name="init" description="o Initializes some properties"> <target name="init" description="o Initializes some properties">
<mkdir dir="${libdir}"></mkdir> <mkdir dir="${libdir}"></mkdir>
<condition property="noget">
<equals arg2="only" arg1="${build.sysclasspath}"></equals>
</condition>
<!--Test if JUNIT is present in ANT classpath--> <!--Test if JUNIT is present in ANT classpath-->
<available property="Junit.present" classname="junit.framework.Test"></available> <available property="Junit.present" classname="junit.framework.Test"></available>
<!--Test if user defined a proxy--> <!--Test if user defined a proxy-->
<condition property="useProxy">
<and>
<isset property="proxy.host"></isset>
<not>
<equals trim="true" arg2="" arg1="${proxy.host}"></equals>
</not>
</and>
</condition>
</target> </target>
<target name="compile" description="o Compile the code" depends="get-deps"> <target name="compile" description="o Compile the code">
<mkdir dir="${classesdir}"></mkdir> <mkdir dir="${classesdir}"></mkdir>
<javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html"> <javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
<src> <src>
@ -113,7 +95,7 @@
</fileset> </fileset>
</copy> </copy>
</target> </target>
<target name="javadoc" description="o Generate javadoc" depends="get-deps"> <target name="javadoc" description="o Generate javadoc">
<mkdir dir="${javadocdir}"></mkdir> <mkdir dir="${javadocdir}"></mkdir>
<tstamp> <tstamp>
<format pattern="2001-yyyy" property="year"></format> <format pattern="2001-yyyy" property="year"></format>
@ -126,68 +108,4 @@
</classpath> </classpath>
</javadoc> </javadoc>
</target> </target>
<target name="get-dep-dom4j.jar" description="o Download the dependency : dom4j.jar" unless="dom4j.jar" depends="init,setProxy,noProxy,get-custom-dep-dom4j.jar"> </project>
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/dom4j.jar" usetimestamp="true" ignoreerrors="true" src="file:/usr/share/maven/repository/JPP/jars/dom4j.jar"></get>
</target>
<target name="get-custom-dep-dom4j.jar" if="dom4j.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/dom4j.jar" usetimestamp="true" ignoreerrors="true" src="${dom4j.jar}"></get>
</target>
<target name="get-dep-jdom.jar" description="o Download the dependency : jdom.jar" unless="jdom.jar" depends="init,setProxy,noProxy,get-custom-dep-jdom.jar">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/jdom.jar" usetimestamp="true" ignoreerrors="true" src="file:/usr/share/maven/repository/JPP/jars/jdom.jar"></get>
</target>
<target name="get-custom-dep-jdom.jar" if="jdom.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/jdom.jar" usetimestamp="true" ignoreerrors="true" src="${jdom.jar}"></get>
</target>
<target name="get-dep-xmlParserAPIs.jar" description="o Download the dependency : xmlParserAPIs.jar" unless="xmlParserAPIs.jar" depends="init,setProxy,noProxy,get-custom-dep-xmlParserAPIs.jar">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/xml-commons-apis.jar" usetimestamp="true" ignoreerrors="true" src="file:/usr/share/maven/repository/JPP/jars/xml-commons-apis.jar"></get>
</target>
<target name="get-custom-dep-xmlParserAPIs.jar" if="xmlParserAPIs.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/xml-commons-apis.jar" usetimestamp="true" ignoreerrors="true" src="${xmlParserAPIs.jar}"></get>
</target>
<target name="get-dep-xercesImpl.jar" description="o Download the dependency : xercesImpl.jar" unless="xercesImpl.jar" depends="init,setProxy,noProxy,get-custom-dep-xercesImpl.jar">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/xerces-j2.jar" usetimestamp="true" ignoreerrors="true" src="file:/usr/share/maven/repository/JPP/jars/xerces-j2.jar"></get>
</target>
<target name="get-custom-dep-xercesImpl.jar" if="xercesImpl.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/xerces-j2.jar" usetimestamp="true" ignoreerrors="true" src="${xercesImpl.jar}"></get>
</target>
<target name="get-dep-xom.jar" description="o Download the dependency : xom.jar" unless="xom.jar" depends="init,setProxy,noProxy,get-custom-dep-xom.jar">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/xom.jar" usetimestamp="true" ignoreerrors="true" src="file:/usr/share/maven/repository/JPP/jars/xom.jar"></get>
</target>
<target name="get-custom-dep-xom.jar" if="xom.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/xom.jar" usetimestamp="true" ignoreerrors="true" src="${xom.jar}"></get>
</target>
<target name="get-dep-junit.jar" description="o Download the dependency : junit.jar" unless="junit.jar" depends="init,setProxy,noProxy,get-custom-dep-junit.jar">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/junit.jar" usetimestamp="true" ignoreerrors="true" src="file:/usr/share/maven/repository/JPP/jars/junit.jar"></get>
</target>
<target name="get-custom-dep-junit.jar" if="junit.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/JPP/jars/"></mkdir>
<get dest="${libdir}/JPP/jars/junit.jar" usetimestamp="true" ignoreerrors="true" src="${junit.jar}"></get>
</target>
<target name="get-deps" unless="noget" depends="get-dep-dom4j.jar,get-dep-jdom.jar,get-dep-xmlParserAPIs.jar,get-dep-xercesImpl.jar,get-dep-xom.jar,get-dep-junit.jar"></target>
<target name="setProxy" if="useProxy" depends="init">
<!--Proxy settings works only with a JDK 1.2 and higher.-->
<echo>Proxy used :</echo>
<echo>Proxy host [${proxy.host}]</echo>
<echo>Proxy port [${proxy.port}]</echo>
<echo>Proxy user [${proxy.username}]</echo>
<setproxy proxyuser="${proxy.username}" proxyport="${proxy.port}" proxypassword="${proxy.password}" proxyhost="${proxy.host}"></setproxy>
</target>
<target name="noProxy" unless="useProxy" depends="init">
<echo>Proxy not used.</echo>
</target>
<target name="install-maven">
<get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar"></get>
<unjar dest="${maven.home}" src="${user.home}/maven-install-latest.jar"></unjar>
</target>
</project>

View File

@ -1,91 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<depset>
<dependency>
<maven>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</maven>
<jpp>
<groupId>JPP</groupId>
<artifactId>dom4j</artifactId>
<jar>dom4j.jar</jar>
<version>1.6.1</version>
</jpp>
</dependency>
<dependency>
<maven>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
<url>http://jdom.org</url>
</maven>
<jpp>
<groupId>JPP</groupId>
<artifactId>jdom</artifactId>
<jar>jdom.jar</jar>
<version>1.0</version>
<url>http://jdom.org</url>
</jpp>
</dependency>
<dependency>
<maven>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
</maven>
<jpp>
<groupId>JPP</groupId>
<artifactId>xercesImpl</artifactId>
<jar>xerces-j2.jar</jar>
<version>2.6.2</version>
</jpp>
</dependency>
<dependency>
<maven>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.3.02</version>
</maven>
<jpp>
<groupId>JPP</groupId>
<artifactId>xml-apis</artifactId>
<jar>xml-commons-jaxp-1.3-apis.jar</jar>
<version>1.3.02</version>
</jpp>
</dependency>
<dependency>
<maven>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.6.2</version>
</maven>
<jpp>
<groupId>JPP</groupId>
<artifactId>xmlParserAPIs</artifactId>
<jar>xml-commons-jaxp-1.3-apis.jar</jar>
<version>2.6.2</version>
</jpp>
</dependency>
<dependency>
<maven>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.0b3</version>
</maven>
<jpp>
<groupId>JPP</groupId>
<artifactId>xom</artifactId>
<jar>xom.jar</jar>
<version>1.0b3</version>
</jpp>
</dependency>
<add>
<dependency>
<groupId>JPP</groupId>
<artifactId>junit</artifactId>
<jar>junit.jar</jar>
</dependency>
</add>
</depset>

View File

@ -1,60 +0,0 @@
--- project.xml.sav 2006-12-31 21:50:30.000000000 +0100
+++ project.xml 2007-05-01 13:04:28.000000000 +0200
@@ -237,7 +237,9 @@
<report>maven-jdepend-plugin</report>
<report>maven-checkstyle-plugin</report>
<report>maven-cobertura-plugin</report>
+<!--
<report>maven-changelog-plugin</report>
+-->
<report>maven-developer-activity-plugin</report>
<report>maven-file-activity-plugin</report>
<report>maven-license-plugin</report>
@@ -287,6 +289,7 @@
<version>1.0</version>
</dependency>
+<!--
<dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-cobertura-plugin</artifactId>
@@ -294,12 +297,12 @@
<type>plugin</type>
</dependency>
-<!-- <dependency>
+ <dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-latex-plugin</artifactId>
<version>1.5</version>
<type>plugin</type>
- </dependency> -->
+ </dependency>
<dependency>
<groupId>maven-plugins</groupId>
@@ -308,19 +311,20 @@
<type>plugin</type>
</dependency>
-<!-- <dependency>
+ <dependency>
<groupId>lint4j</groupId>
<artifactId>jutils-lint4j-plugin</artifactId>
<version>1.1</version>
<type>plugin</type>
- </dependency> -->
+ </dependency>
- <!-- <dependency>
+ <dependency>
<groupId>org.hammurapi</groupId>
<artifactId>maven-hammurapi-plugin</artifactId>
<version>1.0</version>
<type>plugin</type>
- </dependency> -->
+ </dependency>
+-->
</dependencies>
<build>

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sat Mar 19 21:42:10 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Build with source/target levels 8
- Clean-up the build system
- Removed patch:
* jaxen-bootstrap-project_xml.patch
+ not needed in the rewamped build system
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Sep 8 08:20:32 UTC 2017 - fstrba@suse.com Fri Sep 8 08:20:32 UTC 2017 - fstrba@suse.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package jaxen-bootstrap # spec file for package jaxen-bootstrap
# #
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2022 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -12,85 +12,49 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org/
# #
%define with_maven 0
%define real jaxen %define real jaxen
%define dom4jver 1.6.1 %define dom4jver 1.6.1
%define section free
Name: jaxen-bootstrap Name: jaxen-bootstrap
Version: 1.1 Version: 1.1
Release: 0 Release: 0
Summary: A convenience package for build of dom4j Summary: A convenience package for build of dom4j
License: Apache-2.0 License: Apache-2.0
Group: Development/Libraries/Java Group: Development/Libraries/Java
Url: http://jaxen.codehaus.org/ URL: http://jaxen.codehaus.org/
Source0: http://dist.codehaus.org/jaxen/distributions/jaxen-1.1-src.tar.bz2 Source0: http://dist.codehaus.org/jaxen/distributions/jaxen-1.1-src.tar.bz2
Source1: pom-maven2jpp-depcat.xsl
Source2: pom-maven2jpp-newdepmap.xsl
Source3: pom-maven2jpp-mapdeps.xsl
Source4: jaxen-1.1-b7-jpp-depmap.xml
# Debian sources don't need a proprietary msv for build, so that's why I used them # Debian sources don't need a proprietary msv for build, so that's why I used them
# svn co svn://svn.debian.org/svn/pkg-java/trunk/dom4j # svn co svn://svn.debian.org/svn/pkg-java/trunk/dom4j
# rm dom4j/docs/xref/org/dom4j/tree/ConcurrentReaderHashMap.html # rm dom4j/docs/xref/org/dom4j/tree/ConcurrentReaderHashMap.html
# rm dom4j/docs/clover/org/dom4j/tree/ConcurrentReaderHashMap.html # rm dom4j/docs/clover/org/dom4j/tree/ConcurrentReaderHashMap.html
# #bnc501764 # bnc#501764
# rm dom4j/lib/tools/clover.license # rm dom4j/lib/tools/clover.license
# tar --exclude-vcs -cjf dom4j-1.6.1-debian.tar.bz2 dom4j/ # tar --exclude-vcs -cjf dom4j-1.6.1-debian.tar.bz2 dom4j/
Source5: http://prdownloads.sourceforge.net/dom4j/dom4j-%{dom4jver}-debian.tar.bz2 Source1: http://prdownloads.sourceforge.net/dom4j/dom4j-%{dom4jver}-debian.tar.bz2
Source6: jaxen-1.1-b7-build.xml Source2: jaxen-1.1-b7-build.xml
Patch0: jaxen-bootstrap-project_xml.patch
Requires: xalan-j2
Requires: xerces-j2
Requires: xom
BuildRequires: ant >= 1.6 BuildRequires: ant >= 1.6
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-tools BuildRequires: javapackages-tools
BuildRequires: junit
%if %{with_maven}
BuildRequires: maven >= 1.1
BuildRequires: maven-plugin-license
BuildRequires: maven-plugin-test
BuildRequires: maven-plugins-base
BuildRequires: saxon
BuildRequires: saxon-scripts
%endif
BuildRequires: java-devel
BuildRequires: unzip BuildRequires: unzip
BuildRequires: xalan-j2 BuildRequires: xalan-j2
BuildRequires: xerces-j2 BuildRequires: xerces-j2
BuildRequires: xom BuildRequires: xom
Requires: xalan-j2
Requires: xerces-j2
Requires: xom
BuildArch: noarch BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
Dom4j depends on a jaxen build with dom4j support. This package must Dom4j depends on a jaxen build with dom4j support. This package must
only be installed in the rare event of having to rebuild dom4j. only be installed in the rare event of having to rebuild dom4j.
%prep %prep
%setup -q -n %{real}-%{version} %setup -q -n %{real}-%{version} -a1
tar -xf %{SOURCE5} cp %{SOURCE2} build.xml
#/bin/gzip -dc %{SOURCE5} | tar -xf -
cp %{SOURCE6} build.xml
find . -name "*.jar" -exec rm -f {} \; find . -name "*.jar" -exec rm -f {} \;
%patch0 -b .sav
%if %{with_maven}
export DEPCAT=$(pwd)/jaxen-1.1-b7-depcat.new.xml
echo '<?xml version="1.0" standalone="yes"?>' > $DEPCAT
echo '<depset>' >> $DEPCAT
for p in $(find . -name project.xml); do
pushd $(dirname $p)
/usr/bin/saxon project.xml %{SOURCE1} >> $DEPCAT
popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
/usr/bin/saxon $DEPCAT %{SOURCE2} > jaxen-1.1-b7-depmap.new.xml
%endif
rm -rf src/java/main/org/jaxen/jdom rm -rf src/java/main/org/jaxen/jdom
rm -rf src/java/test/org/jaxen/jdom rm -rf src/java/test/org/jaxen/jdom
rm -f src/java/test/org/jaxen/test/JaxenTests.java rm -f src/java/test/org/jaxen/test/JaxenTests.java
@ -100,58 +64,37 @@ rm -f src/java/test/org/jaxen/test/JDOMTests.java
rm -f src/java/test/org/jaxen/test/JDOMXPathTest.java rm -f src/java/test/org/jaxen/test/JDOMXPathTest.java
%build %build
export CLASSPATH=$(build-classpath \ mkdir -p lib
xom \ build-jar-repository -s lib \
jdom \ xom \
xalan-j2 \ xalan-j2 \
xerces-j2 \ xerces-j2
)
pushd dom4j/src/java mkdir -p dom4j/classes
javac -sourcepath ../../../src/java/main:. \ javac \
org/dom4j/Attribute.java \ -source 8 -target 8 -d dom4j/classes \
org/dom4j/Branch.java \ -sourcepath src/java/main:dom4j/src/java \
org/dom4j/CDATA.java \ dom4j/src/java/org/dom4j/Attribute.java \
org/dom4j/Comment.java \ dom4j/src/java/org/dom4j/Branch.java \
org/dom4j/Document.java \ dom4j/src/java/org/dom4j/CDATA.java \
org/dom4j/DocumentException.java \ dom4j/src/java/org/dom4j/Comment.java \
org/dom4j/Element.java \ dom4j/src/java/org/dom4j/Document.java \
org/dom4j/Namespace.java \ dom4j/src/java/org/dom4j/DocumentException.java \
org/dom4j/Node.java \ dom4j/src/java/org/dom4j/Element.java \
org/dom4j/ProcessingInstruction.java \ dom4j/src/java/org/dom4j/Namespace.java \
org/dom4j/Text.java \ dom4j/src/java/org/dom4j/Node.java \
org/dom4j/io/SAXReader.java dom4j/src/java/org/dom4j/ProcessingInstruction.java \
jar cf ../../dom4j.jar $(find . -name "*.class") dom4j/src/java/org/dom4j/Text.java \
popd dom4j/src/java/org/dom4j/io/SAXReader.java
mkdir -p .maven/repository/JPP/jars
cp dom4j/dom4j.jar .maven/repository/JPP/jars/dom4j.jar jar cf lib/dom4j.jar -C dom4j/classes .
%if %{with_maven}
for p in $(find . -name project.xml); do %ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8
pushd $(dirname $p)
cp project.xml project.xml.orig
/usr/bin/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
popd
done
maven \
-Dmaven.test.skip=true \
-Dmaven.repo.remote=file:/usr/share/maven/repository \
-Dmaven.home.local=$(pwd)/.maven \
jar
%else
export CLASSPATH=$CLASSPATH:dom4j/dom4j.jar
ant -Dant.build.javac.source=1.6 -Dant.build.javac.target=1.6 \
-Dbuild.sysclasspath=first
%endif
%install %install
# jars # jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir} install -d -m 755 %{buildroot}%{_javadir}
install -m 644 target/%{real}-%{version}-beta-7.jar \ install -m 644 target/%{real}-%{version}-beta-7.jar %{buildroot}%{_javadir}/%{real}.jar
$RPM_BUILD_ROOT%{_javadir}/%{real}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do \
ln -sf ${jar} ${jar/-%{version}/}; done)
%clean
rm -rf $RPM_BUILD_ROOT
%files %files
%defattr(0644,root,root,0755) %defattr(0644,root,root,0755)

View File

@ -1,109 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*[name() != 'dependencies']|*/text()">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//dependencies">
<xsl:for-each select="./dependency">
<xsl:element name="dependency">
<xsl:element name="maven">
<xsl:choose>
<xsl:when test="./groupId">
<xsl:copy-of select="./groupId"/>
<xsl:copy-of select="./artifactId"/>
</xsl:when>
<xsl:when test="./id">
<xsl:choose>
<xsl:when test="substring-before(./id/text(),':') != ''">
<xsl:element name="groupId">
<xsl:value-of select="substring-before(./id/text(),':')"/>
</xsl:element>
<xsl:element name="artifactId">
<xsl:value-of select="substring-after(./id/text(),':')"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="groupId">
<xsl:value-of select="./id/text()"/>
</xsl:element>
<xsl:element name="artifactId">
<xsl:value-of select="./id/text()"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
ERROR
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="./*">
<xsl:if test="(name() != 'groupId') and (name() != 'artifactId') and (name() != 'id')">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:element>
<xsl:element name="jpp">
<xsl:element name="groupId">JPP</xsl:element>
<xsl:choose>
<xsl:when test="./artifactId">
<xsl:copy-of select="./artifactId"/>
</xsl:when>
<xsl:when test="./id">
<xsl:choose>
<xsl:when test="substring-after(./id/text(),':') != ''">
<xsl:element name="artifactId">
<xsl:value-of select="substring-after(./id/text(),':')"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="artifactId">
<xsl:value-of select="./id/text()"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
ERROR
</xsl:otherwise>
</xsl:choose>
<xsl:element name="jar">
<xsl:choose>
<xsl:when test="./artifactId">
<xsl:value-of select="./artifactId/text()"/>
</xsl:when>
<xsl:when test="./id">
<xsl:choose>
<xsl:when test="substring-after(./id/text(),':') != ''">
<xsl:value-of select="substring-after(./id/text(),':')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./id/text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
ERROR
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="./type">
<xsl:choose>
<xsl:when test="./type/text() = 'plugin'">.jar</xsl:when>
<xsl:otherwise>.<xsl:value-of select="./type/text()"/></xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>.jar</xsl:otherwise>
</xsl:choose>
</xsl:element>
<xsl:for-each select="./*">
<xsl:if test="(name() != 'groupId') and (name() != 'artifactId') and (name() != 'id')">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="map" />
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/project" >
<xsl:element name="project">
<xsl:copy-of select="child::*[not(self::dependencies)]"/>
<xsl:if test="not(./dependencies)">
<xsl:element name="dependencies">
<xsl:for-each select="document($map)//add/dependency">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:element>
</xsl:if>
<xsl:apply-templates select="dependencies"/>
</xsl:element>
</xsl:template>
<xsl:template match="dependencies" >
<xsl:element name="dependencies">
<xsl:for-each select="dependency">
<xsl:if test="./artifactId">
<xsl:call-template name="replace">
<xsl:with-param name="artifact" select="./artifactId/text()"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="./id">
<xsl:choose>
<xsl:when test="substring-after(./id/text(),':') != ''">
<xsl:call-template name="replace">
<xsl:with-param name="artifact" select="substring-after(./id/text(),':')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="replace">
<xsl:with-param name="artifact" select="./id/text()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="document($map)//add/dependency">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template name="replace">
<xsl:param name="artifact"/>
<xsl:variable name="this" select="."/>
<xsl:choose>
<xsl:when test="document($map)//dependency/maven[./artifactId/text() = $artifact]">
<xsl:for-each select="document($map)//dependency/maven[./artifactId/text() = $artifact][1]">
<xsl:if test="../jpp">
<xsl:element name="dependency">
<xsl:copy-of select="../jpp/*"/>
<xsl:copy-of select="$this/properties"/>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:element name="dependency">
<xsl:copy-of select="./*"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="document($map)//dependency/maven[./artifactId/text() = $artifact]">
<xsl:for-each select="document($map)//dependency/maven[./artifactId/text() = $artifact][1]">
<xsl:for-each select="../add/dependency">
<xsl:element name="dependency">
<xsl:copy-of select="./*"/>
<xsl:copy-of select="$this/properties"/>
</xsl:element>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon"
extension-element-prefixes="saxon">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/" >
<xsl:element name="depset">
<saxon:group select="//dependency" group-by="./maven/artifactId">
<xsl:sort select="./maven/artifactId"/>
<xsl:element name="dependency">
<xsl:element name="maven">
<xsl:copy-of select="./maven/*[name() != 'properties']"/>
</xsl:element>
<xsl:element name="jpp">
<xsl:copy-of select="./jpp/*[name() != 'properties']"/>
</xsl:element>
</xsl:element>
<saxon:item/>
</saxon:group>
</xsl:element>
</xsl:template>
</xsl:stylesheet>