- build.xml - small changes to allow build from a different directory ( usefull for nightly, which is broken ) - set ant.file == the ant file that is executing ( we also set ant.home to the home of ant ) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267615 13f79535-47bb-0310-9956-ffa450edef68master
@@ -14,7 +14,7 @@ | |||||
<property name="ant.home" value="."/> | <property name="ant.home" value="."/> | ||||
<property name="bin.dir" value="bin"/> | <property name="bin.dir" value="bin"/> | ||||
<property name="src.bin.dir" value="src/bin"/> | <property name="src.bin.dir" value="src/bin"/> | ||||
<property name="src.dir" value="src/main"/> | |||||
<property name="src.dir" value="${basedir}/src/main"/> | |||||
<property name="lib.dir" value="lib"/> | <property name="lib.dir" value="lib"/> | ||||
<property name="docs.dir" value="docs"/> | <property name="docs.dir" value="docs"/> | ||||
<property name="build.dir" value="build"/> | <property name="build.dir" value="build"/> | ||||
@@ -96,7 +96,7 @@ | |||||
<!-- =================================================================== --> | <!-- =================================================================== --> | ||||
<!-- Creates the distribution --> | <!-- Creates the distribution --> | ||||
<!-- =================================================================== --> | <!-- =================================================================== --> | ||||
<target name="dist" depends="jar,javadocs"> | |||||
<target name="dist" depends="main,jar,javadocs"> | |||||
<mkdir dir="${ant.dist.dir}"/> | <mkdir dir="${ant.dist.dir}"/> | ||||
<mkdir dir="${ant.dist.dir}/bin"/> | <mkdir dir="${ant.dist.dir}/bin"/> | ||||
<mkdir dir="${ant.dist.dir}/lib"/> | <mkdir dir="${ant.dist.dir}/lib"/> | ||||
@@ -215,7 +215,8 @@ public class Main { | |||||
String value = (String)definedProps.get(arg); | String value = (String)definedProps.get(arg); | ||||
project.setUserProperty(arg, value); | project.setUserProperty(arg, value); | ||||
} | } | ||||
project.setUserProperty( "ant.file" , buildFile.getAbsolutePath() ); | |||||
// first use the ProjectHelper to create the project object | // first use the ProjectHelper to create the project object | ||||
// from the given build file. | // from the given build file. | ||||
try { | try { | ||||
@@ -287,7 +287,7 @@ public class Project { | |||||
throw new BuildException("Ant cannot work on Java 1.0"); | throw new BuildException("Ant cannot work on Java 1.0"); | ||||
} | } | ||||
log("Detected Java Version: " + javaVersion); | |||||
log("Detected Java Version: " + javaVersion, MSG_VERBOSE); | |||||
log("Detected OS: " + System.getProperty("os.name"), MSG_VERBOSE); | log("Detected OS: " + System.getProperty("os.name"), MSG_VERBOSE); | ||||
} | } | ||||
@@ -103,8 +103,6 @@ public class Ant extends Task { | |||||
* Do the execution. | * Do the execution. | ||||
*/ | */ | ||||
public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
if( antFile==null) throw new BuildException( "ant required antFile property "); | |||||
if( dir==null) dir="."; | if( dir==null) dir="."; | ||||
p1.setBasedir(dir); | p1.setBasedir(dir); | ||||
p1.setUserProperty("basedir" , dir); | p1.setUserProperty("basedir" , dir); | ||||
@@ -118,6 +116,8 @@ public class Ant extends Task { | |||||
} | } | ||||
if (antFile == null) antFile = dir + "/build.xml"; | if (antFile == null) antFile = dir + "/build.xml"; | ||||
p1.setUserProperty( "ant.file" , antFile ); | |||||
ProjectHelper.configureProject(p1, new File(antFile)); | ProjectHelper.configureProject(p1, new File(antFile)); | ||||
if (target == null) { | if (target == null) { | ||||
@@ -66,6 +66,7 @@ public class Get extends Task { | |||||
private String source; // required | private String source; // required | ||||
private String dest; // required | private String dest; // required | ||||
private String verbose = ""; | private String verbose = ""; | ||||
String ignoreErrors=null; | |||||
/** | /** | ||||
* Does the work. | * Does the work. | ||||
@@ -86,7 +87,21 @@ public class Get extends Task { | |||||
File destF=new File(dest); | File destF=new File(dest); | ||||
FileOutputStream fos = new FileOutputStream(destF); | FileOutputStream fos = new FileOutputStream(destF); | ||||
InputStream is = url.openStream(); | |||||
InputStream is=null; | |||||
for( int i=0; i< 3 ; i++ ) { | |||||
try { | |||||
is = url.openStream(); | |||||
break; | |||||
} catch( IOException ex ) { | |||||
project.log( "Error opening connection " + ex ); | |||||
} | |||||
} | |||||
if( is==null ) { | |||||
project.log( "Can't get " + source + " to " + dest); | |||||
if( ignoreErrors != null ) return; | |||||
throw new BuildException( "Can't get " + source + " to " + dest); | |||||
} | |||||
byte[] buffer = new byte[100 * 1024]; | byte[] buffer = new byte[100 * 1024]; | ||||
int length; | int length; | ||||
@@ -98,7 +113,8 @@ public class Get extends Task { | |||||
fos.close(); | fos.close(); | ||||
is.close(); | is.close(); | ||||
} catch (IOException ioe) { | } catch (IOException ioe) { | ||||
ioe.printStackTrace(); | |||||
project.log("Error getting " + source + " to " + dest ); | |||||
if( ignoreErrors != null ) return; | |||||
throw new BuildException(ioe.toString()); | throw new BuildException(ioe.toString()); | ||||
} | } | ||||
} | } | ||||
@@ -129,4 +145,13 @@ public class Get extends Task { | |||||
public void setVerbose(String v) { | public void setVerbose(String v) { | ||||
verbose = v; | verbose = v; | ||||
} | } | ||||
/** | |||||
* Don't stop if get fails if set to "<CODE>true</CODE>". | |||||
* | |||||
* @param v if "true" then be verbose | |||||
*/ | |||||
public void setIgnoreErrors(String v) { | |||||
ignoreErrors = v; | |||||
} | |||||
} | } |