PR: 1277 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269038 13f79535-47bb-0310-9956-ffa450edef68master
@@ -71,6 +71,13 @@ one mapper element are required.</p> | |||||
variables are specified.</td> | variables are specified.</td> | ||||
<td align="center" valign="top">No, default is <i>false</i></td> | <td align="center" valign="top">No, default is <i>false</i></td> | ||||
</tr> | </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> | <tr> | ||||
<td valign="top">parallel</td> | <td valign="top">parallel</td> | ||||
<td valign="top">Run the command only once, appending all files as | <td valign="top">Run the command only once, appending all files as | ||||
@@ -77,6 +77,7 @@ public class Chmod extends ExecuteOn { | |||||
public Chmod() { | public Chmod() { | ||||
super.setExecutable("chmod"); | super.setExecutable("chmod"); | ||||
super.setParallel(true); | super.setParallel(true); | ||||
super.setSkipEmptyFilesets(true); | |||||
} | } | ||||
public void setFile(File src) { | 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); | 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() { | protected boolean isValidOs() { | ||||
// XXX if OS=unix | // XXX if OS=unix | ||||
return System.getProperty("path.separator").equals(":") | return System.getProperty("path.separator").equals(":") | ||||
@@ -73,6 +73,7 @@ public class ExecuteOn extends ExecTask { | |||||
private boolean parallel = false; | private boolean parallel = false; | ||||
protected String type = "file"; | protected String type = "file"; | ||||
protected Commandline.Marker srcFilePos = null; | protected Commandline.Marker srcFilePos = null; | ||||
private boolean skipEmpty = false; | |||||
/** | /** | ||||
* Adds a set of files (nested fileset attribute). | * Adds a set of files (nested fileset attribute). | ||||
@@ -95,6 +96,13 @@ public class ExecuteOn extends ExecTask { | |||||
this.type = type.getValue(); | 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 | * Marker that indicates where the name of the source file should | ||||
* be put on the command line. | * 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()]; | String[] s = new String[v.size()]; | ||||
v.copyInto(s); | v.copyInto(s); | ||||