Browse Source

allow filenamemappers types to be placed directly as a nested element

to <copy>, <execon>, <pathconvert>, <uptodate>, unzip,unjar,unwar, <native2ascii>
testcases and docs to follow


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277130 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
0c81c851c9
6 changed files with 72 additions and 2 deletions
  1. +10
    -0
      src/main/org/apache/tools/ant/taskdefs/Copy.java
  2. +10
    -0
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  3. +10
    -0
      src/main/org/apache/tools/ant/taskdefs/Expand.java
  4. +23
    -2
      src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  5. +9
    -0
      src/main/org/apache/tools/ant/taskdefs/UpToDate.java
  6. +10
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java

+ 10
- 0
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -289,6 +289,16 @@ public class Copy extends Task {
return mapperElement;
}

/**
* A nested filenamemapper
* @param fileNameMapper the mapper to add
* @since Ant 1.6.3
*/
public void add(FileNameMapper fileNameMapper) {
createMapper().add(fileNameMapper);
}


/**
* Sets the character encoding
* @param encoding the character encoding


+ 10
- 0
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -229,6 +229,16 @@ public class ExecuteOn extends ExecTask {
return mapperElement;
}

/**
* A nested filenamemapper
* @param fileNameMapper the mapper to add
* @since Ant 1.6.3
*/
public void add(FileNameMapper fileNameMapper) {
createMapper().add(fileNameMapper);
}


/**
* @todo using taskName here is brittle, as a user could override it.
* this should probably be modified to use the classname instead.


+ 10
- 0
src/main/org/apache/tools/ant/taskdefs/Expand.java View File

@@ -336,6 +336,16 @@ public class Expand extends Task {
return mapperElement;
}

/**
* A nested filenamemapper
* @param fileNameMapper the mapper to add
* @since Ant 1.6.3
*/
public void add(FileNameMapper fileNameMapper) {
createMapper().add(fileNameMapper);
}


/**
* Sets the encoding to assume for file names and comments.
*


+ 23
- 2
src/main/org/apache/tools/ant/taskdefs/PathConvert.java View File

@@ -111,7 +111,7 @@ public class PathConvert extends Task {
* Note that this value is case-insensitive when the build is
* running on a Windows platform and case-sensitive when running on
* a Unix platform.
* @param from
* @param from the prefix string to search for
*/
public void setFrom(String from) {
this.from = from;
@@ -169,13 +169,19 @@ public class PathConvert extends Task {
* windows", "unix", "netware", and "os/2".
*/
public static class TargetOs extends EnumeratedAttribute {
/**
* @return the list of values for this enumerated attribute
*/
public String[] getValues() {
return new String[]{"windows", "unix", "netware", "os/2", "tandem"};
}
}


/** Create a nested PATH element */
/**
* Create a nested PATH element
* @return a Path to be used by ant reflection
*/
public Path createPath() {

if (isReference()) {
@@ -223,6 +229,7 @@ public class PathConvert extends Task {
* Set targetos to a platform to one of
* "windows", "unix", "netware", or "os/2"; required unless
* unless pathsep and/or dirsep are specified.
* @param target the target os
*
* @since Ant 1.5
*/
@@ -254,6 +261,7 @@ public class PathConvert extends Task {

/**
* The property into which the converted path will be placed.
* @param p the property name
*/
public void setProperty(String p) {
property = p;
@@ -263,6 +271,7 @@ public class PathConvert extends Task {
/**
* Adds a reference to a Path, FileSet, DirSet, or FileList defined
* elsewhere.
* @param r the reference to a path, fileset, dirset or filelist
*/
public void setRefid(Reference r) {
if (path != null) {
@@ -465,6 +474,18 @@ public class PathConvert extends Task {
this.mapper = mapper;
}

/**
* A nested filenamemapper
* @param fileNameMapper the mapper to add
* @since Ant 1.6.3
*/
public void add(FileNameMapper fileNameMapper) {
Mapper m = new Mapper(getProject());
m.add(fileNameMapper);
addMapper(m);
}


/**
* Validate that all our parameters have been properly initialized.
*


+ 9
- 0
src/main/org/apache/tools/ant/taskdefs/UpToDate.java View File

@@ -116,6 +116,15 @@ public class UpToDate extends Task implements Condition {
return mapperElement;
}

/**
* A nested filenamemapper
* @param fileNameMapper the mapper to add
* @since Ant 1.6.3
*/
public void add(FileNameMapper fileNameMapper) {
createMapper().add(fileNameMapper);
}

/**
* Evaluate (all) target and source file(s) to
* see if the target(s) is/are up-to-date.


+ 10
- 0
src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java View File

@@ -110,6 +110,16 @@ public class Native2Ascii extends MatchingTask {
return mapper;
}

/**
* A nested filenamemapper
* @param fileNameMapper the mapper to add
* @since Ant 1.6.3
*/
public void add(FileNameMapper fileNameMapper) {
createMapper().add(fileNameMapper);
}


/**
* Execute the task
*


Loading…
Cancel
Save