Browse Source

Removing ant-trax.jar and folding TraXLiaison into ant-nodeps.jar.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@911648 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 15 years ago
parent
commit
69eba07e72
13 changed files with 17 additions and 383 deletions
  1. +2
    -0
      WHATSNEW
  2. +2
    -43
      build.xml
  3. +2
    -12
      docs/manual/install.html
  4. +0
    -2
      src/etc/ant-bin.wxs
  5. +1
    -1
      src/etc/poms/ant-apache-xalan2/pom.xml
  6. +0
    -1
      src/etc/poms/ant-nodeps/pom.xml
  7. +0
    -73
      src/etc/poms/ant-trax/pom.xml
  8. +0
    -1
      src/etc/poms/pom.xml
  9. +5
    -14
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  10. +0
    -96
      src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java
  11. +0
    -135
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java
  12. +4
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
  13. +1
    -4
      xdocs/faq.xml

+ 2
- 0
WHATSNEW View File

@@ -4,6 +4,8 @@ Changes from Ant 1.8.0 TO current SVN version
Changes that could break older environments:
-------------------------------------------

* ant-trax.jar is no longer produced since TrAX is included in JDK 1.4+.

* Ant no longer ships with Apache Xerces-J or the XML APIs but relies
on the Java runtime to provide a parser and matching API versions.



+ 2
- 43
build.xml View File

@@ -185,16 +185,6 @@
</or>
</selector>

<!-- depends on external libraries -->
<selector id="needs.trax">
<or>
<filename name="${optional.package}/TraXLiaison*"/>
<filename name="${optional.package}/XSLTTraceSupport*"/>
<filename name="${optional.package}/XsltTest*"/>
<filename name="${type.package}/XMLCatalogBuildFileTest*"/>
</or>
</selector>

<selector id="needs.apache-resolver">
<filename name="${apache.resolver.type.package}/**"/>
</selector>
@@ -357,19 +347,6 @@
<available property="netrexx.present"
classname="netrexx.lang.Rexx"
classpathref="classpath"/>
<available property="trax.present"
classname="javax.xml.transform.Transformer"
classpathref="classpath"/>
<condition property="trax.impl.present">
<or>
<and>
<isset property="javax.xml.transform.TransformerFactory"/>
<available classname="${javax.xml.transform.TransformerFactory}"
classpathref="classpath"/>
</and>
<available resource="META-INF/services/javax.xml.transform.TransformerFactory"/>
</or>
</condition>
<available property="apache.resolver.present"
classname="org.apache.xml.resolver.tools.CatalogResolver"
classpathref="classpath"/>
@@ -560,7 +537,6 @@
<selector refid="needs.jdk1.5+" unless="jdk1.5+"/>
<selector refid="not.in.kaffe" if="kaffe"/>

<selector refid="needs.trax" unless="trax.present"/>
<selector refid="needs.apache-resolver" unless="apache.resolver.present"/>
<selector refid="needs.junit" unless="junit.present"/>
<selector refid="needs.apache-regexp"
@@ -743,7 +719,6 @@
<not>
<or>
<selector refid="ant.launcher"/>
<selector refid="needs.trax"/>
<selector refid="needs.apache-resolver"/>
<selector refid="needs.junit"/>
<selector refid="needs.apache-regexp"/>
@@ -784,7 +759,6 @@
</sequential>
</macrodef>

<optional-jar dep="trax"/>
<optional-jar dep="apache-resolver"/>
<optional-jar dep="junit"/>
<optional-jar dep="apache-regexp"/>
@@ -1665,17 +1639,11 @@ see ${build.junit.reports} / ${antunit.reports}
</condition>

<condition property="run.antunit.report">
<and>
<isset property="run.antunit" />
<isset property="trax.impl.present" />
</and>
<isset property="run.antunit" />
</condition>

<condition property="run.junit.report">
<and>
<isset property="run.junit" />
<isset property="trax.impl.present" />
</and>
<isset property="run.junit" />
</condition>
</target>

@@ -1761,17 +1729,8 @@ see ${build.junit.reports} / ${antunit.reports}
<!-- these tests need to be localised before being ran???? -->
<exclude name="${optional.package}/PvcsTest.java"/>

<!-- These tests need a TraX implementation like xalan2 or saxon -->
<exclude name="${optional.package}/TraXLiaisonTest.java"
unless="trax.impl.present"/>
<exclude name="${optional.package}/XsltTest.java"
unless="trax.impl.present"/>
<exclude name="${ant.package}/types/XMLCatalogBuildFileTest.java"
unless="trax.impl.present"/>
<exclude name="${optional.package}/junit/JUnitReportTest.java"
unless="run.junitreport"/>
<exclude name="${taskdefs.package}/StyleTest.java"
unless="trax.impl.present"/>

<!-- needs xerces to work -->
<exclude name="${ant.package}/IncludeTest.java"


+ 2
- 12
docs/manual/install.html View File

@@ -700,24 +700,14 @@ Installing Ant / Optional Tasks</a> section above.</p>
<td><b>Needed For</b></td>
<td><b>Available At</b></td>
</tr>
<tr>
<td>An XSL transformer like Xalan</td>
<td>style task</td>
<td>
<b>If you use JDK 1.4+, an XSL transformer is already included, so you need not do anything special.</b><br>
<ul><li>XALAN : <a href="http://xml.apache.org/xalan-j/index.html"
target="_top">http://xml.apache.org/xalan-j/index.html</a></li>
</ul>
</td>
</tr>
<tr>
<td>jakarta-regexp-1.3.jar</td>
<td>regexp type with mappers</td>
<td>regexp type with mappers (if you do not wish to use java.util.regex)</td>
<td><a href="http://jakarta.apache.org/regexp/" target="_top">http://jakarta.apache.org/regexp/</a></td>
</tr>
<tr>
<td>jakarta-oro-2.0.8.jar</td>
<td>regexp type with mappers and the perforce tasks<br>
<td>regexp type with mappers (if you do not wish to use java.util.regex) and the Perforce tasks<br>
To use the FTP task,
you need jakarta-oro 2.0.8 or later, and <a href="#commons-net">commons-net</a></td>
<td><a href="http://jakarta.apache.org/oro/" target="_top">http://jakarta.apache.org/oro/</a></td>


+ 0
- 2
src/etc/ant-bin.wxs View File

@@ -53,9 +53,7 @@
<File DiskId="1" Id="file18" Name="ANT-ST_2.JAR" LongName="ant-starteam.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-starteam.jar" />
<File DiskId="1" Id="file19" Name="ANT-ST_1.JAR" LongName="ant-stylebook.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-stylebook.jar" />
<File DiskId="1" Id="file20" Name="ANT-SW_1.JAR" LongName="ant-swing.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-swing.jar" />
<File DiskId="1" Id="file21" Name="ant-trax.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-trax.jar" />
<File DiskId="1" Id="file22" Name="ANT-WE_1.JAR" LongName="ant-weblogic.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-weblogic.jar" />
<File DiskId="1" Id="file23" Name="ANT-XA_1.JAR" LongName="ant-xalan1.jar" Vital="yes" src="$(var.dist.dir)/lib\ant-xalan1.jar" />
<File DiskId="1" Id="file24" Name="ant.jar" Vital="yes" src="$(var.dist.dir)/lib\ant.jar" />
<File DiskId="1" Id="file25" Name="LIBRAR_1.PRO" LongName="libraries.properties" Vital="yes" src="$(var.dist.dir)/lib\libraries.properties" />
<File DiskId="1" Id="file26" Name="README" Vital="yes" src="$(var.dist.dir)/lib\README" />


+ 1
- 1
src/etc/poms/ant-apache-xalan2/pom.xml View File

@@ -32,7 +32,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-xalan2</artifactId>
<version>1.8.0-SNAPSHOT</version>
<description>contains the junit and junirreport tasks</description>
<description>contains Xalan2-specific features</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>


+ 0
- 1
src/etc/poms/ant-nodeps/pom.xml View File

@@ -59,7 +59,6 @@
<include>org/apache/tools/ant/util/regexp/Jdk14Regexp*</include>
</includes>
<excludes>
<exclude>org/apache/tools/ant/taskdefs/optional/TraXLiaison*</exclude>
<exclude>org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport*</exclude>
<exclude>org/apache/tools/ant/taskdefs/optional/junit/**</exclude>
<exclude>org/apache/tools/ant/taskdefs/optional/perforce/**</exclude>


+ 0
- 73
src/etc/poms/ant-trax/pom.xml View File

@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This POM has been created manually by the Ant Development Team.
Please contact us if you are not satisfied with the data contained in this POM.
URL : http://ant.apache.org
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.8.0-SNAPSHOT</version>
<description>contains particularly one class necessary for the execution of the xslt task</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-xalan2</artifactId>
<version>1.8.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<!-- xalan contains a TRAX compliant implementation -->
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
<optional>true</optional>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
<includes>
<include>org/apache/tools/ant//taskdefs/optional/TraXLiaison*</include>
</includes>
</configuration>
</plugin>
</plugins>
<sourceDirectory>../../../../src/main</sourceDirectory>
<testSourceDirectory>../../../../src/testcases</testSourceDirectory>
<outputDirectory>../../../../target/${project.artifactId}/classes</outputDirectory>
<testOutputDirectory>../../../../target/${project.artifactId}/testcases</testOutputDirectory>
<directory>../../../../target/${project.artifactId}</directory>
</build>
</project>

+ 0
- 1
src/etc/poms/pom.xml View File

@@ -90,7 +90,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<module>ant-nodeps</module>
<module>ant-swing</module>
<module>ant-testutil</module>
<module>ant-trax</module>
</modules>
<dependencies>
<dependency>


+ 5
- 14
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -108,10 +108,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
/** for resolving entities such as dtds */
private XMLCatalog xmlCatalog = new XMLCatalog();

/** Name of the TRAX Liaison class */
private static final String TRAX_LIAISON_CLASS =
"org.apache.tools.ant.taskdefs.optional.TraXLiaison";

/** Utilities used for file operations */
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();

@@ -525,7 +521,6 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {

/**
* Set the name of the XSL processor to use; optional, default trax.
* Other values are "xalan" for Xalan1
*
* @param processor the name of the XSL processor
*/
@@ -675,15 +670,13 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @exception Exception if the processor cannot be loaded.
*/
private void resolveProcessor(String proc) throws Exception {
String classname;
if (proc.equals(PROCESSOR_TRAX)) {
classname = TRAX_LIAISON_CLASS;
liaison = new org.apache.tools.ant.taskdefs.optional.TraXLiaison();
} else {
//anything else is a classname
classname = proc;
Class clazz = loadClass(proc);
liaison = (XSLTLiaison) clazz.newInstance();
}
Class clazz = loadClass(classname);
liaison = (XSLTLiaison) clazz.newInstance();
}

/**
@@ -906,8 +899,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
* @return an instance of the XSLTLiason interface.
*/
protected XSLTLiaison getLiaison() {
// if processor wasn't specified, see if TraX is available. If not,
// default it to xalan, depending on which is in the classpath
// if processor wasn't specified, use TraX.
if (liaison == null) {
if (processor != null) {
try {
@@ -918,8 +910,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
} else {
try {
resolveProcessor(PROCESSOR_TRAX);
} catch (Throwable e1) {
e1.printStackTrace();
} catch (Exception e1) { // should not happen
handleError(e1);
}
}


+ 0
- 96
src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java View File

@@ -1,96 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.tools.ant.taskdefs.optional.junit;

import java.io.OutputStream;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

import org.apache.tools.ant.BuildException;

/**
* This class is not used by the framework any more.
* We plan to remove it in Ant 1.8
* @deprecated since Ant 1.7
*
*
* @ant.task ignore="true"
*/
public class Xalan2Executor extends XalanExecutor {

private static final String APAC = "org.apache.xalan.";
private static final String SPAC = "com.sun.org.apache.xalan.";

private TransformerFactory tfactory = TransformerFactory.newInstance();

/** {@inheritDoc}. */
protected String getImplementation() throws BuildException {
return tfactory.getClass().getName();
}

/** {@inheritDoc}. */
protected String getProcVersion(String classNameImpl)
throws BuildException {
try {
// xalan 2
if (classNameImpl.equals(APAC + "processor.TransformerFactoryImpl")
||
classNameImpl.equals(APAC + "xslt.XSLTProcessorFactory")) {
return getXalanVersion(APAC + "processor.XSLProcessorVersion");
}
// xalan xsltc
if (classNameImpl.equals(APAC
+ "xsltc.trax.TransformerFactoryImpl")) {
return getXSLTCVersion(APAC + "xsltc.ProcessorVersion");
}
// jdk 1.5 xsltc
if (classNameImpl
.equals(SPAC + "internal.xsltc.trax.TransformerFactoryImpl")) {
return getXSLTCVersion(SPAC
+ "internal.xsltc.ProcessorVersion");
}
throw new BuildException("Could not find a valid processor version"
+ " implementation from "
+ classNameImpl);
} catch (ClassNotFoundException e) {
throw new BuildException("Could not find processor version "
+ "implementation", e);
}
}

/** {@inheritDoc}. */
void execute() throws Exception {
String systemId = caller.getStylesheetSystemId();
Source xslSrc = new StreamSource(systemId);
Transformer tformer = tfactory.newTransformer(xslSrc);
Source xmlSrc = new DOMSource(caller.document);
OutputStream os = getOutputStream();
try {
tformer.setParameter("output.dir", caller.toDir.getAbsolutePath());
Result result = new StreamResult(os);
tformer.transform(xmlSrc, result);
} finally {
os.close();
}
}
}

+ 0
- 135
src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java View File

@@ -1,135 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.tools.ant.taskdefs.optional.junit;

import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;

/**
* This class is not used by the framework any more.
* We plan to remove it in Ant 1.8
* @deprecated since Ant 1.7
*
*/
abstract class XalanExecutor {
private static final String PACKAGE =
"org.apache.tools.ant.taskdefs.optional.junit.";

// CheckStyle:VisibilityModifier OFF - bc
/** the transformer caller */
protected AggregateTransformer caller;
// CheckStyle:VisibilityModifier ON

/** set the caller for this object. */
private void setCaller(AggregateTransformer caller) {
this.caller = caller;
}

/** get the appropriate stream based on the format (frames/noframes) */
protected final OutputStream getOutputStream() throws IOException {
if (AggregateTransformer.FRAMES.equals(caller.format)) {
// dummy output for the framed report
// it's all done by extension...
return new ByteArrayOutputStream();
} else {
return new BufferedOutputStream(
new FileOutputStream(new File(caller.toDir, "junit-noframes.html")));
}
}

/** override to perform transformation */
abstract void execute() throws Exception;

/**
* Create a valid Xalan executor. It checks if Xalan2 is
* present. If none is available, it fails.
* @param caller object containing the transformation information.
* @throws BuildException thrown if it could not find a valid xalan
* executor.
*/
static XalanExecutor newInstance(AggregateTransformer caller)
throws BuildException {
XalanExecutor executor = null;
try {
Class clazz = Class.forName(PACKAGE + "Xalan2Executor");
executor = (XalanExecutor) clazz.newInstance();
} catch (Exception xsltcApacheMissing) {
caller.task.log(xsltcApacheMissing.toString());
throw new BuildException("Could not find xstlc nor xalan2 "
+ "in the classpath. Check "
+ "http://xml.apache.org/xalan-j");
}
String classNameImpl = executor.getImplementation();
String version = executor.getProcVersion(classNameImpl);
caller.task.log("Using " + version, Project.MSG_VERBOSE);
executor.setCaller(caller);
return executor;
}

/**
* This methods should return the classname implementation of the
* underlying xslt processor
* @return the classname of the implementation, for example:
* org.apache.xalan.processor.TransformerFactoryImpl
* @see #getProcVersion(String)
*/
protected abstract String getImplementation();

/**
* Try to discover the xslt processor version based on the
* className. There is nothing carved in stone and it can change
* anytime, so this is just for the sake of giving additional
* information if we can find it.
* @param classNameImpl the classname of the underlying xslt processor
* @return a string representing the implementation version.
* @throws BuildException
*/
protected abstract String getProcVersion(String classNameImpl)
throws BuildException;

/** a bit simplistic but xsltc data are conveniently private non final */
protected final String getXSLTCVersion(String procVersionClassName)
throws ClassNotFoundException {
// there's a convenient xsltc class version but data are
// private so use package information
Class procVersion = Class.forName(procVersionClassName);
Package pkg = procVersion.getPackage();
return pkg.getName() + " " + pkg.getImplementationTitle()
+ " " + pkg.getImplementationVersion();
}

/** pretty useful data (Xalan version information) to display. */
protected final String getXalanVersion(String procVersionClassName)
throws ClassNotFoundException {
Class procVersion = Class.forName(procVersionClassName);
String pkg = procVersion.getPackage().getName();
try {
Field f = procVersion.getField("S_VERSION");
return pkg + " " + f.get(null).toString();
} catch (Exception e) {
return pkg + " ?.?";
}
}
}

+ 4
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java View File

@@ -65,7 +65,7 @@ public class XsltTest extends BuildFileTest {
public void testCatchNoDtd() throws Exception {
expectBuildExceptionContaining("testCatchNoDtd",
"expected failure",
"Fatal error during transformation");
/* actually: "chemical" */null);
}

/**
@@ -79,6 +79,7 @@ public class XsltTest extends BuildFileTest {
executeTarget("testOutputProperty");
}

/* Only runs if xalan.jar is in CP (not incl. Sun's JRE repackaging):
public void testFactory() throws Exception {
executeTarget("testFactory");
}
@@ -86,6 +87,8 @@ public class XsltTest extends BuildFileTest {
public void testAttribute() throws Exception {
executeTarget("testAttribute");
}
*/

public void testXMLWithEntitiesInNonAsciiPath() throws Exception {
executeTarget("testXMLWithEntitiesInNonAsciiPath");
}


+ 1
- 4
xdocs/faq.xml View File

@@ -1785,10 +1785,7 @@ mv /tmp/foo $ANT_HOME/bin/antRun
dependencies on external libraries. You can move the
"offending" jar out of <code>ANT_HOME/lib</code>. For the
<code>&lt;junit&gt;</code> task it would be
<code>ant-junit.jar</code> and for <code>&lt;style&gt;</code>
it would be <code>ant-trax.jar</code>
or <code>ant-xslp.jar</code> -
depending on the processor you use.</p>
<code>ant-junit.jar</code>.</p>

<p>If you do so, you will have to <code>&lt;taskdef&gt;</code>
all optional tasks that need the external library and use


Loading…
Cancel
Save