You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by an...@apache.org on 2010/12/13 19:34:09 UTC
svn commit: r1045279 [7/12] - in /ant/core/branches/ANT_SITE: ./ docs/
docs/antlibs/ docs/antlibs/antunit/ docs/antlibs/compress/
docs/antlibs/dotnet/ docs/antlibs/props/ docs/antlibs/svn/ docs/manual/
docs/manual/CoreTasks/ docs/manual/CoreTypes/ docs...
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-swing/pom.xml Mon Dec 13 18:34:00 2010
@@ -27,18 +27,19 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-swing</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</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.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant-testutil/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant-testutil/pom.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant-testutil/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant-testutil/pom.xml Mon Dec 13 18:34:00 2010
@@ -27,18 +27,19 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-testutil</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
+ <name>Apache Ant Test Utilities</name>
<description>test utility classes</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/ant/pom.xml Mon Dec 13 18:34:00 2010
@@ -27,19 +27,18 @@
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.0-SNAPSHOT</version>
- <name>org.apache.tools.ant</name>
- <description>Apache Ant</description>
+ <version>1.8.2-SNAPSHOT</version>
+ <name>Apache Ant Core</name>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -93,27 +92,36 @@
<source>1.4</source>
<target>1.4</target>
<excludes>
- <exclude>org/apache/tools/ant/taskdefs/optional/**</exclude>
<exclude>org/apache/tools/ant/filters/util/JavaClassHelper*</exclude>
- <exclude>org/apache/tools/ant/types/optional/**</exclude>
<exclude>org/apache/tools/ant/types/resolver/**</exclude>
- <exclude>org/apache/tools/ant/util/ScriptRunner.java</exclude>
- <exclude>org/apache/tools/ant/util/depend/**</exclude>
- <exclude>org/apache/tools/ant/util/optional/**</exclude>
<exclude>org/apache/tools/ant/listener/Log4jListener*</exclude>
<exclude>org/apache/tools/ant/listener/CommonsLoggingListener*</exclude>
<exclude>org/apache/tools/ant/util/regexp/JakartaRegexp*</exclude>
<exclude>org/apache/tools/ant/util/regexp/JakartaOro*</exclude>
<exclude>org/apache/tools/ant/taskdefs/email/MimeMailer*</exclude>
<exclude>org/apache/tools/ant/launch/**</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/net/FTP*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/net/RExec*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/net/TelnetTask*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/perforce/*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/junit/*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/ssh/*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/image/*</exclude>
+ <exclude>org/apache/tools/ant/types/optional/image/*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/Script*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/script/**</exclude>
+ <exclude>org/apache/tools/ant/types/optional/*Script*</exclude>
+ <exclude>org/apache/tools/ant/util/ScriptRunner.java</exclude>
+ <exclude>org/apache/tools/ant/util/optional/ScriptRunner.java</exclude>
+ <exclude>org/apache/tools/ant/filters/util/JavaClassHelper*</exclude>
+ <exclude>org/apache/tools/ant/util/depend/bcel/*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/NetRexxC*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/Xalan2TraceSupport*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/jdepend/*</exclude>
</excludes>
<testExcludes>
- <exclude>org/apache/tools/ant/taskdefs/optional/**</exclude>
<exclude>org/apache/tools/ant/filters/util/JavaClassHelper*</exclude>
- <exclude>org/apache/tools/ant/types/optional/**</exclude>
<exclude>org/apache/tools/ant/types/resolver/**</exclude>
- <exclude>org/apache/tools/ant/util/depend/**</exclude>
- <exclude>org/apache/tools/ant/util/optional/**</exclude>
<exclude>org/apache/tools/ant/util/Script*</exclude>
<exclude>org/apache/tools/ant/listener/Log4jListener*</exclude>
<exclude>org/apache/tools/ant/listener/CommonsLoggingListener*</exclude>
@@ -123,6 +131,10 @@
<exclude>org/apache/tools/ant/taskdefs/email/MimeMailer*</exclude>
<exclude>org/apache/tools/ant/launch/**</exclude>
<exclude>org/apache/tools/ant/taskdefs/StyleTest*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/junit/</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/net/FTP*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/ssh/*</exclude>
+ <exclude>org/apache/tools/ant/taskdefs/optional/perforce/*</exclude>
</testExcludes>
</configuration>
</plugin>
Modified: ant/core/branches/ANT_SITE/src/etc/poms/pom.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/poms/pom.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/poms/pom.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/poms/pom.xml Mon Dec 13 18:34:00 2010
@@ -25,14 +25,22 @@ xsi:schemaLocation="http://maven.apache.
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.8.2-SNAPSHOT</version>
<packaging>pom</packaging>
<description>master POM</description>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
<name>Apache Ant</name>
<url>http://ant.apache.org/</url>
<inceptionYear>2000</inceptionYear>
<organization>
- <name>Apache Software Foundation</name>
+ <name>The Apache Software Foundation</name>
+ <url>http://www.apache.org/</url>
</organization>
<distributionManagement>
<!-- Null out inherited apache distribution repo by default -->
@@ -44,9 +52,13 @@ xsi:schemaLocation="http://maven.apache.
</distributionManagement>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/ant/core/trunk</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/jant/core/trunk</developerConnection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/ant/core/trunk</developerConnection>
<url>http://svn.apache.org/repos/asf/ant/core/trunk</url>
</scm>
+ <ciManagement>
+ <system>hudson</system>
+ <url>https://hudson.apache.org/hudson/job/Ant_BuildFromPOMs/</url>
+ </ciManagement>
<mailingLists>
<mailingList>
<name>Ant Developers List</name>
@@ -85,9 +97,9 @@ xsi:schemaLocation="http://maven.apache.
<module>ant-jmf</module>
<module>ant-jsch</module>
<module>ant-junit</module>
+ <module>ant-junit4</module>
<module>ant-launcher</module>
<module>ant-netrexx</module>
- <module>ant-nodeps</module>
<module>ant-swing</module>
<module>ant-testutil</module>
</modules>
Modified: ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/concat.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/concat.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/concat.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/concat.xml Mon Dec 13 18:34:00 2010
@@ -110,7 +110,16 @@
<touch file="${tmp.file.2}"/>
<!-- concat.xml is now older than tmp.file.2
so the following should not do anything -->
- <concat destfile="${tmp.file.2}" force="false">
+ <concat destfile="${tmp.file.2}" overwrite="false">
+ <path path="concat.xml"/>
+ </concat>
+ </target>
+
+ <target name="testoverwrite">
+ <touch file="${tmp.file.2}"/>
+ <!-- concat.xml is now older than tmp.file.2
+ so the following should still overwrite it -->
+ <concat destfile="${tmp.file.2}" overwrite="true">
<path path="concat.xml"/>
</concat>
</target>
Modified: ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/conditions/antversion.xml Mon Dec 13 18:34:00 2010
@@ -32,10 +32,10 @@
<fail>
<condition>
<not>
- <antversion exactly="1.8.1" />
+ <antversion exactly="1.8.2" />
</not>
</condition>
- Should be exactly 1.8.1
+ Should be exactly 1.8.2
</fail>
</target>
Modified: ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/optional/junit.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/optional/junit.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/optional/junit.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/optional/junit.xml Mon Dec 13 18:34:00 2010
@@ -104,7 +104,9 @@
<target name="captureToSummary">
<property name="fork" value="true"/>
- <junit fork="${fork}" printSummary="withOutAndErr">
+ <property name="enableEvents" value="false"/>
+ <junit fork="${fork}" printSummary="withOutAndErr"
+ enableTestListenerEvents="${enableEvents}">
<test name="org.apache.tools.ant.taskdefs.optional.junit.Printer"/>
<classpath refid="test"/>
</junit>
Modified: ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/signjar.xml
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/signjar.xml?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/signjar.xml (original)
+++ ant/core/branches/ANT_SITE/src/etc/testcases/taskdefs/signjar.xml Mon Dec 13 18:34:00 2010
@@ -22,8 +22,8 @@
<property name="subdir" location="${sign.dir}/subdir" />
<property name="test.jar" location="${sign.dir}/signtest.jar" />
<property name="subdirtest.jar" location="${subdir}/signtest.jar" />
-
-
+
+
<macrodef name="assertSigned">
<attribute name="jar" default="${test.jar}" />
<sequential>
@@ -46,7 +46,7 @@
</presetdef>
-
+
<presetdef name="sign">
<sign-base jar="${test.jar}" />
</presetdef>
@@ -55,13 +55,13 @@
<mkdir dir="${sign.dir}" />
<mkdir dir="${subdir}" />
</target>
-
+
<target name="jar" depends="init">
<jar jarfile="${test.jar}" basedir="${classes.dir}" includes="**/Task.class"/>
- </target>
+ </target>
+
+
-
-
<target name="clean">
<delete dir="${sign.dir}"/>
</target>
@@ -69,226 +69,37 @@
<target name="help">
<echo>This build is for use with Ant's test cases</echo>
</target>
-
+
<target name="basic" depends="jar">
<sign />
- <assertSigned/>
+ <assertSigned/>
</target>
<target name="sigfile" depends="jar">
<sign sigfile="TEST"/>
- <assertSigned/>
+ <assertSigned/>
</target>
<target name="invalidchars" depends="jar">
<sign alias="test@nly"/>
- <assertSigned/>
- </target>
-
- <target name="maxmemory" depends="jar">
- <sign maxmemory="128m"/>
- <assertSigned/>
+ <assertSigned/>
</target>
<target name="urlKeystoreFile" depends="jar">
<sign keystore="file://../testkeystore"
maxmemory="128m"/>
- <assertSigned/>
+ <assertSigned/>
</target>
-
<target name="urlKeystoreHTTP" depends="jar">
<sign
keystore="http://ant.apache.org/webtest/testkeystore"
/>
- <assertSigned/>
- </target>
-
- <target name="preserveLastModified" depends="jar">
- <touch file="${test.jar}" datetime="06/28/2000 2:02 pm"/>
- <sign
- preservelastmodified="true"/>
- <assertSigned />
- <fail message="preserveLastModified did not preserve the last modified time">
- <condition>
- <not>
- <isfileselected file="${test.jar}" >
- <date datetime="06/28/2000 2:02 pm" when="equal"/>
- </isfileselected>
- </not>
- </condition>
- </fail>
- </target>
-
- <target name="testFileset" depends="jar">
- <sign-base>
- <fileset file="${test.jar}" />
- </sign-base>
- <assertSigned/>
- </target>
-
- <target name="testFilesetAndJar" depends="jar">
- <sign-base jar="${test.jar}" lazy="true">
- <fileset file="${test.jar}" />
- </sign-base>
- <assertSigned/>
- </target>
-
- <target name="testFilesetAndSignedJar" depends="jar">
- <sign-base signedjar="${sign.dir}/newfile.jar">
- <fileset file="${test.jar}" />
- </sign-base>
- </target>
-
- <target name="testPath" depends="jar">
- <sign-base>
- <path>
- <fileset file="${test.jar}" />
- </path>
- </sign-base>
<assertSigned/>
</target>
- <target name="testPathAndJar" depends="jar">
- <sign-base jar="${test.jar}" lazy="true">
- <path>
- <fileset file="${test.jar}" />
- </path>
- </sign-base>
- <assertSigned/>
- </target>
-
- <target name="testPathAndSignedJar" depends="jar">
- <sign-base signedjar="${sign.dir}/newfile.jar">
- <path>
- <fileset file="${test.jar}" />
- </path>
- </sign-base>
- </target>
-
- <target name="testSignedJar" depends="jar">
- <sign signedjar="${subdirtest.jar}"/>
- <assertSigned jar="${subdirtest.jar}"/>
- </target>
-
- <target name="testDestDirAndSignedJar" depends="jar">
- <sign destDir="${subdir}" signedjar="${sign.dir}/newfile.jar"/>
- </target>
-
- <target name="testDestDir" depends="jar">
- <sign destDir="${subdir}" />
- <assertSigned jar="${subdirtest.jar}"/>
- </target>
-
- <target name="testDestDirFileset" depends="jar">
- <sign-base destDir="${subdir}">
- <fileset file="${test.jar}" />
- </sign-base>
- <assertSigned jar="${subdirtest.jar}"/>
- </target>
-
- <target name="testDestDirPath" depends="jar">
- <sign-base destDir="${subdir}">
- <path>
- <fileset file="${test.jar}" />
- </path>
- </sign-base>
- <assertSigned jar="${subdirtest.jar}"/>
- </target>
-
- <target name="testMapperNoDest" depends="jar">
- <sign-base >
- <flattenmapper />
- <fileset file="${test.jar}" />
- </sign-base>
- </target>
-
- <target name="testMapperFileset" depends="jar">
- <sign-base destDir="${subdir}">
- <fileset file="${test.jar}" />
- <flattenmapper />
- </sign-base>
- <assertSigned jar="${subdirtest.jar}"/>
- </target>
-
- <target name="testMapperPath" depends="jar">
- <sign-base destDir="${subdir}">
- <path>
- <pathelement location="${test.jar}" />
- </path>
- <flattenmapper />
- </sign-base>
- <assertSigned jar="${subdirtest.jar}"/>
- </target>
-
- <target name="testTwoMappers" depends="jar">
- <sign-base destDir="${subdir}">
- <fileset file="${test.jar}" />
- <flattenmapper />
- <flattenmapper />
- </sign-base>
- </target>
-
- <target name="testNoAlias" depends="jar">
- <signjar keystore="testkeystore"
- jar="${test.jar}"
- storepass="apacheant"/>
- </target>
-
- <target name="testNoFiles" >
- <sign-base />
- </target>
-
- <target name="testNoStorePass" depends="jar">
- <signjar keystore="testkeystore"
- alias="testonly"
- jar="${test.jar}"/>
- </target>
-
<target name="testTsaLocalhost" depends="jar">
<sign tsaurl="http://localhost:0/" />
</target>
-
- <target name="testSysProperty" depends="jar">
- <sign>
- <sysproperty key="ant.home" value="${ant.home}" />
- </sign>
- <assertSigned/>
- </target>
-
- <target name="testVerifyJar" depends="basic">
- <verify-base jar="${test.jar}"/>
- </target>
-
- <target name="testVerifyJarCertificates" depends="basic">
- <verify-base jar="${test.jar}" certificates="true" verbose="true"/>
- </target>
-
- <target name="testVerifyJarUnsigned" depends="jar">
- <verify-base jar="${test.jar}"/>
- </target>
-
- <target name="testVerifyJarNotInKeystore" depends="basic">
- <verifyjar jar="${test.jar}" certificates="true" verbose="true"/>
- </target>
-
- <target name="testVerifyFileset" depends="basic">
- <verify-base >
- <fileset file="${test.jar}" />
- </verify-base>
- </target>
- <target name="testVerifyPath" depends="basic">
- <verify-base >
- <path>
- <pathelement location="${test.jar}" />
- </path>
- </verify-base>
- </target>
-
- <target name="testVerifyNoArgs">
- <verify-base />
- </target>
-
</project>
-
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ComponentHelper.java Mon Dec 13 18:34:00 2010
@@ -1096,11 +1096,6 @@ public class ComponentHelper {
return getTypeClass((String) key);
}
- Object create(String name) {
- AntTypeDefinition def = getDefinition(name);
- return (def == null) ? null : def.create(project);
- }
-
Class getTypeClass(String name) {
AntTypeDefinition def = getDefinition(name);
return (def == null) ? null : def.getTypeClass(project);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DemuxInputStream.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DemuxInputStream.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DemuxInputStream.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DemuxInputStream.java Mon Dec 13 18:34:00 2010
@@ -30,6 +30,7 @@ import java.io.InputStream;
*/
public class DemuxInputStream extends InputStream {
+ private static final int MASK_8BIT = 0xFF;
/**
* The project to from which to get input.
*/
@@ -54,7 +55,7 @@ public class DemuxInputStream extends In
if (project.demuxInput(buffer, 0, 1) == -1) {
return -1;
}
- return buffer[0];
+ return buffer[0] & MASK_8BIT;
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Diagnostics.java Mon Dec 13 18:34:00 2010
@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant;
-import org.apache.tools.ant.util.LoaderUtils;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.JAXPUtils;
import org.apache.tools.ant.util.ProxySetup;
@@ -72,7 +71,6 @@ public final class Diagnostics {
private static final int SECONDS_PER_MILLISECOND = 1000;
private static final int SECONDS_PER_MINUTE = 60;
private static final int MINUTES_PER_HOUR = 60;
- private static final String TEST_CLASS = "org.apache.tools.ant.taskdefs.optional.EchoProperties";
/**
* The error text when a security manager blocks access to a property.
@@ -87,42 +85,19 @@ public final class Diagnostics {
}
/**
- * Check if optional tasks are available. Not that it does not check
- * for implementation version. Use <tt>validateVersion()</tt> for this.
- * @return <tt>true</tt> if optional tasks are available.
+ * Doesn't do anything.
+ * @deprecated Obsolete since Ant 1.8.2
+ * @return <tt>true</tt>
*/
public static boolean isOptionalAvailable() {
- try {
- Class.forName(TEST_CLASS);
- } catch (ClassNotFoundException e) {
- return false;
- }
return true;
}
/**
- * Check if core and optional implementation version do match.
- * @throws BuildException if the implementation version of optional tasks
- * does not match the core implementation version.
+ * Doesn't do anything.
+ * @deprecated Obsolete since Ant 1.8.2
*/
public static void validateVersion() throws BuildException {
- try {
- Class optional = Class.forName(TEST_CLASS);
- String coreVersion = getImplementationVersion(Main.class);
- String optionalVersion = getImplementationVersion(optional);
-
- if (coreVersion != null && !coreVersion.equals(optionalVersion)) {
- throw new BuildException("Invalid implementation version "
- + "between Ant core and Ant optional tasks.\n"
- + " core : " + coreVersion + " in "
- + getClassLocation(Main.class)
- + "\n" + " optional: " + optionalVersion + " in "
- + getClassLocation(optional));
- }
- } catch (ClassNotFoundException e) {
- // ignore
- ignoreThrowable(e);
- }
}
/**
@@ -332,16 +307,6 @@ public final class Diagnostics {
out.println("core tasks : " + getImplementationVersion(Main.class)
+ " in " + getClassLocation(Main.class));
- Class optional = null;
- try {
- optional = Class.forName(TEST_CLASS);
- out.println("optional tasks : " + getImplementationVersion(optional)
- + " in " + getClassLocation(optional));
- } catch (ClassNotFoundException e) {
- ignoreThrowable(e);
- out.println("optional tasks : not available");
- }
-
header(out, "ANT PROPERTIES");
doReportAntProperties(out);
@@ -433,6 +398,12 @@ public final class Diagnostics {
out.println(MagicNames.ANT_VERSION + ": " + p.getProperty(MagicNames.ANT_VERSION));
out.println(MagicNames.ANT_JAVA_VERSION + ": "
+ p.getProperty(MagicNames.ANT_JAVA_VERSION));
+ out.println("Is this the Apache Harmony VM? "
+ + (JavaEnvUtils.isApacheHarmony() ? "yes" : "no"));
+ out.println("Is this the Kaffe VM? "
+ + (JavaEnvUtils.isKaffe() ? "yes" : "no"));
+ out.println("Is this gij/gcj? "
+ + (JavaEnvUtils.isGij() ? "yes" : "no"));
out.println(MagicNames.ANT_LIB + ": " + p.getProperty(MagicNames.ANT_LIB));
out.println(MagicNames.ANT_HOME + ": " + p.getProperty(MagicNames.ANT_HOME));
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DirectoryScanner.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DirectoryScanner.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DirectoryScanner.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/DirectoryScanner.java Mon Dec 13 18:34:00 2010
@@ -20,7 +20,6 @@ package org.apache.tools.ant;
import java.io.File;
import java.io.IOException;
-import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -170,6 +169,26 @@ public class DirectoryScanner
SelectorUtils.DEEP_TREE_MATCH + "/.svn",
SelectorUtils.DEEP_TREE_MATCH + "/.svn/" + SelectorUtils.DEEP_TREE_MATCH,
+ // Git
+ SelectorUtils.DEEP_TREE_MATCH + "/.git",
+ SelectorUtils.DEEP_TREE_MATCH + "/.git/" + SelectorUtils.DEEP_TREE_MATCH,
+ SelectorUtils.DEEP_TREE_MATCH + "/.gitattributes",
+ SelectorUtils.DEEP_TREE_MATCH + "/.gitignore",
+ SelectorUtils.DEEP_TREE_MATCH + "/.gitmodules",
+
+ // Mercurial
+ SelectorUtils.DEEP_TREE_MATCH + "/.hg",
+ SelectorUtils.DEEP_TREE_MATCH + "/.hg/" + SelectorUtils.DEEP_TREE_MATCH,
+ SelectorUtils.DEEP_TREE_MATCH + "/.hgignore",
+ SelectorUtils.DEEP_TREE_MATCH + "/.hgsub",
+ SelectorUtils.DEEP_TREE_MATCH + "/.hgsubstate",
+ SelectorUtils.DEEP_TREE_MATCH + "/.hgtags",
+
+ // Bazaar
+ SelectorUtils.DEEP_TREE_MATCH + "/.bzr",
+ SelectorUtils.DEEP_TREE_MATCH + "/.bzr/" + SelectorUtils.DEEP_TREE_MATCH,
+ SelectorUtils.DEEP_TREE_MATCH + "/.bzrignore",
+
// Mac
SelectorUtils.DEEP_TREE_MATCH + "/.DS_Store"
};
@@ -1228,7 +1247,7 @@ public class DirectoryScanner
TokenizedPath newPath = new TokenizedPath(path, newfiles[i]);
File file = new File(dir, newfiles[i]);
String[] children = file.list();
- if (children == null) { // probably file
+ if (children == null || (children.length == 0 && file.isFile())) {
if (isIncluded(newPath)) {
accountForIncludedFile(newPath, file);
} else {
@@ -1255,7 +1274,8 @@ public class DirectoryScanner
} else {
everythingIncluded = false;
dirsNotIncluded.addElement(name);
- if (fast && couldHoldIncluded(newPath)) {
+ if (fast && couldHoldIncluded(newPath)
+ && !contentsExcluded(newPath)) {
scandir(file, newPath, fast, children,
directoryNamesFollowed);
}
@@ -1458,7 +1478,7 @@ public class DirectoryScanner
* @param path the path to check.
* @return whether all the specified directory's contents are excluded.
*/
- private boolean contentsExcluded(TokenizedPath path) {
+ /* package */ boolean contentsExcluded(TokenizedPath path) {
for (int i = 0; i < excludePatterns.length; i++) {
if (excludePatterns[i].endsWith(SelectorUtils.DEEP_TREE_MATCH)
&& excludePatterns[i].withoutLastToken()
@@ -1783,7 +1803,7 @@ public class DirectoryScanner
*
* @since Ant 1.6.3
*/
- private synchronized void ensureNonPatternSetsReady() {
+ /* package */ synchronized void ensureNonPatternSetsReady() {
if (!areNonPatternSetsReady) {
includePatterns = fillNonPatternSet(includeNonPatterns, includes);
excludePatterns = fillNonPatternSet(excludeNonPatterns, excludes);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Main.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Main.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Main.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Main.java Mon Dec 13 18:34:00 2010
@@ -20,7 +20,6 @@ package org.apache.tools.ant;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -37,6 +36,7 @@ import java.util.Vector;
import org.apache.tools.ant.input.DefaultInputHandler;
import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.launch.AntMain;
+import org.apache.tools.ant.property.ResolvePropertyMap;
import org.apache.tools.ant.util.ClasspathUtils;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.ProxySetup;
@@ -193,7 +193,6 @@ public class Main implements AntMain {
ClassLoader coreLoader) {
try {
- Diagnostics.validateVersion();
processArgs(args);
} catch (Throwable exc) {
handleLogfile();
@@ -763,12 +762,20 @@ public class Main implements AntMain {
project.init();
+ // resolve properties
+ PropertyHelper propertyHelper
+ = (PropertyHelper) PropertyHelper.getPropertyHelper(project);
+ HashMap props = new HashMap(definedProps);
+ new ResolvePropertyMap(project, propertyHelper,
+ propertyHelper.getExpanders())
+ .resolveAllProperties(props, null, false);
+
// set user-define properties
- Enumeration e = definedProps.keys();
- while (e.hasMoreElements()) {
- String arg = (String) e.nextElement();
- String value = (String) definedProps.get(arg);
- project.setUserProperty(arg, value);
+ for (Iterator e = props.entrySet().iterator(); e.hasNext(); ) {
+ Map.Entry ent = (Map.Entry) e.next();
+ String arg = (String) ent.getKey();
+ Object value = ent.getValue();
+ project.setUserProperty(arg, String.valueOf(value));
}
project.setUserProperty(MagicNames.ANT_FILE,
@@ -787,7 +794,8 @@ public class Main implements AntMain {
if (projectHelp) {
printDescription(project);
- printTargets(project, msgOutputLevel > Project.MSG_INFO);
+ printTargets(project, msgOutputLevel > Project.MSG_INFO,
+ msgOutputLevel > Project.MSG_VERBOSE);
return;
}
@@ -1001,7 +1009,7 @@ public class Main implements AntMain {
in.close();
StringBuffer msg = new StringBuffer();
- msg.append("Apache Ant version ");
+ msg.append("Apache Ant(TM) version ");
msg.append(props.getProperty("VERSION"));
msg.append(" compiled on ");
msg.append(props.getProperty("DATE"));
@@ -1072,7 +1080,8 @@ public class Main implements AntMain {
* @param printSubTargets Whether or not subtarget names should also be
* printed.
*/
- private static void printTargets(Project project, boolean printSubTargets) {
+ private static void printTargets(Project project, boolean printSubTargets,
+ boolean printDependencies) {
// find the target with the longest name
int maxLength = 0;
Map ptargets = removeDuplicateTargets(project.getTargets());
@@ -1083,7 +1092,9 @@ public class Main implements AntMain {
// on the presence of a description
Vector topNames = new Vector();
Vector topDescriptions = new Vector();
+ Vector/*<Enumeration<String>>*/ topDependencies = new Vector();
Vector subNames = new Vector();
+ Vector/*<Enumeration<String>>*/ subDependencies = new Vector();
for (Iterator i = ptargets.values().iterator(); i.hasNext();) {
currentTarget = (Target) i.next();
@@ -1096,6 +1107,9 @@ public class Main implements AntMain {
if (targetDescription == null) {
int pos = findTargetPosition(subNames, targetName);
subNames.insertElementAt(targetName, pos);
+ if (printDependencies) {
+ subDependencies.insertElementAt(currentTarget.getDependencies(), pos);
+ }
} else {
int pos = findTargetPosition(topNames, targetName);
topNames.insertElementAt(targetName, pos);
@@ -1103,18 +1117,21 @@ public class Main implements AntMain {
if (targetName.length() > maxLength) {
maxLength = targetName.length();
}
+ if (printDependencies) {
+ topDependencies.insertElementAt(currentTarget.getDependencies(), pos);
+ }
}
}
- printTargets(project, topNames, topDescriptions, "Main targets:",
- maxLength);
+ printTargets(project, topNames, topDescriptions, topDependencies,
+ "Main targets:", maxLength);
//if there were no main targets, we list all subtargets
//as it means nothing has a description
if (topNames.size() == 0) {
printSubTargets = true;
}
if (printSubTargets) {
- printTargets(project, subNames, null, "Other targets:", 0);
+ printTargets(project, subNames, null, subDependencies, "Other targets:", 0);
}
String defaultTarget = project.getDefaultTarget();
@@ -1157,6 +1174,9 @@ public class Main implements AntMain {
* no descriptions are displayed.
* If non-<code>null</code>, this should have
* as many elements as <code>names</code>.
+ * @param topDependencies The list of dependencies for each target.
+ * The dependencies are listed as a non null
+ * enumeration of String.
* @param heading The heading to display.
* Should not be <code>null</code>.
* @param maxlen The maximum length of the names of the targets.
@@ -1165,7 +1185,8 @@ public class Main implements AntMain {
* <i>are</i> shorter than this).
*/
private static void printTargets(Project project, Vector names,
- Vector descriptions, String heading,
+ Vector descriptions, Vector dependencies,
+ String heading,
int maxlen) {
// now, start printing the targets and their descriptions
String lSep = System.getProperty("line.separator");
@@ -1185,6 +1206,19 @@ public class Main implements AntMain {
msg.append(descriptions.elementAt(i));
}
msg.append(lSep);
+ if (!dependencies.isEmpty()) {
+ Enumeration deps = (Enumeration) dependencies.elementAt(i);
+ if (deps.hasMoreElements()) {
+ msg.append(" depends on: ");
+ while (deps.hasMoreElements()) {
+ msg.append(deps.nextElement());
+ if (deps.hasMoreElements()) {
+ msg.append(", ");
+ }
+ }
+ msg.append(lSep);
+ }
+ }
}
project.log(msg.toString(), Project.MSG_WARN);
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Project.java Mon Dec 13 18:34:00 2010
@@ -729,7 +729,9 @@ public class Project implements Resource
* no default target.
*/
public void setDefault(String defaultTarget) {
- setUserProperty(MagicNames.PROJECT_DEFAULT_TARGET, defaultTarget);
+ if (defaultTarget != null) {
+ setUserProperty(MagicNames.PROJECT_DEFAULT_TARGET, defaultTarget);
+ }
this.defaultTarget = defaultTarget;
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelper.java Mon Dec 13 18:34:00 2010
@@ -82,6 +82,59 @@ public class ProjectHelper {
helper.parse(project, buildFile);
}
+ /**
+ * Possible value for target's onMissingExtensionPoint attribute. It determines how to deal with
+ * targets that want to extend missing extension-points.
+ * <p>
+ * This class behaves like a Java 1.5 Enum class.
+ *
+ * @since 1.8.2
+ */
+ public final static class OnMissingExtensionPoint {
+
+ /** fail if the extension-point is not defined */
+ public static final OnMissingExtensionPoint FAIL = new OnMissingExtensionPoint(
+ "fail");
+
+ /** warn if the extension-point is not defined */
+ public static final OnMissingExtensionPoint WARN = new OnMissingExtensionPoint(
+ "warn");
+
+ /** ignore the extensionOf attribute if the extension-point is not defined */
+ public static final OnMissingExtensionPoint IGNORE = new OnMissingExtensionPoint(
+ "ignore");
+
+ private static final OnMissingExtensionPoint[] values = new OnMissingExtensionPoint[] {
+ FAIL, WARN, IGNORE };
+
+ private final String name;
+
+ private OnMissingExtensionPoint(String name) {
+ this.name = name;
+ }
+
+ public String name() {
+ return name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public static OnMissingExtensionPoint valueOf(String name) {
+ if (name == null) {
+ throw new NullPointerException();
+ }
+ for (int i = 0; i < values.length; i++) {
+ if (name.equals(values[i].name())) {
+ return values[i];
+ }
+ }
+ throw new IllegalArgumentException(
+ "Unknown onMissingExtensionPoint " + name);
+ }
+ }
+
/** Default constructor */
public ProjectHelper() {
}
@@ -108,9 +161,10 @@ public class ProjectHelper {
* Extension stack.
* Used to keep track of targets that extend extension points.
*
- * @return a list of two element string arrays where the first
- * element is the name of the extensionpoint and the second the
- * name of the target
+ * @return a list of three element string arrays where the first
+ * element is the name of the extensionpoint, the second the name
+ * of the target and the third the name of the enum like class
+ * {@link OnMissingExtensionPoint}.
*/
public List getExtensionStack() {
return extensionStack;
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelperRepository.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelperRepository.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelperRepository.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/ProjectHelperRepository.java Mon Dec 13 18:34:00 2010
@@ -34,7 +34,7 @@ import org.apache.tools.ant.util.LoaderU
/**
* Repository of {@link ProjectHelper} found in the classpath or via
* some System properties.
-
+ *
* <p>See the ProjectHelper documentation in the manual.</p>
*
* @since Ant 1.8.0
@@ -57,6 +57,18 @@ public class ProjectHelperRepository {
private static final Class[] NO_CLASS = new Class[0];
private static final Object[] NO_OBJECT = new Object[0];
+ private static Constructor PROJECTHELPER2_CONSTRUCTOR;
+
+ static {
+ try {
+ PROJECTHELPER2_CONSTRUCTOR = ProjectHelper2.class
+ .getConstructor(NO_CLASS);
+ } catch (Exception e) {
+ // ProjectHelper2 must be available
+ throw new RuntimeException(e);
+ }
+ }
+
public static ProjectHelperRepository getInstance() {
return instance;
}
@@ -67,7 +79,7 @@ public class ProjectHelperRepository {
private void collectProjectHelpers() {
// First, try the system property
- ProjectHelper projectHelper = getProjectHelperBySystemProperty();
+ Constructor projectHelper = getProjectHelperBySystemProperty();
registerProjectHelper(projectHelper);
// A JDK1.3 'service' ( like in JAXP ). That will plug a helper
@@ -100,35 +112,63 @@ public class ProjectHelperRepository {
e.printStackTrace(System.err);
}
}
+ }
- // last but not least, ant default project helper
- projectHelper = new ProjectHelper2();
- registerProjectHelper(projectHelper);
+ /**
+ * Register the specified project helper into the repository.
+ * <p>
+ * The helper will be added after all the already registered helpers, but
+ * before the default one (ProjectHelper2)
+ *
+ * @param helperClassName
+ * the fully qualified name of the helper
+ * @throws BuildException
+ * if the class cannot be loaded or if there is no constructor
+ * with no argument
+ * @since Ant 1.8.2
+ */
+ public void registerProjectHelper(String helperClassName)
+ throws BuildException {
+ registerProjectHelper(getHelperConstructor(helperClassName));
}
- private void registerProjectHelper(ProjectHelper projectHelper) {
- if (projectHelper == null) {
+ /**
+ * Register the specified project helper into the repository.
+ * <p>
+ * The helper will be added after all the already registered helpers, but
+ * before the default one (ProjectHelper2)
+ *
+ * @param helperClass
+ * the class of the helper
+ * @throws BuildException
+ * if there is no constructor with no argument
+ * @since Ant 1.8.2
+ */
+ public void registerProjectHelper(Class helperClass) throws BuildException {
+ try {
+ registerProjectHelper(helperClass.getConstructor(NO_CLASS));
+ } catch (NoSuchMethodException e) {
+ throw new BuildException("Couldn't find no-arg constructor in "
+ + helperClass.getName());
+ }
+ }
+
+ private void registerProjectHelper(Constructor helperConstructor) {
+ if (helperConstructor == null) {
return;
}
if (DEBUG) {
- System.out.println("ProjectHelper " +
- projectHelper.getClass().getName()
- + " registered.");
- }
- try {
- helpers.add(projectHelper.getClass().getConstructor(NO_CLASS));
- } catch (NoSuchMethodException nse) {
- // impossible to get here
- throw new BuildException("Couldn't find no-arg constructor in "
- + projectHelper.getClass().getName());
+ System.out.println("ProjectHelper "
+ + helperConstructor.getClass().getName() + " registered.");
}
+ helpers.add(helperConstructor);
}
- private ProjectHelper getProjectHelperBySystemProperty() {
+ private Constructor getProjectHelperBySystemProperty() {
String helperClass = System.getProperty(ProjectHelper.HELPER_PROPERTY);
try {
if (helperClass != null) {
- return newHelper(helperClass);
+ return getHelperConstructor(helperClass);
}
} catch (SecurityException e) {
System.err.println("Unable to load ProjectHelper class \""
@@ -142,7 +182,7 @@ public class ProjectHelperRepository {
return null;
}
- private ProjectHelper getProjectHelperByService(InputStream is) {
+ private Constructor getProjectHelperByService(InputStream is) {
try {
// This code is needed by EBCDIC and other strange systems.
// It's a fix for bugs reported in xerces
@@ -158,7 +198,7 @@ public class ProjectHelperRepository {
rd.close();
if (helperClassName != null && !"".equals(helperClassName)) {
- return newHelper(helperClassName);
+ return getHelperConstructor(helperClassName);
}
} catch (Exception e) {
System.out.println("Unable to load ProjectHelper from service "
@@ -171,21 +211,21 @@ public class ProjectHelperRepository {
}
/**
- * Creates a new helper instance from the name of the class. It'll
- * first try the thread class loader, then Class.forName() will
- * load from the same loader that loaded this class.
+ * Get the constructor with not argument of an helper from its class name.
+ * It'll first try the thread class loader, then Class.forName() will load
+ * from the same loader that loaded this class.
*
* @param helperClass
* The name of the class to create an instance of. Must not be
* <code>null</code>.
*
- * @return a new instance of the specified class.
+ * @return the constructor of the specified class.
*
* @exception BuildException
- * if the class cannot be found or cannot be appropriate
- * instantiated.
+ * if the class cannot be found or if a constructor with no
+ * argument cannot be found.
*/
- private ProjectHelper newHelper(String helperClass) throws BuildException {
+ private Constructor getHelperConstructor(String helperClass) throws BuildException {
ClassLoader classLoader = LoaderUtils.getContextClassLoader();
try {
Class clazz = null;
@@ -199,7 +239,7 @@ public class ProjectHelperRepository {
if (clazz == null) {
clazz = Class.forName(helperClass);
}
- return ((ProjectHelper) clazz.newInstance());
+ return clazz.getConstructor(NO_CLASS);
} catch (Exception e) {
throw new BuildException(e);
}
@@ -266,17 +306,25 @@ public class ProjectHelperRepository {
private static class ConstructingIterator implements Iterator {
private final Iterator nested;
+ private boolean empty = false;
ConstructingIterator(Iterator nested) {
this.nested = nested;
}
public boolean hasNext() {
- return nested.hasNext();
+ return nested.hasNext() || !empty;
}
public Object next() {
- Constructor c = (Constructor) nested.next();
+ Constructor c;
+ if (nested.hasNext()) {
+ c = (Constructor) nested.next();
+ } else {
+ // last but not least, ant default project helper
+ empty = true;
+ c = PROJECTHELPER2_CONSTRUCTOR;
+ }
try {
return c.newInstance(NO_OBJECT);
} catch (Exception e) {
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Target.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Target.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Target.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Target.java Mon Dec 13 18:34:00 2010
@@ -46,7 +46,7 @@ public class Target implements TaskConta
private String unlessCondition = "";
/** List of targets this target is dependent on. */
- private List dependencies = null;
+ private List/*<String>*/ dependencies = null;
/** Children of this target (tasks and data types). */
private List children = new ArrayList();
@@ -245,7 +245,7 @@ public class Target implements TaskConta
/**
* Returns an enumeration of the dependencies of this target.
*
- * @return an enumeration of the dependencies of this target
+ * @return an enumeration of the dependencies of this target (enumeration of String)
*/
public Enumeration getDependencies() {
return Collections
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Task.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Task.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Task.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/Task.java Mon Dec 13 18:34:00 2010
@@ -408,7 +408,7 @@ public abstract class Task extends Proje
replacement.setProject(getProject());
replacement.setTaskType(taskType);
replacement.setTaskName(taskName);
- replacement.setLocation(location);
+ replacement.setLocation(getLocation());
replacement.setOwningTarget(target);
replacement.setRuntimeConfigurableWrapper(wrapper);
wrapper.setProxy(replacement);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/UnknownElement.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/UnknownElement.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/UnknownElement.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/UnknownElement.java Mon Dec 13 18:34:00 2010
@@ -269,9 +269,9 @@ public class UnknownElement extends Task
*/
protected void handleErrorFlush(String output) {
if (realThing instanceof Task) {
- ((Task) realThing).handleErrorOutput(output);
+ ((Task) realThing).handleErrorFlush(output);
} else {
- super.handleErrorOutput(output);
+ super.handleErrorFlush(output);
}
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java Mon Dec 13 18:34:00 2010
@@ -24,6 +24,7 @@ import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Parameter;
import org.apache.tools.ant.types.RegularExpression;
import org.apache.tools.ant.util.regexp.Regexp;
+import org.apache.tools.ant.util.regexp.RegexpUtil;
/**
* Filter which includes only those lines that contain the user-specified
@@ -49,9 +50,12 @@ public final class LineContainsRegExp
/** Parameter name for the regular expression to filter on. */
private static final String REGEXP_KEY = "regexp";
- /** Parameter name for the words to filter on. */
+ /** Parameter name for the negate attribute. */
private static final String NEGATE_KEY = "negate";
+ /** Parameter name for the casesensitive attribute. */
+ private static final String CS_KEY = "casesensitive";
+
/** Vector that holds the expressions that input lines must contain. */
private Vector regexps = new Vector();
@@ -63,6 +67,7 @@ public final class LineContainsRegExp
private String line = null;
private boolean negate = false;
+ private int regexpOptions = Regexp.MATCH_DEFAULT;
/**
* Constructor for "dummy" instances.
@@ -118,7 +123,7 @@ public final class LineContainsRegExp
RegularExpression regexp
= (RegularExpression) regexps.elementAt(i);
Regexp re = regexp.getRegexp(getProject());
- matches = re.matches(line);
+ matches = re.matches(line, regexpOptions);
}
if (matches ^ isNegated()) {
break;
@@ -182,6 +187,10 @@ public final class LineContainsRegExp
LineContainsRegExp newFilter = new LineContainsRegExp(rdr);
newFilter.setRegexps(getRegexps());
newFilter.setNegate(isNegated());
+ newFilter
+ .setCaseSensitive(!RegexpUtil.hasFlag(regexpOptions,
+ Regexp.MATCH_CASE_INSENSITIVE)
+ );
return newFilter;
}
@@ -194,6 +203,14 @@ public final class LineContainsRegExp
}
/**
+ * Whether to match casesensitevly.
+ * @since Ant 1.8.2
+ */
+ public void setCaseSensitive(boolean b) {
+ regexpOptions = RegexpUtil.asOptions(b);
+ }
+
+ /**
* Find out whether we have been negated.
* @return boolean negation flag.
*/
@@ -215,6 +232,8 @@ public final class LineContainsRegExp
regexps.addElement(regexp);
} else if (NEGATE_KEY.equals(params[i].getType())) {
setNegate(Project.toBoolean(params[i].getValue()));
+ } else if (CS_KEY.equals(params[i].getType())) {
+ setCaseSensitive(Project.toBoolean(params[i].getValue()));
}
}
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/TokenFilter.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/TokenFilter.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/TokenFilter.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/filters/TokenFilter.java Mon Dec 13 18:34:00 2010
@@ -29,6 +29,7 @@ import org.apache.tools.ant.util.Tokeniz
import org.apache.tools.ant.util.LineTokenizer;
import org.apache.tools.ant.util.StringUtils;
import org.apache.tools.ant.util.regexp.Regexp;
+import org.apache.tools.ant.util.regexp.RegexpUtil;
/**
* This splits up input into tokens and passes
@@ -705,22 +706,6 @@ public class TokenFilter extends BaseFil
* @return the Regexp option bits
*/
public static int convertRegexOptions(String flags) {
- if (flags == null) {
- return 0;
- }
- int options = 0;
- if (flags.indexOf('g') != -1) {
- options |= Regexp.REPLACE_ALL;
- }
- if (flags.indexOf('i') != -1) {
- options |= Regexp.MATCH_CASE_INSENSITIVE;
- }
- if (flags.indexOf('m') != -1) {
- options |= Regexp.MATCH_MULTILINE;
- }
- if (flags.indexOf('s') != -1) {
- options |= Regexp.MATCH_SINGLELINE;
- }
- return options;
+ return RegexpUtil.asOptions(flags);
}
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelper2.java Mon Dec 13 18:34:00 2010
@@ -59,6 +59,7 @@ import java.util.Stack;
*
*/
public class ProjectHelper2 extends ProjectHelper {
+
/** Reference holding the (ordered) target Vector */
public static final String REFID_TARGETS = "ant.targets";
@@ -183,21 +184,30 @@ public class ProjectHelper2 extends Proj
String[] extensionInfo = (String[]) i.next();
String tgName = extensionInfo[0];
String name = extensionInfo[1];
+ OnMissingExtensionPoint missingBehaviour = OnMissingExtensionPoint
+ .valueOf(extensionInfo[2]);
Hashtable projectTargets = project.getTargets();
if (!projectTargets.containsKey(tgName)) {
- throw new BuildException("can't add target "
- + name + " to extension-point "
- + tgName
- + " because the extension-point"
- + " is unknown.");
- }
- Target t = (Target) projectTargets.get(tgName);
- if (!(t instanceof ExtensionPoint)) {
- throw new BuildException("referenced target "
- + tgName
- + " is not an extension-point");
+ String message = "can't add target " + name
+ + " to extension-point " + tgName
+ + " because the extension-point is unknown.";
+ if (missingBehaviour == OnMissingExtensionPoint.FAIL) {
+ throw new BuildException(message);
+ } else if (missingBehaviour == OnMissingExtensionPoint.WARN) {
+ Target target = (Target) projectTargets.get(name);
+ context.getProject().log(target,
+ "Warning: " + message,
+ Project.MSG_WARN);
+ }
+ } else {
+ Target t = (Target) projectTargets.get(tgName);
+ if (!(t instanceof ExtensionPoint)) {
+ throw new BuildException("referenced target "
+ + tgName
+ + " is not an extension-point");
+ }
+ t.addDependency(name);
}
- t.addDependency(name);
}
}
}
@@ -250,7 +260,7 @@ public class ProjectHelper2 extends Proj
buildFileName = url.toString();
} else {
throw new BuildException("Source " + source.getClass().getName()
- + " not supported by this plugin");
+ + " not supported by this plugin");
}
InputStream inputStream = null;
InputSource inputSource = null;
@@ -270,7 +280,7 @@ public class ProjectHelper2 extends Proj
uri = url.toString();
int pling = -1;
if (uri.startsWith("jar:file")
- && (pling = uri.indexOf("!")) > -1) {
+ && (pling = uri.indexOf("!/")) > -1) {
zf = new ZipFile(org.apache.tools.ant.launch.Locator
.fromJarURI(uri), "UTF-8");
inputStream =
@@ -297,7 +307,7 @@ public class ProjectHelper2 extends Proj
parser.parse(inputSource);
} catch (SAXParseException exc) {
Location location = new Location(exc.getSystemId(), exc.getLineNumber(), exc
- .getColumnNumber());
+ .getColumnNumber());
Throwable t = exc.getException();
if (t instanceof BuildException) {
@@ -317,11 +327,11 @@ public class ProjectHelper2 extends Proj
} catch (FileNotFoundException exc) {
throw new BuildException(exc);
} catch (UnsupportedEncodingException exc) {
- throw new BuildException("Encoding of project file " + buildFileName + " is invalid.",
- exc);
+ throw new BuildException("Encoding of project file " + buildFileName + " is invalid.",
+ exc);
} catch (IOException exc) {
throw new BuildException("Error reading project file " + buildFileName + ": "
- + exc.getMessage(), exc);
+ + exc.getMessage(), exc);
} finally {
FileUtils.close(inputStream);
ZipFile.closeQuietly(zf);
@@ -440,7 +450,7 @@ public class ProjectHelper2 extends Proj
public AntHandler onStartChild(String uri, String tag, String qname, Attributes attrs,
AntXMLContext context) throws SAXParseException {
throw new SAXParseException("Unexpected element \"" + qname + " \"", context
- .getLocator());
+ .getLocator());
}
/**
@@ -453,7 +463,7 @@ public class ProjectHelper2 extends Proj
* @exception SAXParseException if an error occurs
*/
public void onEndChild(String uri, String tag, String qname, AntXMLContext context)
- throws SAXParseException {
+ throws SAXParseException {
}
/**
@@ -480,7 +490,7 @@ public class ProjectHelper2 extends Proj
* case of error in an overridden version
*/
public void characters(char[] buf, int start, int count, AntXMLContext context)
- throws SAXParseException {
+ throws SAXParseException {
String s = new String(buf, start, count).trim();
if (s.length() > 0) {
@@ -548,9 +558,9 @@ public class ProjectHelper2 extends Proj
if (!file.isAbsolute()) {
file = FILE_UTILS.resolveFile(context.getBuildFileParent(), path);
context.getProject().log(
- "Warning: '" + systemId + "' in " + context.getBuildFile()
- + " should be expressed simply as '" + path.replace('\\', '/')
- + "' for compliance with other XML tools", Project.MSG_WARN);
+ "Warning: '" + systemId + "' in " + context.getBuildFile()
+ + " should be expressed simply as '" + path.replace('\\', '/')
+ + "' for compliance with other XML tools", Project.MSG_WARN);
}
context.getProject().log("file=" + file, Project.MSG_DEBUG);
try {
@@ -559,7 +569,7 @@ public class ProjectHelper2 extends Proj
return inputSource;
} catch (FileNotFoundException fne) {
context.getProject().log(file.getAbsolutePath() + " could not be found",
- Project.MSG_WARN);
+ Project.MSG_WARN);
}
}
@@ -583,7 +593,7 @@ public class ProjectHelper2 extends Proj
* <code>"project"</code>
*/
public void startElement(String uri, String tag, String qname, Attributes attrs)
- throws SAXParseException {
+ throws SAXParseException {
AntHandler next = currentHandler.onStartChild(uri, tag, qname, attrs, context);
antHandlers.push(currentHandler);
currentHandler = next;
@@ -678,10 +688,10 @@ public class ProjectHelper2 extends Proj
}
if (name.equals(qname)) {
throw new SAXParseException("Unexpected element \"{" + uri
- + "}" + name + "\" {" + ANT_CORE_URI + "}" + name, context.getLocator());
+ + "}" + name + "\" {" + ANT_CORE_URI + "}" + name, context.getLocator());
}
throw new SAXParseException("Unexpected element \"" + qname
- + "\" " + name, context.getLocator());
+ + "\" " + name, context.getLocator());
}
}
@@ -774,7 +784,7 @@ public class ProjectHelper2 extends Proj
} else {
// XXX ignore attributes in a different NS ( maybe store them ? )
throw new SAXParseException("Unexpected attribute \"" + attrs.getQName(i)
- + "\"", context.getLocator());
+ + "\"", context.getLocator());
}
}
@@ -805,8 +815,8 @@ public class ProjectHelper2 extends Proj
if (context.isIgnoringProjectTag() && !dupFile.equals(contextFile)) {
project.log("Duplicated project name in import. Project "
- + context.getCurrentProjectName() + " defined first in " + dup
- + " and again in " + contextFile, Project.MSG_WARN);
+ + context.getCurrentProjectName() + " defined first in " + dup
+ + " and again in " + contextFile, Project.MSG_WARN);
}
}
if (nameAttributeSet) {
@@ -839,7 +849,7 @@ public class ProjectHelper2 extends Proj
project.setBasedir(baseDir);
} else {
project.setBaseDir(FILE_UTILS.resolveFile(context.getBuildFileParent(),
- baseDir));
+ baseDir));
}
}
}
@@ -905,6 +915,7 @@ public class ProjectHelper2 extends Proj
String name = null;
String depends = "";
String extensionPoint = null;
+ OnMissingExtensionPoint extensionPointMissing = null;
Project project = context.getProject();
Target target = "target".equals(tag)
@@ -940,15 +951,21 @@ public class ProjectHelper2 extends Proj
target.setDescription(value);
} else if (key.equals("extensionOf")) {
extensionPoint = value;
+ } else if (key.equals("onMissingExtensionPoint")) {
+ try {
+ extensionPointMissing = OnMissingExtensionPoint.valueOf(value);
+ } catch (IllegalArgumentException e) {
+ throw new BuildException("Invalid onMissingExtensionPoint " + value);
+ }
} else {
throw new SAXParseException("Unexpected attribute \"" + key + "\"", context
- .getLocator());
+ .getLocator());
}
}
if (name == null) {
throw new SAXParseException("target element appears without a name attribute",
- context.getLocator());
+ context.getLocator());
}
String prefix = null;
@@ -978,7 +995,7 @@ public class ProjectHelper2 extends Proj
// If the name has not already been defined define it
if (projectTargets.containsKey(name)) {
project.log("Already defined in main or a previous import, ignore " + name,
- Project.MSG_VERBOSE);
+ Project.MSG_VERBOSE);
} else {
target.setName(name);
context.getCurrentTargets().put(name, target);
@@ -1008,10 +1025,16 @@ public class ProjectHelper2 extends Proj
context.getCurrentTargets().put(newName, newTarget);
project.addOrReplaceTarget(newName, newTarget);
}
+ if (extensionPointMissing != null && extensionPoint == null) {
+ throw new BuildException("onMissingExtensionPoint attribute cannot " +
+ "be specified unless extensionOf is specified",
+ target.getLocation());
+
+ }
if (extensionPoint != null) {
ProjectHelper helper =
(ProjectHelper) context.getProject().
- getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
+ getReference(ProjectHelper.PROJECTHELPER_REFERENCE);
for (Iterator iter =
Target.parseDepends(extensionPoint, name, "extensionOf")
.iterator();
@@ -1020,12 +1043,13 @@ public class ProjectHelper2 extends Proj
if (isInIncludeMode()) {
tgName = prefix + sep + tgName;
}
-
+ if (extensionPointMissing == null) {
+ extensionPointMissing = OnMissingExtensionPoint.FAIL;
+ }
// defer extensionpoint resolution until the full
// import stack has been processed
helper.getExtensionStack().add(new String[] {
- tgName, name
- });
+ tgName, name, extensionPointMissing.name() });
}
}
}
@@ -1128,7 +1152,7 @@ public class ProjectHelper2 extends Proj
task.setTaskName(qname);
Location location = new Location(context.getLocator().getSystemId(), context
- .getLocator().getLineNumber(), context.getLocator().getColumnNumber());
+ .getLocator().getLineNumber(), context.getLocator().getColumnNumber());
task.setLocation(location);
task.setOwningTarget(context.getCurrentTarget());
@@ -1159,8 +1183,8 @@ public class ProjectHelper2 extends Proj
// be namespaced, need to extract the name
// and convert from qualified name to uri/name
if (ANT_TYPE.equals(name)
- || (ANT_CORE_URI.equals(attrUri)
- && ANT_TYPE.equals(attrs.getLocalName(i)))) {
+ || (ANT_CORE_URI.equals(attrUri)
+ && ANT_TYPE.equals(attrs.getLocalName(i)))) {
name = ANT_TYPE;
int index = value.indexOf(":");
if (index >= 0) {
@@ -1168,10 +1192,10 @@ public class ProjectHelper2 extends Proj
String mappedUri = context.getPrefixMapping(prefix);
if (mappedUri == null) {
throw new BuildException("Unable to find XML NS prefix \"" + prefix
- + "\"");
+ + "\"");
}
value = ProjectHelper.genComponentName(mappedUri, value
- .substring(index + 1));
+ .substring(index + 1));
}
}
wrapper.setAttribute(name, value);
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java Mon Dec 13 18:34:00 2010
@@ -403,7 +403,7 @@ public class ProjectHelperImpl extends P
}
if (def != null && !def.equals("")) {
- helperImpl.project.setDefaultTarget(def);
+ helperImpl.project.setDefault(def);
} else {
throw new BuildException("The default attribute is required");
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/GreedyInputHandler.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/GreedyInputHandler.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/GreedyInputHandler.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/input/GreedyInputHandler.java Mon Dec 13 18:34:00 2010
@@ -31,8 +31,6 @@ import org.apache.tools.ant.util.FileUti
*/
public class GreedyInputHandler extends DefaultInputHandler {
- private static final int BUFFER_SIZE = 1024;
-
/**
* Empty no-arg constructor
*/
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/launch/Locator.java Mon Dec 13 18:34:00 2010
@@ -281,7 +281,7 @@ public final class Locator {
* @since Ant1.7.1
*/
public static String fromJarURI(String uri) {
- int pling = uri.indexOf('!');
+ int pling = uri.indexOf("!/");
String jarName = uri.substring("jar:".length(), pling);
return fromURI(jarName);
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/loader/AntClassLoader5.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/loader/AntClassLoader5.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/loader/AntClassLoader5.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/loader/AntClassLoader5.java Mon Dec 13 18:34:00 2010
@@ -19,15 +19,17 @@
package org.apache.tools.ant.loader;
import java.util.Enumeration;
+import java.io.Closeable;
import java.io.IOException;
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
/**
- * Overrides getResources which became non-final in Java5
+ * Overrides getResources which became non-final in Java5 and
+ * implements Closeable
*/
-public class AntClassLoader5 extends AntClassLoader {
+public class AntClassLoader5 extends AntClassLoader implements Closeable {
/**
* Creates a classloader for the given project using the classpath given.
*
@@ -53,4 +55,9 @@ public class AntClassLoader5 extends Ant
public Enumeration getResources(String name) throws IOException {
return getNamedResources(name);
}
+
+ /** {@inheritDoc} */
+ public void close() {
+ cleanup();
+ }
}
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java Mon Dec 13 18:34:00 2010
@@ -36,6 +36,12 @@ public class ResolvePropertyMap implemen
private final GetProperty master;
private Map map;
private String prefix;
+ // whether properties of the value side of the map should be
+ // expanded
+ private boolean prefixValues = false;
+ // whether the current getProperty call is expanding the key side
+ // of the map
+ private boolean expandingLHS = true;
/**
* Constructor with a master getproperty and a collection of expanders.
@@ -59,20 +65,32 @@ public class ResolvePropertyMap implemen
"Property " + name + " was circularly " + "defined.");
}
- // if the property has already been set to the name it will
- // have in the end, then return the existing value to ensure
- // properties remain immutable
- String masterPropertyName = name;
- if (prefix != null) {
- masterPropertyName = prefix + name;
- }
- Object masterProperty = master.getProperty(masterPropertyName);
- if (masterProperty != null) {
- return masterProperty;
- }
-
try {
+
+ // If the property we are looking up is a key in the map
+ // (first call into this method from resolveAllProperties)
+ // or we've been asked to prefix the value side (later
+ // recursive calls via the GetProperty interface) the
+ // prefix must be prepended when looking up the property
+ // outside of the map.
+ String fullKey = name;
+ if (prefix != null && (expandingLHS || prefixValues)) {
+ fullKey = prefix + name;
+ }
+
+ Object masterValue = master.getProperty(fullKey);
+ if (masterValue != null) {
+ // If the property already has a value outside of the
+ // map, use that value to enforce property
+ // immutability.
+
+ return masterValue;
+ }
+
seen.add(name);
+ expandingLHS = false;
+ // will recurse into this method for each property
+ // reference found in the map's value
return parseProperties.parseProperties((String) map.get(name));
} finally {
seen.remove(name);
@@ -82,10 +100,10 @@ public class ResolvePropertyMap implemen
/**
* The action method - resolves all the properties in a map.
* @param map the map to resolve properties in.
- * @deprecated since Ant 1.8.1, use the two-arg method instead.
+ * @deprecated since Ant 1.8.2, use the three-arg method instead.
*/
public void resolveAllProperties(Map map) {
- resolveAllProperties(map, null);
+ resolveAllProperties(map, null, false);
}
/**
@@ -93,11 +111,30 @@ public class ResolvePropertyMap implemen
* @param map the map to resolve properties in.
* @param prefix the prefix the properties defined inside the map
* will finally receive - may be null.
+ * @deprecated since Ant 1.8.2, use the three-arg method instead.
*/
public void resolveAllProperties(Map map, String prefix) {
- this.map = map; // The map gets used in the getProperty callback
+ resolveAllProperties(map, null, false);
+ }
+
+ /**
+ * The action method - resolves all the properties in a map.
+ * @param map the map to resolve properties in.
+ * @param prefix the prefix the properties defined inside the map
+ * will finally receive - may be null.
+ * @param prefixValues - whether the prefix will be applied
+ * to properties on the value side of the map as well.
+ */
+ public void resolveAllProperties(Map map, String prefix,
+ boolean prefixValues) {
+ // The map, prefix and prefixValues flag get used in the
+ // getProperty callback
+ this.map = map;
this.prefix = prefix;
+ this.prefixValues = prefixValues;
+
for (Iterator i = map.keySet().iterator(); i.hasNext();) {
+ expandingLHS = true;
String key = (String) i.next();
Object result = getProperty(key);
String value = result == null ? "" : result.toString();
Modified: ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java?rev=1045279&r1=1045278&r2=1045279&view=diff
==============================================================================
--- ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java (original)
+++ ant/core/branches/ANT_SITE/src/main/org/apache/tools/ant/taskdefs/AntStructure.java Mon Dec 13 18:34:00 2010
@@ -106,8 +106,8 @@ public class AntStructure extends Task {
while (dataTypes.hasNext()) {
String typeName = (String) dataTypes.next();
printer.printElementDecl(
- out, getProject(), typeName,
- (Class) getProject().getDataTypeDefinitions().get(typeName));
+ out, getProject(), typeName,
+ (Class) getProject().getDataTypeDefinitions().get(typeName));
}
Iterator tasks = getProject().getCopyOfTaskDefinitions().keySet()
@@ -266,13 +266,14 @@ public class AntStructure extends Task {
private void printTargetAttrs(PrintWriter out, String tag) {
out.print("<!ATTLIST ");
out.println(tag);
- out.println(" id ID #IMPLIED");
- out.println(" name CDATA #REQUIRED");
- out.println(" if CDATA #IMPLIED");
- out.println(" unless CDATA #IMPLIED");
- out.println(" depends CDATA #IMPLIED");
- out.println(" extensionOf CDATA #IMPLIED");
- out.println(" description CDATA #IMPLIED>");
+ out.println(" id ID #IMPLIED");
+ out.println(" name CDATA #REQUIRED");
+ out.println(" if CDATA #IMPLIED");
+ out.println(" unless CDATA #IMPLIED");
+ out.println(" depends CDATA #IMPLIED");
+ out.println(" extensionOf CDATA #IMPLIED");
+ out.println(" onMissingExtensionPoint CDATA #IMPLIED");
+ out.println(" description CDATA #IMPLIED>");
out.println("");
}