Submitted by: Jesse Glick <Jesse.Glick@netbeans.com> Make Path use getCanonicalPath throughout. Submitted by: Vincent Bergbauer <vincent_bergbauer@yahoo.com> Remove deprecation warnings in SignJar Submitted by: KC Baltz <KBaltz@responsenetworks.com> Give user a clue if the classic compiler can not be found. Submitted by: Erik Meade <emeade@geekfarm.org> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268128 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1,4 +1,18 @@ | |||||
Changes from Ant 1.2 to the current sources | |||||
=========================================== | |||||
Other changes: | |||||
-------------- | |||||
* New tasks: propertyfile | |||||
Fixed bugs: | |||||
----------- | |||||
* <signjar> doesn't use deprectated methods anymore. | |||||
Changes from Ant 1.1 to Ant 1.2 | Changes from Ant 1.1 to Ant 1.2 | ||||
=============================== | |||||
Changes that could break older environments: | Changes that could break older environments: | ||||
-------------------------------------------- | -------------------------------------------- | ||||
@@ -26,7 +26,7 @@ | |||||
<li>Dave Walend (<a href="mailto:dwalend@cs.tufts.edu">dwalend@cs.tufts.edu</a>)</li> | <li>Dave Walend (<a href="mailto:dwalend@cs.tufts.edu">dwalend@cs.tufts.edu</a>)</li> | ||||
</ul> | </ul> | ||||
<p>Version 1.2 - 2000/10/24</p> | |||||
<p>Version 1.3 - 2000/10/27</p> | |||||
<hr> | <hr> | ||||
<h2>Table of Contents</h2> | <h2>Table of Contents</h2> | ||||
@@ -101,7 +101,7 @@ public class ExecTask extends Task { | |||||
} | } | ||||
/** | /** | ||||
* Only execute the process if <code>os.name</code> includes this string. | |||||
* Only execute the process if <code>os.name</code> is included in this string. | |||||
*/ | */ | ||||
public void setOs(String os) { | public void setOs(String os) { | ||||
this.os = os; | this.os = os; | ||||
@@ -481,7 +481,9 @@ public class Javac extends MatchingTask { | |||||
} | } | ||||
} | } | ||||
catch (ClassNotFoundException ex) { | catch (ClassNotFoundException ex) { | ||||
throw new BuildException("Cannot use classic compiler, as it is not available", location); | |||||
throw new BuildException("Cannot use classic compiler, as it is not available"+ | |||||
" A common solution is to set the environment variable"+ | |||||
" JAVA_HOME to your jdk directory.", location); | |||||
} | } | ||||
catch (Exception ex) { | catch (Exception ex) { | ||||
if (ex instanceof BuildException) { | if (ex instanceof BuildException) { | ||||
@@ -150,67 +150,57 @@ public class SignJar extends Task { | |||||
final StringBuffer sb = new StringBuffer(); | final StringBuffer sb = new StringBuffer(); | ||||
sb.append("jarsigner "); | |||||
final ExecTask cmd = (ExecTask) project.createTask("exec"); | |||||
cmd.setExecutable("jarsigner"); | |||||
if (null != keystore) { | if (null != keystore) { | ||||
sb.append("-keystore \""); | |||||
sb.append(keystore); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue("-keystore"); | |||||
cmd.createArg().setValue(keystore); | |||||
} | } | ||||
if (null != storepass) { | if (null != storepass) { | ||||
sb.append("-storepass \""); | |||||
sb.append(storepass); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue("-storepass"); | |||||
cmd.createArg().setValue(storepass); | |||||
} | } | ||||
if (null != storetype) { | if (null != storetype) { | ||||
sb.append("-storetype \""); | |||||
sb.append(storetype); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue("-storetype"); | |||||
cmd.createArg().setValue(storetype); | |||||
} | } | ||||
if (null != keypass) { | if (null != keypass) { | ||||
sb.append("-keypass \""); | |||||
sb.append(keypass); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue("-keypass"); | |||||
cmd.createArg().setValue(keypass); | |||||
} | } | ||||
if (null != sigfile) { | if (null != sigfile) { | ||||
sb.append("-sigfile \""); | |||||
sb.append(sigfile); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue("-sigfile"); | |||||
cmd.createArg().setValue(sigfile); | |||||
} | } | ||||
if (null != signedjar) { | if (null != signedjar) { | ||||
sb.append("-signedjar \""); | |||||
sb.append(signedjar); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue("-signedjar"); | |||||
cmd.createArg().setValue(signedjar); | |||||
} | } | ||||
if (verbose) { | if (verbose) { | ||||
sb.append("-verbose "); | |||||
cmd.createArg().setValue("-verbose"); | |||||
} | } | ||||
if (internalsf) { | if (internalsf) { | ||||
sb.append("-internalsf "); | |||||
cmd.createArg().setValue("-internalsf"); | |||||
} | } | ||||
if (sectionsonly) { | if (sectionsonly) { | ||||
sb.append("-sectionsonly "); | |||||
cmd.createArg().setValue("-sectionsonly"); | |||||
} | } | ||||
sb.append('\"'); | |||||
sb.append(jar); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue(jar); | |||||
sb.append('\"'); | |||||
sb.append(alias); | |||||
sb.append("\" "); | |||||
cmd.createArg().setValue(alias); | |||||
log("Signing Jar : " + (new File(jar)).getAbsolutePath()); | log("Signing Jar : " + (new File(jar)).getAbsolutePath()); | ||||
final ExecTask cmd = (ExecTask) project.createTask("exec"); | |||||
cmd.setCommand(new Commandline(sb.toString())); | |||||
cmd.setFailonerror(true); | cmd.setFailonerror(true); | ||||
cmd.setTaskName( getTaskName() ); | cmd.setTaskName( getTaskName() ); | ||||
cmd.execute(); | cmd.execute(); | ||||
@@ -60,6 +60,7 @@ import org.apache.tools.ant.Project; | |||||
import org.apache.tools.ant.PathTokenizer; | import org.apache.tools.ant.PathTokenizer; | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | |||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.Stack; | import java.util.Stack; | ||||
@@ -111,7 +112,16 @@ public class Path extends DataType implements Cloneable { | |||||
private String[] parts; | private String[] parts; | ||||
public void setLocation(File loc) { | public void setLocation(File loc) { | ||||
parts = new String[] {translateFile(loc.getAbsolutePath())}; | |||||
try { | |||||
parts = new String[] {translateFile(loc.getCanonicalPath())}; | |||||
} catch(IOException e) { | |||||
// XXX I'd like to log something here but if I don't | |||||
// have a Project I can't | |||||
if (project != null) { | |||||
project.log(e.getMessage(), Project.MSG_WARN); | |||||
} | |||||
parts = new String[] {translateFile(loc.getAbsolutePath())}; | |||||
} | |||||
} | } | ||||
public void setPath(String path) { | public void setPath(String path) { | ||||
@@ -294,9 +304,15 @@ public class Path extends DataType implements Cloneable { | |||||
String[] s = ds.getIncludedFiles(); | String[] s = ds.getIncludedFiles(); | ||||
File dir = fs.getDir(project); | File dir = fs.getDir(project); | ||||
for (int j=0; j<s.length; j++) { | for (int j=0; j<s.length; j++) { | ||||
addUnlessPresent(result, | |||||
translateFile((new File(dir, s[j])).getAbsolutePath())); | |||||
} | |||||
String canonicalPath; | |||||
File f = new File(dir, s[j]); | |||||
try { | |||||
canonicalPath = f.getCanonicalPath(); | |||||
} catch(IOException e) { | |||||
canonicalPath = f.getAbsolutePath(); | |||||
} | |||||
addUnlessPresent(result, translateFile(canonicalPath)); | |||||
} | |||||
} | } | ||||
} | } | ||||
String[] res = new String[result.size()]; | String[] res = new String[result.size()]; | ||||
@@ -430,7 +446,13 @@ public class Path extends DataType implements Cloneable { | |||||
*/ | */ | ||||
private static String resolveFile(Project project, String relativeName) { | private static String resolveFile(Project project, String relativeName) { | ||||
if (project != null) { | if (project != null) { | ||||
return project.resolveFile(relativeName).getAbsolutePath(); | |||||
File f = project.resolveFile(relativeName); | |||||
try { | |||||
return f.getCanonicalPath(); | |||||
} catch(IOException e) { | |||||
project.log(e.getMessage(), Project.MSG_WARN); | |||||
return f.getAbsolutePath(); | |||||
} | |||||
} | } | ||||
return relativeName; | return relativeName; | ||||
} | } | ||||