git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@414442 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -17,17 +17,18 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import org.apache.tools.ant.Task; | |||||
| import java.io.File; | |||||
| import java.util.Enumeration; | |||||
| import java.util.Vector; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.util.JavaEnvUtils; | |||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.types.Environment; | |||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.RedirectorElement; | import org.apache.tools.ant.types.RedirectorElement; | ||||
| import org.apache.tools.ant.types.Environment; | |||||
| import java.io.File; | |||||
| import java.util.Vector; | |||||
| import java.util.Enumeration; | |||||
| import org.apache.tools.ant.util.FileUtils; | |||||
| import org.apache.tools.ant.util.JavaEnvUtils; | |||||
| /** | /** | ||||
| * This is factored out from {@link SignJar}; a base class that can be used | * This is factored out from {@link SignJar}; a base class that can be used | ||||
| @@ -98,6 +99,8 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
| */ | */ | ||||
| private Path path = null; | private Path path = null; | ||||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||||
| /** | /** | ||||
| * Set the maximum memory to be used by the jarsigner process | * Set the maximum memory to be used by the jarsigner process | ||||
| * | * | ||||
| @@ -287,7 +290,7 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
| // is the keystore a file | // is the keystore a file | ||||
| addValue(cmd,"-keystore"); | addValue(cmd,"-keystore"); | ||||
| String loc; | String loc; | ||||
| File keystoreFile = getProject().resolveFile(keystore); | |||||
| File keystoreFile = FILE_UTILS.resolveFile(getProject().getBaseDir(), keystore); | |||||
| if (keystoreFile.exists()) { | if (keystoreFile.exists()) { | ||||
| loc = keystoreFile.getPath(); | loc = keystoreFile.getPath(); | ||||
| } else { | } else { | ||||
| @@ -412,7 +412,7 @@ public class ExecTask extends Task { | |||||
| return exec; | return exec; | ||||
| } | } | ||||
| // try to find the executable | // try to find the executable | ||||
| File executableFile = getProject().resolveFile(exec); | |||||
| File executableFile = FILE_UTILS.resolveFile(getProject().getBaseDir(), exec); | |||||
| if (executableFile.exists()) { | if (executableFile.exists()) { | ||||
| return executableFile.getAbsolutePath(); | return executableFile.getAbsolutePath(); | ||||
| } | } | ||||
| @@ -18,6 +18,7 @@ | |||||
| package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.MagicNames; | import org.apache.tools.ant.MagicNames; | ||||
| @@ -26,6 +27,7 @@ import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | |||||
| import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| import org.apache.tools.ant.util.FileUtils; | |||||
| import org.apache.tools.ant.util.GlobPatternMapper; | import org.apache.tools.ant.util.GlobPatternMapper; | ||||
| import org.apache.tools.ant.util.JavaEnvUtils; | import org.apache.tools.ant.util.JavaEnvUtils; | ||||
| import org.apache.tools.ant.util.SourceFileScanner; | import org.apache.tools.ant.util.SourceFileScanner; | ||||
| @@ -109,6 +111,8 @@ public class Javac extends MatchingTask { | |||||
| private String source; | private String source; | ||||
| private String debugLevel; | private String debugLevel; | ||||
| private File tmpDir; | private File tmpDir; | ||||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||||
| /** | /** | ||||
| * Javac task for compilation of Java files. | * Javac task for compilation of Java files. | ||||
| @@ -800,7 +804,7 @@ public class Javac extends MatchingTask { | |||||
| // compile lists | // compile lists | ||||
| String[] list = src.list(); | String[] list = src.list(); | ||||
| for (int i = 0; i < list.length; i++) { | for (int i = 0; i < list.length; i++) { | ||||
| File srcDir = getProject().resolveFile(list[i]); | |||||
| File srcDir = FILE_UTILS.resolveFile(getProject().getBaseDir(), list[i]); | |||||
| if (!srcDir.exists()) { | if (!srcDir.exists()) { | ||||
| throw new BuildException("srcdir \"" | throw new BuildException("srcdir \"" | ||||
| + srcDir.getPath() | + srcDir.getPath() | ||||
| @@ -543,7 +543,7 @@ public class Javadoc extends Task { | |||||
| while (tok.hasMoreTokens()) { | while (tok.hasMoreTokens()) { | ||||
| String f = tok.nextToken(); | String f = tok.nextToken(); | ||||
| SourceFile sf = new SourceFile(); | SourceFile sf = new SourceFile(); | ||||
| sf.setFile(getProject().resolveFile(f.trim())); | |||||
| sf.setFile(FILE_UTILS.resolveFile(getProject().getBaseDir(),f.trim())); | |||||
| addSource(sf); | addSource(sf); | ||||
| } | } | ||||
| } | } | ||||
| @@ -1016,7 +1016,7 @@ public class Javadoc extends Task { | |||||
| if (!tok.hasMoreTokens()) { | if (!tok.hasMoreTokens()) { | ||||
| throw new BuildException(linkOfflineError); | throw new BuildException(linkOfflineError); | ||||
| } | } | ||||
| le.setPackagelistLoc(getProject().resolveFile(tok.nextToken())); | |||||
| le.setPackagelistLoc(FILE_UTILS.resolveFile(getProject().getBaseDir(),tok.nextToken())); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1745,7 +1745,7 @@ public class Javadoc extends Task { | |||||
| String link = null; | String link = null; | ||||
| if (la.shouldResolveLink()) { | if (la.shouldResolveLink()) { | ||||
| File hrefAsFile = | File hrefAsFile = | ||||
| getProject().resolveFile(la.getHref()); | |||||
| FILE_UTILS.resolveFile(getProject().getBaseDir(), la.getHref()); | |||||
| if (hrefAsFile.exists()) { | if (hrefAsFile.exists()) { | ||||
| try { | try { | ||||
| link = FILE_UTILS.getFileURL(hrefAsFile) | link = FILE_UTILS.getFileURL(hrefAsFile) | ||||
| @@ -115,7 +115,7 @@ public class TempFile extends Task { | |||||
| throw new BuildException("no property specified"); | throw new BuildException("no property specified"); | ||||
| } | } | ||||
| if (destDir == null) { | if (destDir == null) { | ||||
| destDir = getProject().resolveFile("."); | |||||
| destDir = FILE_UTILS.resolveFile(getProject().getBaseDir(),"."); | |||||
| } | } | ||||
| File tfile = FILE_UTILS.createTempFile(prefix, suffix, destDir); | File tfile = FILE_UTILS.createTempFile(prefix, suffix, destDir); | ||||
| getProject().setNewProperty(property, tfile.toString()); | getProject().setNewProperty(property, tfile.toString()); | ||||
| @@ -341,7 +341,7 @@ public class Touch extends Task { | |||||
| long modTime = (r.isExists()) ? r.getLastModified() | long modTime = (r.isExists()) ? r.getLastModified() | ||||
| : defaultTimestamp; | : defaultTimestamp; | ||||
| for (int i = 0; i < mapped.length; i++) { | for (int i = 0; i < mapped.length; i++) { | ||||
| touch(getProject().resolveFile(mapped[i]), modTime); | |||||
| touch(FILE_UTILS.resolveFile(getProject().getBaseDir(),mapped[i]), modTime); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -283,7 +283,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||||
| try { | try { | ||||
| if (baseDir == null) { | if (baseDir == null) { | ||||
| baseDir = getProject().resolveFile("."); | |||||
| baseDir = FILE_UTILS.resolveFile(getProject().getBaseDir(),"."); | |||||
| } | } | ||||
| liaison = getLiaison(); | liaison = getLiaison(); | ||||