You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@locus.apache.org on 2000/02/24 01:57:44 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Ant.java Get.java
costin 00/02/23 16:57:44
Modified: . build.xml
src/main/org/apache/tools/ant Main.java Project.java
src/main/org/apache/tools/ant/taskdefs Ant.java Get.java
Log:
- Get will try 3 times and has an option to ignore the errors
- 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 )
Revision Changes Path
1.12 +2 -2 jakarta-ant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/build.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- build.xml 2000/02/23 20:46:52 1.11
+++ build.xml 2000/02/24 00:57:41 1.12
@@ -14,7 +14,7 @@
<property name="ant.home" value="."/>
<property name="bin.dir" value="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="docs.dir" value="docs"/>
<property name="build.dir" value="build"/>
@@ -96,7 +96,7 @@
<!-- =================================================================== -->
<!-- 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}/bin"/>
<mkdir dir="${ant.dist.dir}/lib"/>
1.5 +2 -1 jakarta-ant/src/main/org/apache/tools/ant/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Main.java 2000/01/25 23:03:21 1.4
+++ Main.java 2000/02/24 00:57:42 1.5
@@ -215,7 +215,8 @@
String value = (String)definedProps.get(arg);
project.setUserProperty(arg, value);
}
-
+ project.setUserProperty( "ant.file" , buildFile.getAbsolutePath() );
+
// first use the ProjectHelper to create the project object
// from the given build file.
try {
1.11 +1 -1 jakarta-ant/src/main/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Project.java 2000/02/23 20:46:53 1.10
+++ Project.java 2000/02/24 00:57:42 1.11
@@ -287,7 +287,7 @@
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);
}
1.5 +2 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
Index: Ant.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Ant.java 2000/02/23 21:54:32 1.4
+++ Ant.java 2000/02/24 00:57:43 1.5
@@ -103,8 +103,6 @@
* Do the execution.
*/
public void execute() throws BuildException {
- if( antFile==null) throw new BuildException( "ant required antFile property ");
-
if( dir==null) dir=".";
p1.setBasedir(dir);
p1.setUserProperty("basedir" , dir);
@@ -118,6 +116,8 @@
}
if (antFile == null) antFile = dir + "/build.xml";
+
+ p1.setUserProperty( "ant.file" , antFile );
ProjectHelper.configureProject(p1, new File(antFile));
if (target == null) {
1.3 +27 -2 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java
Index: Get.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Get.java 2000/01/14 02:13:19 1.2
+++ Get.java 2000/02/24 00:57:43 1.3
@@ -66,6 +66,7 @@
private String source; // required
private String dest; // required
private String verbose = "";
+ String ignoreErrors=null;
/**
* Does the work.
@@ -86,7 +87,21 @@
File destF=new File(dest);
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];
int length;
@@ -98,7 +113,8 @@
fos.close();
is.close();
} catch (IOException ioe) {
- ioe.printStackTrace();
+ project.log("Error getting " + source + " to " + dest );
+ if( ignoreErrors != null ) return;
throw new BuildException(ioe.toString());
}
}
@@ -128,5 +144,14 @@
*/
public void setVerbose(String 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;
}
}