Browse Source

Fix bootstrap problems. Two issues. Filtering was always been done

Antcall was broken since the ProjectComponent check is too agressive
Now only applies to data types. The Ant task is perhaps a little special
in that it returns a task for one of its nested elements.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269463 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 24 years ago
parent
commit
9091202b2a
4 changed files with 32 additions and 11 deletions
  1. +10
    -6
      build.xml
  2. +1
    -1
      src/main/org/apache/tools/ant/FileUtils.java
  3. +5
    -4
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  4. +16
    -0
      src/main/org/apache/tools/ant/Project.java

+ 10
- 6
build.xml View File

@@ -240,16 +240,18 @@
</fileset> </fileset>
</copy> </copy>


<filter token="VERSION" value="${version}" />
<filter token="DATE" value="${TODAY}" />
<filter token="TIME" value="${TSTAMP}" />
<copy todir="${build.classes}" <copy todir="${build.classes}"
overwrite="true"
filtering="on">
overwrite="true">
<fileset dir="${java.dir}"> <fileset dir="${java.dir}">
<include name="**/version.txt" /> <include name="**/version.txt" />
<include name="**/defaultManifest.mf" /> <include name="**/defaultManifest.mf" />
</fileset> </fileset>
<filterset>
<filter token="VERSION" value="${version}" />
<filter token="DATE" value="${TODAY}" />
<filter token="TIME" value="${TSTAMP}" />
</filterset>
</copy> </copy>


<copy todir="${build.classes}/${optional.package}/junit"> <copy todir="${build.classes}/${optional.package}/junit">
@@ -308,6 +310,7 @@
<fileset dir="${script.dir}/" /> <fileset dir="${script.dir}/" />
</copy> </copy>


<!--
<fixcrlf srcdir="${dist.bin}" eol="crlf" includes="*.bat" /> <fixcrlf srcdir="${dist.bin}" eol="crlf" includes="*.bat" />
<fixcrlf srcdir="${dist.bin}" eol="lf"> <fixcrlf srcdir="${dist.bin}" eol="lf">
<include name="ant" /> <include name="ant" />
@@ -324,7 +327,8 @@
<include name="**/runant.pl" /> <include name="**/runant.pl" />
</fileset> </fileset>
</chmod> </chmod>

-->
</target> </target>


<!-- <!--


+ 1
- 1
src/main/org/apache/tools/ant/FileUtils.java View File

@@ -187,7 +187,7 @@ public class FileUtils {
parent.mkdirs(); parent.mkdirs();
} }


if (filterSet != null) {
if (filterSet != null && filterSet.hasFilters()) {
BufferedReader in = new BufferedReader(new FileReader(sourceFile)); BufferedReader in = new BufferedReader(new FileReader(sourceFile));
BufferedWriter out = new BufferedWriter(new FileWriter(destFile)); BufferedWriter out = new BufferedWriter(new FileWriter(destFile));




+ 5
- 4
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -55,6 +55,7 @@
package org.apache.tools.ant; package org.apache.tools.ant;


import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.DataType;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;


import java.lang.reflect.*; import java.lang.reflect.*;
@@ -323,8 +324,8 @@ public class IntrospectionHelper implements BuildListener {
} }
try { try {
Object nestedElement = nc.create(element); Object nestedElement = nc.create(element);
if (nestedElement instanceof ProjectComponent) {
((ProjectComponent)nestedElement).setProject(project);
if (nestedElement instanceof DataType) {
((DataType)nestedElement).setProject(project);
} }
return nestedElement; return nestedElement;
} catch (IllegalAccessException ie) { } catch (IllegalAccessException ie) {
@@ -570,8 +571,8 @@ public class IntrospectionHelper implements BuildListener {
throws InvocationTargetException, IllegalAccessException, BuildException { throws InvocationTargetException, IllegalAccessException, BuildException {
try { try {
Object attribute = c.newInstance(new String[] {value}); Object attribute = c.newInstance(new String[] {value});
if (attribute instanceof ProjectComponent) {
((ProjectComponent)attribute).setProject(p);
if (attribute instanceof DataType) {
((DataType)attribute).setProject(p);
} }
m.invoke(parent, new Object[] {attribute}); m.invoke(parent, new Object[] {attribute});
} catch (InstantiationException ie) { } catch (InstantiationException ie) {


+ 16
- 0
src/main/org/apache/tools/ant/Project.java View File

@@ -698,6 +698,8 @@ public class Project {
* specifying if token filtering must be used. * specifying if token filtering must be used.
* *
* @throws IOException * @throws IOException
*
* @deprecated
*/ */
public void copyFile(String sourceFile, String destFile, boolean filtering) public void copyFile(String sourceFile, String destFile, boolean filtering)
throws IOException { throws IOException {
@@ -710,6 +712,8 @@ public class Project {
* source files may overwrite newer destination files. * source files may overwrite newer destination files.
* *
* @throws IOException * @throws IOException
*
* @deprecated
*/ */
public void copyFile(String sourceFile, String destFile, boolean filtering, public void copyFile(String sourceFile, String destFile, boolean filtering,
boolean overwrite) throws IOException { boolean overwrite) throws IOException {
@@ -724,6 +728,8 @@ public class Project {
* to the last modified time of <code>sourceFile</code>. * to the last modified time of <code>sourceFile</code>.
* *
* @throws IOException * @throws IOException
*
* @deprecated
*/ */
public void copyFile(String sourceFile, String destFile, boolean filtering, public void copyFile(String sourceFile, String destFile, boolean filtering,
boolean overwrite, boolean preserveLastModified) boolean overwrite, boolean preserveLastModified)
@@ -737,6 +743,8 @@ public class Project {
* No filtering is performed. * No filtering is performed.
* *
* @throws IOException * @throws IOException
*
* @deprecated
*/ */
public void copyFile(File sourceFile, File destFile) throws IOException { public void copyFile(File sourceFile, File destFile) throws IOException {
FileUtils.copyFile(sourceFile, destFile); FileUtils.copyFile(sourceFile, destFile);
@@ -747,6 +755,8 @@ public class Project {
* specifying if token filtering must be used. * specifying if token filtering must be used.
* *
* @throws IOException * @throws IOException
*
* @deprecated
*/ */
public void copyFile(File sourceFile, File destFile, boolean filtering) public void copyFile(File sourceFile, File destFile, boolean filtering)
throws IOException { throws IOException {
@@ -759,6 +769,8 @@ public class Project {
* source files may overwrite newer destination files. * source files may overwrite newer destination files.
* *
* @throws IOException * @throws IOException
*
* @deprecated
*/ */
public void copyFile(File sourceFile, File destFile, boolean filtering, public void copyFile(File sourceFile, File destFile, boolean filtering,
boolean overwrite) throws IOException { boolean overwrite) throws IOException {
@@ -773,6 +785,8 @@ public class Project {
* to the last modified time of <code>sourceFile</code>. * to the last modified time of <code>sourceFile</code>.
* *
* @throws IOException * @throws IOException
*
* @deprecated
*/ */
public void copyFile(File sourceFile, File destFile, boolean filtering, public void copyFile(File sourceFile, File destFile, boolean filtering,
boolean overwrite, boolean preserveLastModified) boolean overwrite, boolean preserveLastModified)
@@ -783,6 +797,8 @@ public class Project {


/** /**
* Calls File.setLastModified(long time) in a Java 1.1 compatible way. * Calls File.setLastModified(long time) in a Java 1.1 compatible way.
*
* @deprecated
*/ */
public void setFileLastModified(File file, long time) throws BuildException { public void setFileLastModified(File file, long time) throws BuildException {
if (getJavaVersion() == JAVA_1_1) { if (getJavaVersion() == JAVA_1_1) {


Loading…
Cancel
Save