Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 57229 invoked from network); 1 Feb 2002 22:35:06 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 1 Feb 2002 22:35:06 -0000 Received: (qmail 19686 invoked by uid 97); 1 Feb 2002 22:33:46 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 19650 invoked by uid 97); 1 Feb 2002 22:33:45 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 19611 invoked from network); 1 Feb 2002 22:33:45 -0000 Message-ID: <01cd01c1ab70$775c2960$6401a8c0@darden.virginia.edu> From: "Erik Hatcher" To: "Ant Developers List" References: <20020201222738.36032.qmail@icarus.apache.org> Subject: Re: cvs commit: jakarta-ant/docs/manual running.html Date: Fri, 1 Feb 2002 17:33:26 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Peter gave the thumbs up, so I figured I'd commit it... but of course if there are any objections speak up. I made sure that -D properties take ultimate precedence, which I felt was mandatory for this change to be worthwhile. Erik ----- Original Message ----- From: To: Sent: Friday, February 01, 2002 5:27 PM Subject: cvs commit: jakarta-ant/docs/manual running.html > ehatcher 02/02/01 14:27:38 > > Modified: src/main/org/apache/tools/ant Main.java > docs/manual running.html > Log: > Add -propertyfile command-line option. > > Revision Changes Path > 1.54 +42 -2 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.53 > retrieving revision 1.54 > diff -u -r1.53 -r1.54 > --- Main.java 10 Jan 2002 11:21:19 -0000 1.53 > +++ Main.java 1 Feb 2002 22:27:38 -0000 1.54 > @@ -55,6 +55,7 @@ > package org.apache.tools.ant; > > import java.io.File; > +import java.io.FileInputStream; > import java.io.PrintStream; > import java.io.FileOutputStream; > import java.io.IOException; > @@ -100,6 +101,9 @@ > > /** Names of classes to add as listeners to project */ > private Vector listeners = new Vector(5); > + > + /** File names of property files to load on startup */ > + private Vector propertyFiles = new Vector(5); > > /** > * The Ant logger class. There may be only one logger. It will have the > @@ -294,6 +298,16 @@ > } else { > searchForThis = DEFAULT_BUILD_FILENAME; > } > + } else if (arg.startsWith("-propertyfile")) { > + try { > + propertyFiles.addElement(args[i+1]); > + i++; > + } catch (ArrayIndexOutOfBoundsException aioobe) { > + String msg = "You must specify a property filename when " + > + "using the -propertyfile argument"; > + System.out.println(msg); > + return; > + } > } else if (arg.startsWith("-")) { > // we don't have any more args to recognize! > String msg = "Unknown argument: " + arg; > @@ -304,9 +318,8 @@ > // if it's no other arg, it may be the target > targets.addElement(arg); > } > - > } > - > + > // if buildFile was not specified on the command line, > if (buildFile == null) { > // but -find then search for it > @@ -332,6 +345,31 @@ > throw new BuildException("Build failed"); > } > > + // Load the property files specified by -propertyfile > + for (int propertyFileIndex=0; > + propertyFileIndex < propertyFiles.size(); > + propertyFileIndex++) { > + String filename = (String) propertyFiles.elementAt(propertyFileIndex); > + Properties props = new Properties(); > + try { > + FileInputStream fis = new FileInputStream(filename); > + props.load(fis); > + } > + catch (IOException e) { > + System.out.println("Could not load property file " > + + filename + ": " + e.getMessage()); > + } > + > + // ensure that -D properties take precedence > + Enumeration propertyNames = props.propertyNames(); > + while (propertyNames.hasMoreElements()) { > + String name = (String) propertyNames.nextElement(); > + if (definedProps.getProperty(name) == null) { > + definedProps.put(name, props.getProperty(name)); > + } > + } > + } > + > readyToRun = true; > } > > @@ -576,6 +614,8 @@ > msg.append(" -listener add an instance of class as a project listener" + lSep); > msg.append(" -buildfile use given buildfile" + lSep); > msg.append(" -D= use value for given property" + lSep); > + msg.append(" -propertyfile load all properties from file with -D" + lSep); > + msg.append(" properties taking precedence" + lSep); > msg.append(" -find search for buildfile towards the root of the" + lSep); > msg.append(" filesystem and use it" + lSep); > System.out.println(msg.toString()); > > > > 1.9 +16 -13 jakarta-ant/docs/manual/running.html > > Index: running.html > =================================================================== > RCS file: /home/cvs/jakarta-ant/docs/manual/running.html,v > retrieving revision 1.8 > retrieving revision 1.9 > diff -u -r1.8 -r1.9 > --- running.html 10 Jan 2002 08:48:28 -0000 1.8 > +++ running.html 1 Feb 2002 22:27:38 -0000 1.9 > @@ -62,19 +62,22 @@ >

Command-line Options Summary

>
ant [options] [target [target2 [target3] ...]]
>    Options:
>   --help                  print this message
>   --projecthelp           print project help information
>   --version               print the version information and exit
>   --quiet                 be extra quiet
>   --verbose               be extra verbose
>   --debug                 print debugging information
>   --emacs                 produce logging information without adornments
>   --logfile file          use given file for log output
>   --logger classname      the class that is to perform logging
>   --listener classname    add an instance of class as a project
listener
>   --buildfile file        use specified buildfile
>   --find file             search for buildfile towards the root of
the filesystem and use the first one found
>   --Dproperty=value       set property to
value
>   +  -help                  print this message
>   +  -projecthelp           print project help information
>   +  -version               print the version information and exit
>   +  -quiet                 be extra quiet
>   +  -verbose               be extra verbose
>   +  -debug                 print debugging information
>   +  -emacs                 produce logging information without adornments
>   +  -logfile <file>        use given file for log
>   +  -logger <classname>    the class which is to perform logging
>   +  -listener <classname>  add an instance of class as a project
listener
>   +  -buildfile <file>      use given buildfile
>   +  -D<property>=<value>   use value for given property
>   +  -propertyfile <name>   load all properties from file with -D
>   +                         properties taking precedence
>   +  -find <file>           search for buildfile towards the root of
the
>   +                         filesystem and use it
>    
>

For more information about -logger and > -listener see the section > > > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: > > -- To unsubscribe, e-mail: For additional commands, e-mail: