Browse Source

make <apply parallel="true"> work again even if only filesets but no other resource collections have been specified

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@326980 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
a855a6dbfa
1 changed files with 48 additions and 47 deletions
  1. +48
    -47
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java

+ 48
- 47
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -418,60 +418,62 @@ public class ExecuteOn extends ExecTask {
} }
if (resources != null) { if (resources != null) {
Iterator iter = resources.iterator(); Iterator iter = resources.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
Resource res = (Resource) iter.next(); Resource res = (Resource) iter.next();


if (!res.isExists() && ignoreMissing) { if (!res.isExists() && ignoreMissing) {
continue; continue;
} }


File base = null; File base = null;
String name = res.getName(); String name = res.getName();
if (res instanceof FileResource) { if (res instanceof FileResource) {
FileResource fr = (FileResource) res; FileResource fr = (FileResource) res;
base = fr.getBaseDir(); base = fr.getBaseDir();
if (base == null) { if (base == null) {
name = fr.getFile().getAbsolutePath(); name = fr.getFile().getAbsolutePath();
}
} }
}


if (restrict(new String[] {name}, base).length == 0) { if (restrict(new String[] {name}, base).length == 0) {
continue; continue;
} }


if ((!res.isDirectory() || !res.isExists()) if ((!res.isDirectory() || !res.isExists())
&& !FileDirBoth.DIR.equals(type)) { && !FileDirBoth.DIR.equals(type)) {
totalFiles++; totalFiles++;
} else if (res.isDirectory() && !FileDirBoth.FILE.equals(type)) { } else if (res.isDirectory()
totalDirs++; && !FileDirBoth.FILE.equals(type)) {
} else { totalDirs++;
continue; } else {
} continue;
}


baseDirs.add(base); baseDirs.add(base);
fileNames.add(name); fileNames.add(name);


if (!parallel) { if (!parallel) {
String[] command = getCommandline(name, base); String[] command = getCommandline(name, base);
log(Commandline.describeCommand(command), log(Commandline.describeCommand(command),
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
exe.setCommandline(command); exe.setCommandline(command);

if (redirectorElement != null) {
if (redirectorElement != null) { setupRedirector();
setupRedirector(); redirectorElement.configure(redirector, name);
redirectorElement.configure(redirector, name); }
} if (redirectorElement != null || haveExecuted) {
if (redirectorElement != null || haveExecuted) { // need to reset the stream handler to restart
// need to reset the stream handler to restart // reading of pipes;
// reading of pipes; // go ahead and do it always w/ nested redirectors
// go ahead and do it always w/ nested redirectors exe.setStreamHandler(redirector.createHandler());
exe.setStreamHandler(redirector.createHandler()); }
runExecute(exe);
haveExecuted = true;
fileNames.removeAllElements();
baseDirs.removeAllElements();
} }
runExecute(exe);
haveExecuted = true;
fileNames.removeAllElements();
baseDirs.removeAllElements();
} }
} }
if (parallel && (fileNames.size() > 0 || !skipEmpty)) { if (parallel && (fileNames.size() > 0 || !skipEmpty)) {
@@ -486,7 +488,6 @@ public class ExecuteOn extends ExecTask {
+ (totalDirs != 1 ? "ies" : "y") + ".", + (totalDirs != 1 ? "ies" : "y") + ".",
verbose ? Project.MSG_INFO : Project.MSG_VERBOSE); verbose ? Project.MSG_INFO : Project.MSG_VERBOSE);
} }
}
} catch (IOException e) { } catch (IOException e) {
throw new BuildException("Execute failed: " + e, e, getLocation()); throw new BuildException("Execute failed: " + e, e, getLocation());
} finally { } finally {


||||||
x
 
000:0
Loading…
Cancel
Save