...
 
Commits (5)
Changes from Ant 1.10.4 TO Ant 1.10.5
=====================================
Fixed bugs:
-----------
* Fixes a regression in the "get" task where redirects
from a HTTP resource to a HTTPS resource started throwing
an exception.
Bugzilla Report 62499
* the new allowFilesToEscapeDest didn't work when set to false and
archive entries contained relative paths with so many ".."
segnments that the resulting path would go beyond the file system
root.
Bugzilla Report 62502
Other changes:
--------------
* Java task now accepts a "sourcefile" attribute to allow single file
source program execution, a feature that is introduced in Java 11.
Changes from Ant 1.10.3 TO Ant 1.10.4
=====================================
......
......@@ -33,10 +33,10 @@
<property name="name" value="ant"/>
<!-- this is the directory corresponding to groupId of Ant in the Maven repository -->
<property name="groupid" value="org/apache/ant"/>
<property name="project.version" value="1.10.4"/>
<property name="project.version" value="1.10.5"/>
<!-- pom.version is used when doing a distribution and must match with what is checked in under src/etc/poms -->
<property name="pom.version" value="1.10.4"/>
<property name="manifest-version" value="1.10.4"/>
<property name="pom.version" value="1.10.5"/>
<property name="manifest-version" value="1.10.5"/>
<property name="bootstrap.jar" value="ant-bootstrap.jar"/>
<property name="ant.package" value="org/apache/tools/ant"/>
......
ant (1.10.5-1) unstable; urgency=medium
* Team upload.
* New upstream release
* Replaced debian/orig-tar.sh with the Files-Excluded mechanism
* Standards-Version updated to 4.1.5
-- Emmanuel Bourg <ebourg@apache.org> Mon, 16 Jul 2018 15:14:01 +0200
ant (1.10.4-2) unstable; urgency=medium
* Team upload.
......
......@@ -25,7 +25,7 @@ Build-Depends: antlr,
libxml-commons-resolver1.1-java (>= 1.2-7~),
libxz-java,
maven-repo-helper (>> 1.0)
Standards-Version: 4.1.4
Standards-Version: 4.1.5
Vcs-Git: https://salsa.debian.org/java-team/ant.git
Vcs-Browser: https://salsa.debian.org/java-team/ant
Homepage: http://ant.apache.org
......
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Apache Ant
Source: http://ant.apache.org
Files-Excluded: *.jar
Files: *
Copyright: 2000-2018, The Apache Software Foundation
......
#!/bin/sh -e
VERSION=$2
ORIG_TAR=$3
TAR=../ant_$VERSION.orig.tar.xz
DIR=apache-ant-$VERSION
tar xvzf $ORIG_TAR
rm $ORIG_TAR
XZ_OPT=--best tar -c -J -f $TAR --exclude '*.jar' --exclude '*.pdf' $DIR
rm -rf $DIR
# move to directory 'tarballs'
if [ -r .svn/deb-layout ]; then
. .svn/deb-layout
mv $TAR $origDir
echo "moved $TAR to $origDir"
fi
version=2
https://www.apache.org/dist/ant/source/apache-ant-(.*)-src\.tar\.gz debian debian/orig-tar.sh
version=4
opts="repack,compression=xz" \
https://www.apache.org/dist/ant/source/apache-ant-(.*)-src\.tar\.gz
......@@ -31,7 +31,7 @@ m2.repo=http://repo1.maven.org/maven2/
# Versions of different libraries. Please keep in alphabetical order, except
# when a specific dependency forces them to be out-of-order
ivy.version=2.4.0
ant-antunit.version=1.3
ant-antunit.version=1.4
antlr.version=2.7.7
bcel.version=6.2
bsf.version=2.4.0
......
......@@ -50,7 +50,7 @@ because it tries to read from the standard input.</p>
<tr id="classname">
<td>classname</td>
<td>the Java class to execute.</td>
<td rowspan="3">Exactly one of the three</td>
<td rowspan="4">Exactly one of the four</td>
</tr>
<tr>
<td>jar</td>
......@@ -65,6 +65,13 @@ because it tries to read from the standard input.</p>
entry in the manifest). <var>fork</var> must be set to <q>true</q> if this option is
selected. <em>since Ant 1.9.7</em></td>
</tr>
<tr>
<td>sourcefile</td>
<td class="left">The location of a ".java" file or a file containing shebang with Java source code.
Set this attribute to run Java single file source programs, a feature introduced in Java 11.
<var>fork</var> must be set to <q>true</q> if this option is selected.
<em>since Ant 1.10.5</em></td>
</tr>
<tr>
<td>args</td>
<td>the arguments for the class that is executed. <em><u>Deprecated</u>, use
......
......@@ -31,10 +31,14 @@
<h3>Description</h3>
<p>Sends SMTP mail with MIME
attachments. <a href="https://www.oracle.com/technetwork/java/index-138643.html"
attachments. <a href="https://javaee.github.io/javamail/"
target="_top">JavaMail</a>
and <a href="https://www.oracle.com/technetwork/java/javase/jaf-135115.html" target="_top">Java
Activation Framework</a> are required for this task.</p>
and <a href="https://github.com/javaee/activation" target="_top">Java
Activation Framework</a> are required for this task. The Java
Activation Framework is part of the standard class library for Java 6
to Java 10 but the <code>java.activation</code> module has been
deprecated in Java 9 and must be enabled explicitly when running on
Java 10. Alternatively it can be provided as an external library.</p>
<p>Multiple files can be attached using <a href="../Types/fileset.html">FileSets.</a></p>
<h3>Parameters</h3>
<table class="attr">
......
......@@ -19,13 +19,13 @@
<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
<title>Apache Ant 1.10.4 User Manual</title>
<title>Apache Ant 1.10.5 User Manual</title>
</head>
<body>
<h1 class="center"><img src="images/ant_logo_large.gif" width="190" height="120" alt="Apache Ant logo"></h1>
<h1 class="center">Apache Ant&trade; 1.10.4 Manual</h1>
<p>This is the manual for version 1.10.4 of <a href="https://ant.apache.org/" target="_top">Apache Ant</a>. If your
<h1 class="center">Apache Ant&trade; 1.10.5 Manual</h1>
<p>This is the manual for version 1.10.5 of <a href="https://ant.apache.org/" target="_top">Apache Ant</a>. If your
version of Ant (as verified with <kbd>ant -version</kbd>) is older or newer than this version then this is not the
correct manual set. Please use the documentation appropriate to your current version. Also, if you are using a
version older than the most recent release, we recommend an upgrade to fix bugs as well as provide new
......
......@@ -19,7 +19,7 @@
<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
<title>Apache Ant User Manual&mdash;Credits</title>
<title>Apache Ant User Manual - Credits</title>
</head>
<body>
......@@ -46,7 +46,7 @@
<li>Arnout J. Kuiper (<a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>)</li>
<li>Antoine L&eacute;vy-Lambert</li>
<li>Conor MacNeill</li>
<li>Jan Mat&eacute;rne</li>
<li>Jan Mat&egrave;rne</li>
<li>Stefano Mazzocchi (<a href="mailto:stefano@apache.org">stefano@apache.org</a>)</li>
<li>Erik Meade (<a href="mailto:emeade@geekfarm.org">emeade@geekfarm.org</a>)</li>
<li>Sam Ruby (<a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>)</li>
......@@ -61,7 +61,7 @@
<li>Craeg Strong (<a href="mailto:cstrong@arielpartners.com">cstrong@arielpartners.com</a>)</li>
</ul>
<p class="center">Version: 1.10.4</p>
<p class="center">Version: 1.10.5</p>
</body>
</html>
......@@ -897,10 +897,14 @@ these tasks available. Please refer to the <a href="#optionalTasks">Installing A
<td><a href="https://javaee.github.io/javamail/" target="_top">https://javaee.github.io/javamail/</a></td>
</tr>
<tr>
<td>activation.jar<br/>(included in Java 6 and later runtime)</td>
<td>activation.jar<br/>
(included in Java 6 to Java 10 but
the <code>java.activation</code> module is deprecated and marked
for removal in Java 9 and needs to be enabled explicitly on Java
10)</td>
<td><a href="Tasks/mail.html">mail</a> task with MIME encoding,
and <em><u>deprecated</u></em> <a href="Tasks/mimemail.html">mimemail</a> task</td>
<td><a href="https://www.oracle.com/technetwork/java/javase/jaf-135115.html"
<td><a href="https://github.com/javaee/activation"
target="_top">https://www.oracle.com/technetwork/java/javase/jaf-135115.html</a></td>
</tr>
<tr>
......
......@@ -89,7 +89,7 @@
</ul-->
<h1><a name="top">JDepend Analysis</a></h1>
<p align="right">Designed for use with <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> and <a href="http://jakarta.apache.org">Ant</a>.</p>
<p align="right">Designed for use with <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> and <a href="https://ant.apache.org">Ant</a>.</p>
<hr size="2" />
<table width="100%"><tr><td>
......
......@@ -27,13 +27,13 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-antlr</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + ANTLR</name>
<description>antlr specific task.
The implementation forks a java process, therefore the antlr jar file is only needed at runtime</description>
......@@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<optional>true</optional>
<scope>compile</scope>
</dependency>
......
......@@ -27,19 +27,19 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-bcel</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + BCEL</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -27,19 +27,19 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-bsf</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + BSF</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,19 +26,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-log4j</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Log4J</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -27,19 +27,19 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-oro</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Apache Oro</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,19 +26,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-regexp</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Apache Regexp</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,19 +26,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-resolver</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Apache Resolver</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,20 +26,20 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-xalan2</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Xalan 2</name>
<description>contains Xalan2-specific features</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,20 +26,20 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-commons-logging</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Commons Logging</name>
<description>Ant Listener based on commons-logging</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,20 +26,20 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Commons Net</name>
<description>ftp, rexec and telnet tasks</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -27,13 +27,13 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jai</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JAI</name>
<description>image task and corresponding types.
</description>
......@@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,13 +26,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-javamail</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JavaMail</name>
<description>implementation of the mail task based on javamail.
Required to send emails to SMTP servers using user/password combinations
......@@ -41,7 +41,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......@@ -50,7 +50,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<plugins>
<plugin>
......
......@@ -27,13 +27,13 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jdepend</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JDepend</name>
<description>task jdepend invoking the jdepend parser. There is also a version 2.9.1 of the
jdepend parser available on the maven repository</description>
......@@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,13 +26,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jmf</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JMF</name>
<description>contains the sound task and a soundplayer listener
download the dependency from http://java.sun.com/products/java-media/jmf/</description>
......@@ -40,7 +40,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
......
......@@ -26,13 +26,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JSch</name>
<description>contains the sshexec and scp tasks
</description>
......@@ -40,7 +40,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,20 +26,20 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JUnit</name>
<description>contains the junit and junirreport tasks</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,20 +26,20 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junit4</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JUnit 4</name>
<description>contains JUnit 4.x support</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,20 +26,20 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-junitlauncher</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + JUnit 5</name>
<description>contains JUnit 5.x support</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -27,13 +27,13 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant Launcher</name>
<build>
<plugins>
......
......@@ -26,13 +26,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-netrexx</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + NetRexx</name>
<description>NetRexxC task
dependency can be downloaded from http://www.ibm.com/software/awdtools/netrexx/download.html</description>
......@@ -40,7 +40,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<!-- Processed too early, before maven-antrun-plugin gets a chance to work:
......
......@@ -27,20 +27,20 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-swing</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + Swing</name>
<description>a listener and a splash task based on Swing</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
......
......@@ -27,20 +27,20 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-testutil</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant Test Utilities</name>
<description>test utility classes</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,20 +26,20 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-xz</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant + XZ for Java</name>
<description>contains the xz compression support</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -27,19 +27,19 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.4</version>
<version>1.10.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<name>Apache Ant Core</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<scope>compile</scope>
</dependency>
<dependency>
......
......@@ -26,7 +26,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<version>1.10.4</version>
<version>1.10.5</version>
<packaging>pom</packaging>
<description>master POM</description>
<licenses>
......
......@@ -20,7 +20,7 @@
<import file="../buildfiletest-base.xml"/>
<target name="setUp">
<mkdir dir="${output}"/>
<mkdir dir="${output}" />
</target>
<target name="testLineContains" depends="setUp">
......@@ -35,7 +35,7 @@
</filterchain>
</copy>
</target>
<target name="testNegateLineContains" depends="setUp">
<copy file="input/linecontains.test"
tofile="${output}/negatelinecontains.test">
......@@ -50,12 +50,12 @@
<condition>
<not>
<filesmatch file1="${output}/negatelinecontains.test"
file2="expected/negatelinecontains.test"/>
file2="expected/negatelinecontains.test" />
</not>
</condition>
</fail>
</target>
<target name="testEscapeUnicode" depends="setUp">
<copy todir="${output}" encoding="UTF-8">
<fileset dir="input">
......@@ -72,9 +72,9 @@
<target name="testStripJavaComments" depends="setUp">
<copy todir="${output}">
<fileset dir="input" includes="stripjavacomments.test"/>
<fileset dir="input" includes="stripjavacomments.test" />
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.StripJavaComments"/>
<filterreader classname="org.apache.tools.ant.filters.StripJavaComments" />
</filterchain>
</copy>
</target>
......@@ -96,7 +96,7 @@
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile" value="${basedir}/input/sample.properties"/>
</filterreader>
</filterreader>
</filterchain>
</copy>
</target>
......
......@@ -20,7 +20,7 @@
<import file="../buildfiletest-base.xml"/>
<target name="setUp">
<mkdir dir="${output}"/>
<mkdir dir="${output}" />
</target>
<!-- Testcases for HeadFilter -->
......@@ -58,7 +58,7 @@
</target>
<target name="testFilterReaderHeadLinesSkip" depends="setUp">
<copy file="input/head-tail.test"
<copy file="input/head-tail.test"
tofile="${output}/head-tail.filterReaderHeadLinesSkip.test">
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.HeadFilter">
......@@ -112,7 +112,7 @@
</target>
<target name="testFilterReaderTailLinesSkip" depends="setUp">
<copy file="input/head-tail.test"
<copy file="input/head-tail.test"
tofile="${output}/head-tail.filterReaderTailLinesSkip.test">
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.TailFilter">
......
......@@ -32,10 +32,10 @@
<fail>
<condition>
<not>
<antversion exactly="1.10.4" />
<antversion exactly="1.10.5" />
</not>
</condition>
Should be exactly 1.10.4
Should be exactly 1.10.5
</fail>
</target>
......
......@@ -20,7 +20,6 @@
<import file="../buildfiletest-base.xml"/>
<property name="dir" location="${output}" />
<basename property="dirname" file="${output}"/>
......
......@@ -424,4 +424,68 @@ redirect.err=&quot;${redirect.err}&quot; should be empty</fail>
<target name="foo" />
<target name="simpleSourceFile"
description="Tests that the single source file programs, introduced in Java 11, works as expected">
<mkdir dir="${output}/javasource"/>
<echo file="/tmp/foo.txt" message="${output}"/>
<echo file="${output}/javasource/A.java">
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.BufferedWriter;
public class A {
public static void main(String[] args) throws Exception {
final String outFile = args[0];
try(BufferedWriter bw = Files.newBufferedWriter(Paths.get(outFile));) {
bw.write("Hello world!");
}
}
}
</echo>
<java sourcefile="${output}/javasource/A.java" fork="true" failonerror="true" logerror="true">
<arg value="${output}/javasource/simpleSourceFileOutput.txt"/>
</java>
<loadfile property="simpleSourceFile.prog.output" srcfile="${output}/javasource/simpleSourceFileOutput.txt"/>
<condition property="simpleSourceFile.execution.success">
<equals arg1="${simpleSourceFile.prog.output}" arg2="Hello world!"/>
</condition>
<fail unless="simpleSourceFile.execution.success">Java source-file execution did not yield the expected
result</fail>
</target>
<target name="generateDummyJavaSource">
<mkdir dir="${output}/javasource"/>
<echo file="/tmp/foo.txt" message="${output}"/>
<echo file="${output}/javasource/ThrowsException.java">
public class ThrowsException {
public static void main(String[] args) throws Exception {
throw new RuntimeException("Wasn't expected to be run");
}
}
</echo>
</target>
<target name="sourceFileRequiresFork" depends="generateDummyJavaSource">
<java sourcefile="${output}/javasource/ThrowsException.java" failonerror="true" logerror="true"/>
<fail>Execution of java task, for sourcefile, was expected to fail since fork wasn't set</fail>
</target>
<target name="sourceFileCantUseClassname" depends="generateDummyJavaSource">
<java classname="foo.bar" sourcefile="${output}/javasource/ThrowsException.java"
fork="true" failonerror="true" logerror="true"/>
<fail>Execution of java task, for sourcefile, was expected to fail since classname attribute was set</fail>
</target>
<target name="sourceFileCantUseJar" depends="generateDummyJavaSource">
<java jar="irrelevant.jar" sourcefile="${output}/javasource/ThrowsException.java"
fork="true" failonerror="true" logerror="true"/>
<fail>Execution of java task, for sourcefile, was expected to fail since jar attribute was set</fail>
</target>
<target name="sourceFileCantUseModule" depends="generateDummyJavaSource">
<java module="irrelevant" sourcefile="${output}/javasource/ThrowsException.java"
fork="true" failonerror="true" logerror="true"/>
<fail>Execution of java task, for sourcefile, was expected to fail since module attribute was set</fail>
</target>
</project>
......@@ -37,7 +37,7 @@
</target>
<target name="test5" description="Get the latest from PVCS">
<pvcs pvcsbin="/home/cvs/pvcsant/src/etc/testcases/taskdefs"
<pvcs pvcsbin="/home/cvs/pvcsant/src/etc/testcases/taskdefs"
repository="//ct4serv2/pvcs/monitor"/>
</target>
......
......@@ -332,9 +332,9 @@ public class Expand extends Task {
mappedNames = new String[] {entryName};
}
File f = fileUtils.resolveFile(dir, mappedNames[0]);
if (!allowedOutsideOfDest && !fileUtils.isLeadingPath(dir, f)) {
log("skipping " + entryName + " as its target " + f + " is outside of "
+ dir + ".", Project.MSG_VERBOSE);
if (!allowedOutsideOfDest && !fileUtils.isLeadingPath(dir, f, true)) {
log("skipping " + entryName + " as its target " + f.getCanonicalPath()
+ " is outside of " + dir.getCanonicalPath() + ".", Project.MSG_VERBOSE);
return;
}
......
......@@ -693,29 +693,34 @@ public class Get extends Task {
private boolean redirectionAllowed(final URL aSource, final URL aDest) {
if (aSource.getProtocol().equals(aDest.getProtocol())
&& (HTTP.equals(aSource.getProtocol()) || HTTPS.equals(aDest.getProtocol()))) {
redirections++;
if (redirections > REDIRECT_LIMIT) {
final String message = "More than " + REDIRECT_LIMIT
+ " times redirected, giving up";
if (ignoreErrors) {
log(message, logLevel);
return false;
}
if (!(aSource.getProtocol().equals(aDest.getProtocol()) || (HTTP
.equals(aSource.getProtocol()) && HTTPS.equals(aDest
.getProtocol())))) {
final String message = "Redirection detected from "
+ aSource.getProtocol() + " to " + aDest.getProtocol()
+ ". Protocol switch unsafe, not allowed.";
if (ignoreErrors) {
log(message, logLevel);
return false;
} else {
throw new BuildException(message);
}
return true;
}
final String message = "Redirection detected from "
+ aSource.getProtocol() + " to " + aDest.getProtocol()
+ ". Protocol switch unsafe, not allowed.";
if (ignoreErrors) {
log(message, logLevel);
return false;
redirections++;
if (redirections > REDIRECT_LIMIT) {
final String message = "More than " + REDIRECT_LIMIT
+ " times redirected, giving up";
if (ignoreErrors) {
log(message, logLevel);
return false;
} else {
throw new BuildException(message);
}
}
throw new BuildException(message);
return true;
}
private URLConnection openConnection(final URL aSource) throws IOException {
......
......@@ -142,7 +142,8 @@ public class Java extends Task {
protected void checkConfiguration() throws BuildException {
String classname = getCommandLine().getClassname();
String module = getCommandLine().getModule();
if (classname == null && getCommandLine().getJar() == null && module == null) {
final String sourceFile = getCommandLine().getSourceFile();
if (classname == null && getCommandLine().getJar() == null && module == null && sourceFile == null) {
throw new BuildException("Classname must not be null.");
}
if (!fork && getCommandLine().getJar() != null) {
......@@ -153,6 +154,9 @@ public class Java extends Task {
throw new BuildException(
"Cannot execute a module in non-forked mode. Please set fork='true'. ");
}
if (!fork && sourceFile != null) {
throw new BuildException("Cannot execute sourcefile in non-forked mode. Please set fork='true'");
}
if (spawn && !fork) {
throw new BuildException(
"Cannot spawn a java process in non-forked mode. Please set fork='true'. ");
......@@ -355,12 +359,14 @@ public class Java extends Task {
*
* @param jarfile the jarfile to execute.
*
* @throws BuildException if there is also a main class specified.
* @throws BuildException if there is also a {@code classname}, {@code module}
* or {@code sourcefile} attribute specified
*/
public void setJar(File jarfile) throws BuildException {
if (getCommandLine().getClassname() != null || getCommandLine().getModule() != null) {
if (getCommandLine().getClassname() != null || getCommandLine().getModule() != null
|| getCommandLine().getSourceFile() != null) {
throw new BuildException(
"Cannot use 'jar' with 'classname' or 'module' attributes in same command.");
"Cannot use combination of 'jar', 'sourcefile', 'classname', 'module' attributes in same command");
}
getCommandLine().setJar(jarfile.getAbsolutePath());
}
......@@ -370,12 +376,12 @@ public class Java extends Task {
*
* @param s the name of the main class.
*
* @throws BuildException if the jar attribute has been set.
* @throws BuildException if there is also a {@code jar} or {@code sourcefile} attribute specified
*/
public void setClassname(String s) throws BuildException {
if (getCommandLine().getJar() != null) {
if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) {
throw new BuildException(
"Cannot use 'jar' and 'classname' attributes in same command");
"Cannot use combination of 'jar', 'classname', sourcefile attributes in same command");
}
getCommandLine().setClassname(s);
}
......@@ -385,17 +391,37 @@ public class Java extends Task {
*
* @param module the name of the module.
*
* @throws BuildException if the jar attribute has been set.
* @throws BuildException if there is also a {@code jar} or {@code sourcefile} attribute specified
* @since 1.9.7
*/
public void setModule(String module) throws BuildException {
if (getCommandLine().getJar() != null) {
if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) {
throw new BuildException(
"Cannot use 'jar' and 'module' attributes in same command");
"Cannot use combination of 'jar', 'module', sourcefile attributes in same command");
}
getCommandLine().setModule(module);
}
/**
* Set the Java source-file to execute. Support for single file source program
* execution, in Java, is only available since Java 11.
*
* @param sourceFile The path to the source file
* @throws BuildException if there is also a {@code jar}, {@code classname}
* or {@code module} attribute specified
* @since Ant 1.10.5
*/
public void setSourceFile(final String sourceFile) throws BuildException {
final String jar = getCommandLine().getJar();
final String className = getCommandLine().getClassname();
final String module = getCommandLine().getModule();
if (jar != null || className != null || module != null) {
throw new BuildException("Cannot use 'sourcefile' in combination with 'jar' or " +
"'module' or 'classname'");
}
getCommandLine().setSourceFile(sourceFile);
}
/**
* Deprecated: use nested arg instead.
* Set the command line arguments for the class.
......@@ -843,7 +869,7 @@ public class Java extends Task {
}
/**
* Executes the given classname with the given arguments in a separate VM.
* Executes the given source-file or classname with the given arguments in a separate VM.
* @param command String[] of command-line arguments.
*/
private int fork(String[] command) throws BuildException {
......@@ -1018,4 +1044,6 @@ public class Java extends Task {
public CommandlineJava.SysProperties getSysProperties() {
return getCommandLine().getSystemProperties();
}
}
......@@ -368,6 +368,28 @@ public class CommandlineJava implements Cloneable {
return null;
}
/**
* Set the source-file, to execute as single file source programs, a feature, available
* since Java 11.
*
* @param sourceFile The path to the source file
* @since Ant 1.10.5
*/
public void setSourceFile(final String sourceFile) {
this.executableType = ExecutableType.SOURCE_FILE;
javaCommand.setExecutable(sourceFile);
}
/**
* @return Returns the source-file to execute, if this command line has
* been {@link #setSourceFile(String) configured for single file source program
* execution}. Else returns null.
* @since Ant 1.10.5
*/
public String getSourceFile() {
return this.executableType == ExecutableType.SOURCE_FILE ? this.javaCommand.getExecutable() : null;
}
/**
* Set the module to execute.
* @param module the module name.
......@@ -534,9 +556,11 @@ public class CommandlineJava implements Cloneable {
} else if (executableType == ExecutableType.MODULE) {
listIterator.add("-m");
}
// this is the classname to run as well as its arguments.
// this is the classname/source-file to run as well as its arguments.
// in case of ExecutableType.JAR, the executable is a jar file,
// in case of ExecutableType.MODULE, the executable is a module name, potentially including a class name.
// in case of ExecutableType.SOURCE_FILE, the executable is a Java source file (ending in .java) or a shebang
// file containing Java source
javaCommand.addCommandToList(listIterator);
}
......@@ -887,6 +911,11 @@ public class CommandlineJava implements Cloneable {
/**
* Module execution.
*/
MODULE
MODULE,
/**
* Source file (introduced in Java 11)
*/
SOURCE_FILE,
}
}
......@@ -729,8 +729,12 @@ public class FileUtils {
* <li>DOS style paths that start with a drive letter will have
* \ as the separator.</li>
* </ul>
* Unlike {@link File#getCanonicalPath()} this method
* specifically does not resolve symbolic links.
* <p>Unlike {@link File#getCanonicalPath()} this method
* specifically does not resolve symbolic links.</p>
*
* <p>If the path tries to go beyond the file system root (i.e. it
* contains more ".." segments than can be travelled up) the
* method will return the original path unchanged.</p>
*
* @param path the path to be normalized.
* @return the normalized version of the path.
......@@ -1155,6 +1159,9 @@ public class FileUtils {
/**
* Removes a leading path from a second path.
*
* <p>This method uses {@link #normalize} under the covers and
* does not resolve symbolic links.</p>
*
* @param leading The leading path, must not be null, must be absolute.
* @param path The path to remove from, must not be null, must be absolute.
*
......@@ -1179,8 +1186,16 @@ public class FileUtils {
/**
* Learn whether one path "leads" another.
*
* <p>This method uses {@link #normalize} under the covers and
* does not resolve symbolic links.</p>
*
* <p>If either path tries to go beyond the file system root
* (i.e. it contains more ".." segments than can be travelled up)
* the method will return false.</p>
*
* @param leading The leading path, must not be null, must be absolute.
* @param path The path to remove from, must not be null, must be absolute.
* @param path The path to check, must not be null, must be absolute.
* @return true if path starts with leading; false otherwise.
* @since Ant 1.7
*/
......@@ -1195,9 +1210,42 @@ public class FileUtils {
if (!l.endsWith(File.separator)) {
l += File.separator;
}
// ensure "/foo/" is not considered a parent of "/foo/../../bar"
String up = File.separator + ".." + File.separator;
if (l.contains(up) || p.contains(up) || (p + File.separator).contains(up)) {
return false;
}
return p.startsWith(l);
}
/**
* Learn whether one path "leads" another.
*
* @param leading The leading path, must not be null, must be absolute.
* @param path The path to check, must not be null, must be absolute.
* @param resolveSymlinks whether symbolic links shall be resolved
* prior to comparing the paths.
* @return true if path starts with leading; false otherwise.
* @since Ant 1.10.5
* @throws IOException if resolveSymlinks is true and invoking
* getCanonicaPath on either argument throws an exception
*/
public boolean isLeadingPath(File leading, File path, boolean resolveSymlinks)
throws IOException {
if (!resolveSymlinks) {
return isLeadingPath(leading, path);
}
final File l = leading.getCanonicalFile();
File p = path.getCanonicalFile();
do {
if (l.equals(p)) {
return true;
}
p = p.getParentFile();
} while (p != null);
return false;
}
/**
* Constructs a <code>file:</code> URI that represents the
* external form of the given pathname.
......
......@@ -20,7 +20,7 @@
<import file="../antunit-base.xml" />
<property name="location" value="http://ant.apache.org/webtest/gettest" />
<target name="setUp">
<mkdir dir="${output}" />
</target>
......@@ -95,7 +95,7 @@
<target name="testInfiniteRedirect" unless="jenkins">
<au:expectfailure expectedmessage="More than 25 times redirected, giving up">
<au:expectfailure expectedmessage="More than 25 times redirected, giving up">
<get src="${location}/infinite.txt" dest="${output}/infinite.tmp"/>
</au:expectfailure>
</target>
......@@ -122,4 +122,13 @@
</au:assertTrue>
<au:assertLogContains text="local.cgi moved to http" />
</target>
<target name="testHttpToHttpsRedirect" description="Tests that a resource that's redirected
from HTTP to HTTPS works without an error. See bugzilla-62499 for details">
<get src="${location}/http-to-https.txt" dest="${output}/http-to-https-redirect.tmp"/>
<au:assertFileExists file="${output}/http-to-https-redirect.tmp"/>
<au:assertTrue>
<resourcecontains resource="${output}/http-to-https-redirect.tmp" substring="hello world"/>
</au:assertTrue>
</target>
</project>
......@@ -23,9 +23,9 @@ import java.io.InputStreamReader;
import java.util.stream.Collectors;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.junit.AssumptionViolatedException;
import org.junit.Before;
import org.junit.Test;
import org.junit.internal.AssumptionViolatedException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
......
......@@ -32,12 +32,14 @@ import java.io.PipedOutputStream;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.input.DefaultInputHandler;
import org.apache.tools.ant.taskdefs.condition.JavaVersion;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.TeeOutputStream;
import org.junit.Assume;
import org.junit.AssumptionViolatedException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.internal.AssumptionViolatedException;
import org.junit.rules.ExpectedException;
import static org.hamcrest.Matchers.containsString;
......@@ -106,28 +108,28 @@ public class JavaTest {
@Test
public void testJarAndClassName() {
thrown.expect(BuildException.class);
thrown.expectMessage("Cannot use 'jar' and 'classname' attributes in same command");
thrown.expectMessage("Cannot use combination of ");
buildRule.executeTarget("testJarAndClassName");
}
@Test
public void testClassnameAndJar() {
thrown.expect(BuildException.class);
thrown.expectMessage("Cannot use 'jar' with 'classname' or 'module' attributes in same command.");
thrown.expectMessage("Cannot use combination of ");
buildRule.executeTarget("testClassnameAndJar");
}
@Test
public void testJarAndModule() {
thrown.expect(BuildException.class);
thrown.expectMessage("Cannot use 'jar' and 'module' attributes in same command");
thrown.expectMessage("Cannot use combination of ");
buildRule.executeTarget("testJarAndModule");
}
@Test
public void testModuleAndJar() {
thrown.expect(BuildException.class);
thrown.expectMessage("Cannot use 'jar' with 'classname' or 'module' attributes in same command.");
thrown.expectMessage("Cannot use combination of ");
buildRule.executeTarget("testModuleAndJar");
}
......@@ -410,6 +412,78 @@ public class JavaTest {
buildRule.executeTarget("flushedInput");
}
/**
* Test that the Java single file source program feature introduced in Java 11 works fine
*
* @throws Exception
*/
@Test
public void testSimpleSourceFile() throws Exception {
requireJava11();
buildRule.executeTarget("simpleSourceFile");
}
/**
* Test that the sourcefile option of the Java task can only be run when fork attribute is set
*
* @throws Exception
*/
@Test
public void testSourceFileRequiresFork() throws Exception {
requireJava11();
thrown.expect(BuildException.class);
thrown.expectMessage("Cannot execute sourcefile in non-forked mode. Please set fork='true'");
buildRule.executeTarget("sourceFileRequiresFork");
}
/**
* Tests that the sourcefile attribute and the classname attribute of the Java task cannot be used
* together
*
* @throws Exception
*/
@Test
public void testSourceFileCantUseClassname() throws Exception {
requireJava11();
thrown.expect(BuildException.class);
thrown.expectMessage("Cannot use 'sourcefile' in combination with");
buildRule.executeTarget("sourceFileCantUseClassname");
}
/**
* Tests that the sourcefile attribute and the jar attribute of the Java task cannot be used
* together
*
* @throws Exception
*/
@Test
public void testSourceFileCantUseJar() throws Exception {
requireJava11();
thrown.expect(BuildException.class);
thrown.expectMessage("Cannot use 'sourcefile' in combination with");
buildRule.executeTarget("sourceFileCantUseJar");
}
/**
* Tests that the sourcefile attribute and the module attribute of the Java task cannot be used
* together
*
* @throws Exception
*/
@Test
public void testSourceFileCantUseModule() throws Exception {
requireJava11();
thrown.expect(BuildException.class);