Browse Source

Add skipemptyfilesets attributes to <execon> and <apply>.

PR: 1277


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269038 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
f0572cb75e
3 changed files with 26 additions and 0 deletions
  1. +7
    -0
      docs/manual/CoreTasks/apply.html
  2. +5
    -0
      src/main/org/apache/tools/ant/taskdefs/Chmod.java
  3. +14
    -0
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java

+ 7
- 0
docs/manual/CoreTasks/apply.html View File

@@ -71,6 +71,13 @@ one mapper element are required.</p>
variables are specified.</td>
<td align="center" valign="top">No, default is <i>false</i></td>
</tr>
<tr>
<td valign="top">skipemptyfilesets</td>
<td valign="top">Don't run the command, if no source files have
been found or are newer than their corresponding target
files.</td>
<td align="center" valign="top">No, default is <i>false</i></td>
</tr>
<tr>
<td valign="top">parallel</td>
<td valign="top">Run the command only once, appending all files as


+ 5
- 0
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -77,6 +77,7 @@ public class Chmod extends ExecuteOn {
public Chmod() {
super.setExecutable("chmod");
super.setParallel(true);
super.setSkipEmptyFilesets(true);
}

public void setFile(File src) {
@@ -194,6 +195,10 @@ public class Chmod extends ExecuteOn {
throw new BuildException(taskType+" doesn\'t support the command attribute", location);
}

public void setSkipEmptyFilesets(boolean skip) {
throw new BuildException(taskType+" doesn\'t support the skipemptyfileset attribute", location);
}

protected boolean isValidOs() {
// XXX if OS=unix
return System.getProperty("path.separator").equals(":")


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

@@ -73,6 +73,7 @@ public class ExecuteOn extends ExecTask {
private boolean parallel = false;
protected String type = "file";
protected Commandline.Marker srcFilePos = null;
private boolean skipEmpty = false;

/**
* Adds a set of files (nested fileset attribute).
@@ -95,6 +96,13 @@ public class ExecuteOn extends ExecTask {
this.type = type.getValue();
}

/**
* Should empty filesets be ignored?
*/
public void setSkipEmptyFilesets(boolean skip) {
skipEmpty = skip;
}

/**
* Marker that indicates where the name of the source file should
* be put on the command line.
@@ -138,6 +146,12 @@ public class ExecuteOn extends ExecTask {
}
}

if (v.size() == 0 && skipEmpty) {
log("Skipping fileset for directory "
+ base + ". It is empty.", Project.MSG_INFO);
continue;
}

String[] s = new String[v.size()];
v.copyInto(s);



Loading…
Cancel
Save