| View previous topic :: View next topic |
| Author |
Message |
kustos Apprentice


Joined: 10 Sep 2003 Posts: 168
|
Posted: Fri Apr 01, 2005 11:19 am Post subject: Fixing the build.xml of all Java ebuilds |
|
|
For people like me who actually use Java 1.5 the current situation with java ebuilds is just unbearable. Ranting somehow didn't improve the situation, so I'm doing something constructive instead.
This is a XSL-Stylesheet that should fix all (or at least all I can think of) build.xml of java ebuilds. I don't know if I should post it here, in bugzilla or in the wiki.
It just modifies the javac elements:
- For those that already have a source (and optional target) attribute it sets target to the same value.
- For those that alreday have a target (but no source) attribute it sets source to the same value.
- For those that have neither it sets source and target to 1.4.
All the other elements are copied with their attributes
Comments are stripped
| Code: |
<?xml version="1.0" ?>
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="xml" indent="yes"/>
<!-- javac element, with with source and optional target
copy everything, set target to value of source -->
<xsl:template match="javac[@source]">
<xsl:copy>
<xsl:for-each select="./@*[not(target)]">
<xsl:copy/>
</xsl:for-each>
<xsl:attribute name="target">
<xsl:value-of select="@source"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- javac element, with with target but no source
(this was handeled earlier)
copy everything, set source to value of target -->
<xsl:template match="javac[@target]">
<xsl:copy>
<xsl:for-each select="./@*[not(source)]">
<xsl:copy/>
</xsl:for-each>
<xsl:attribute name="source">
<xsl:value-of select="@target"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- javac element, with no source and no target
copy everything, add source and target attribue and
set them and target to 1.4 -->
<xsl:template match="javac">
<xsl:copy>
<xsl:for-each select="./@*">
<xsl:copy/>
</xsl:for-each>
<xsl:attribute name="source">1.4</xsl:attribute>
<xsl:attribute name="target">1.4</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- any other element, copy everything continue -->
<xsl:template match="*">
<xsl:copy>
<xsl:for-each select="./@*">
<xsl:copy/>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
|
Here is a sample that you can use to test the stylesheet.
| Code: |
<?xml version="1.0" encoding="utf-8"?>
<project name="Transformation Sample" default="run" basedir=".">
<path id="class.path">
<pathelement location="${build.src.dir}"/>
<pathelement location="${build.tests.dir}"/>
</path>
<target name="compile15" depends="-init" description="compiles the project">
<depend
srcdir="${src.dir}"
destdir="${build.src.dir}"
cache="${dep.dir}"
closure="no"/>
<javac
srcdir="${src.dir}"
destdir="${build.src.dir}"
source="1.5"
target="1.5"
debug="on"
fork="true">
<!-- <compilerarg value="-Xlint:deprecation,unchecked,fallthrough,path,finally" /> -->
</javac>
</target>
<target name="compile12" depends="-init" description="compiles the project">
<depend
srcdir="${src.dir}"
destdir="${build.src.dir}"
cache="${dep.dir}"
closure="no"/>
<javac
srcdir="${src.dir}"
destdir="${build.src.dir}"
target="1.2"
debug="on"
fork="true">
<!-- <compilerarg value="-Xlint:deprecation,unchecked,fallthrough,path,finally" /> -->
</javac>
</target>
<target name="compile13" depends="-init" description="compiles the project">
<depend
srcdir="${src.dir}"
destdir="${build.src.dir}"
cache="${dep.dir}"
closure="no"/>
<javac
srcdir="${src.dir}"
destdir="${build.src.dir}"
source="1.3"
debug="on"
fork="true">
<!-- <compilerarg value="-Xlint:deprecation,unchecked,fallthrough,path,finally" /> -->
</javac>
</target>
<target name="compile14" depends="-init" description="compiles the project">
<depend
srcdir="${src.dir}"
destdir="${build.src.dir}"
cache="${dep.dir}"
closure="no"/>
<javac
srcdir="${src.dir}"
destdir="${build.src.dir}"
debug="on"
fork="true">
<!-- <compilerarg value="-Xlint:deprecation,unchecked,fallthrough,path,finally" /> -->
</javac>
</target>
</project>
|
|
|
| Back to top |
|
 |
mneisen n00b


Joined: 23 Feb 2005 Posts: 29
|
Posted: Fri Apr 01, 2005 1:14 pm Post subject: |
|
|
| Good work! I think some people did have this kind of problem, so thanks a lot! |
|
| Back to top |
|
 |
dirtyepic Developer


Joined: 22 Oct 2004 Posts: 1613 Location: sk.ca
|
Posted: Sat Apr 02, 2005 1:45 am Post subject: |
|
|
i vote bugzilla. _________________ by design, by neglect
for a fact or just for effect |
|
| Back to top |
|
 |
jannis Guru

Joined: 05 Dec 2004 Posts: 305 Location: Germany / Bavaria / Aschaffenburg
|
Posted: Tue Oct 25, 2005 5:08 pm Post subject: |
|
|
| HHmm... looks nice but how do I use it for....... let's say OpenOffice-2.0.0 for example? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|