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 19 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) {
Iterator iter = resources.iterator();
while (iter.hasNext()) {
Resource res = (Resource) iter.next();
Iterator iter = resources.iterator();
while (iter.hasNext()) {
Resource res = (Resource) iter.next();

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

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

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

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

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

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

if (redirectorElement != null) {
setupRedirector();
redirectorElement.configure(redirector, name);
}
if (redirectorElement != null || haveExecuted) {
// need to reset the stream handler to restart
// reading of pipes;
// go ahead and do it always w/ nested redirectors
exe.setStreamHandler(redirector.createHandler());
if (!parallel) {
String[] command = getCommandline(name, base);
log(Commandline.describeCommand(command),
Project.MSG_VERBOSE);
exe.setCommandline(command);

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


Loading…
Cancel
Save