|
|
@@ -27,6 +27,7 @@ import org.apache.tools.ant.types.Resource; |
|
|
|
import org.apache.tools.ant.types.ResourceCollection; |
|
|
|
import org.apache.tools.ant.types.resources.FileProvider; |
|
|
|
import org.apache.tools.ant.types.resources.FileResource; |
|
|
|
import org.apache.tools.ant.types.resources.URLProvider; |
|
|
|
import org.apache.tools.ant.types.resources.URLResource; |
|
|
|
import org.apache.tools.ant.types.resources.Union; |
|
|
|
import org.apache.tools.ant.util.FileUtils; |
|
|
@@ -182,17 +183,8 @@ public class ImportTask extends Task { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
File importedFile = null; |
|
|
|
FileProvider fp = importedResource.as(FileProvider.class); |
|
|
|
if (fp != null) { |
|
|
|
importedFile = fp.getFile(); |
|
|
|
} |
|
|
|
|
|
|
|
if (!isInIncludeMode() && |
|
|
|
(importStack.contains(importedResource) |
|
|
|
|| (importedFile != null && importStack.contains(importedFile)) |
|
|
|
) |
|
|
|
) { |
|
|
|
hasAlreadyBeenImported(importedResource, importStack)) { |
|
|
|
getProject().log( |
|
|
|
"Skipped already imported file:\n " |
|
|
|
+ importedResource + "\n", Project.MSG_VERBOSE); |
|
|
@@ -280,6 +272,49 @@ public class ImportTask extends Task { |
|
|
|
return f.isAbsolute() && f.exists(); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean hasAlreadyBeenImported(Resource importedResource, |
|
|
|
Vector<Object> importStack) { |
|
|
|
File importedFile = null; |
|
|
|
FileProvider fp = importedResource.as(FileProvider.class); |
|
|
|
if (fp != null) { |
|
|
|
importedFile = fp.getFile(); |
|
|
|
} |
|
|
|
URL importedURL = null; |
|
|
|
URLProvider up = importedResource.as(URLProvider.class); |
|
|
|
if (up != null) { |
|
|
|
importedURL = up.getURL(); |
|
|
|
} |
|
|
|
for (Object o : importStack) { |
|
|
|
if (isOneOf(o, importedResource, importedFile, importedURL)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isOneOf(Object o, Resource importedResource, |
|
|
|
File importedFile, URL importedURL) { |
|
|
|
if (o.equals(importedResource) || o.equals(importedFile) |
|
|
|
|| o.equals(importedURL)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (o instanceof Resource) { |
|
|
|
if (importedFile != null) { |
|
|
|
FileProvider fp = ((Resource) o).as(FileProvider.class); |
|
|
|
if (fp != null && fp.getFile().equals(importedFile)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (importedURL != null) { |
|
|
|
URLProvider up = ((Resource) o).as(URLProvider.class); |
|
|
|
if (up != null && up.getURL().equals(importedURL)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Whether the task is in include (as opposed to import) mode. |
|
|
|
* |
|
|
|