Return-Path:
Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm
Delivered-To: mailing list ant-dev@jakarta.apache.org
Received: (qmail 91241 invoked from network); 30 Jan 2001 22:43:11 -0000
Received: from web106.mail.yahoo.com (HELO web106.yahoomail.com)
(205.180.60.73)
by h31.sny.collab.net with SMTP; 30 Jan 2001 22:43:11 -0000
Received: (qmail 20123 invoked by uid 60001); 30 Jan 2001 22:43:18 -0000
Message-ID: <20010130224318.20122.qmail@web106.yahoomail.com>
Received: from [192.147.88.2] by web106.yahoomail.com;
Tue, 30 Jan 2001 14:43:18 PST
Date: Tue, 30 Jan 2001 14:43:18 -0800 (PST)
From: Diane Holt
Subject: Re: [Patch] addition of an "include level" to the matching task & jav
ac task
To: ant-dev@jakarta.apache.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N
Jay,
If you just want to recompile everything, can't you just do a "clean"
first?
Diane
--- Jay Glanville wrote:
> I have found the need to change the behaviour of the javac task in
> conjunction with the way that files are included/excluded before the
> compiler is called.
>
> Currently, what happens is that the Javac task creates a set of
> "candidate"
> files. This is a list of files that match the include and exclude
> patterns
> stated by the task's attributes/parameters. Next the Javac task goes
> through that set of candidates, eliminating source files where the
> associated class file is considered up to date with the source file.
> Thus,
> the task only sends the files to the compile that it thinks are out of
> date.
>
> My desire is to have a little bit of control over that second stage -
> the
> elimination stage.
>
> Why? On a ClearCase file system, file access is slightly slower then
> local
> hard drive access (due to networks, NFS mounts, repository server loads,
> etc). Therefore, accessing two different files in different directories
> for
> time stamps can take a while.
>
> What do I propose? I want to be able to tell the javac task to ignore
> the
> elimination phase. I want the task to simply send all files to the
> compiler.
>
> How do I propose to do this? I have added an attribute to the
> MatchingTask
> task called "includelevel". This is to indicate the level to which I
> want
> to include files. MatchingTask is only the holder for the attribute --
> it
> actually does nothing with it. It is up to subclasses to react to the
> value
> within the attribute. Therefore, I have also made changes to the javac
> task
> such that if the includelevel attribute equals "all" then all files will
> be
> included in the javac task. If the includelevel equals "outofdate" (or
> anything other then "all" for that matter), then the default behaviour
> will
> be used.
>
> Why have I put the attribute in the MatchingTask class? I'm sure that
> there
> are sub tasks that could more granularity of control over the include
> results.
>
> Does this work? I have found it to be quicker on slow file systems
> where
> the code base is over 1700 files.
>
> Well? What does the ant community think?
>
>
>
>
>
> <> <> <>
>
> --
> Jay Dickon Glanville
> P068 - SiteManager Development, Nortel Networks
> 613-765-1144 (ESN 395-1144)
> MS: 045/55/A05
> E-Mail: dickon@nortelnetworks.com
>
> > --- index.html Mon Jan 29 21:06:32 2001
> +++ index.html.new Mon Jan 29 21:02:46 2001
> @@ -34,7 +34,7 @@
>
>
> Version: @VERSION@
> -$Id: index.html,v 1.197 2001/01/30 00:22:28 donaldp Exp $
> +$Id: index.html,v 1.196 2001/01/29 09:49:26 nico Exp $
>
>
>
> @@ -207,8 +207,8 @@
> to build a bootstrap version of Ant.
> When finished, use:
>
> - build
> -Ddist.dir=<directory_to_contain_Ant_distribution>
> dist
(Windows)
> - build.sh
> -Ddist.dir=<directory_to_contain_Ant_distribution>
> dist
(Unix)
> + build
> -Dant.dist.dir=<directory_to_contain_Ant_distribution>
> dist
(Windows)
> + build.sh
> -Dant.dist.dir=<directory_to_contain_Ant_distribution>
> dist
(Unix)
>
> to create a binary distribution of Ant. This distribution can be
> found in the directory you specified.
> @@ -3273,6 +3273,19 @@
> indicates whether default excludes should be used
> (yes | no ); default excludes are used
> when omitted. |
> No |
> +
> +
> + includelevel |
> + The level with which to include files in this
> task.
> + There are two possible values for this: outofdate
> + [default] and all . The javac task first
> uses
> + the includes/excludes patterns to determin a set of candidate
> files.
> + Next, if this attribute is to outofdate , then the set
> of
> + candidates is reduced to include only source files where the
> associated
> + class files are out of date. If this attribute is
> all ,
> + then all cadidate files are passed to the compiler.
> + |
> + No |
>
>
> classpath |
> > --- Javac.java Mon Jan 29 21:06:22 2001
> +++ Javac.java.new Mon Jan 29 20:14:58 2001
> @@ -118,6 +118,11 @@
> protected boolean failOnError = true;
> protected File[] compileList = new File[0];
>
> + /** Whether or not to simply include all files or to perform
> time-stamp
> + * tests.
> + */
> + private boolean includeAllFiles = false;
> +
> /**
> * Create a nested element for multiple source path
> * support.
> @@ -418,6 +423,8 @@
> throw new BuildException("destination directory \"" +
> destDir + "\" does not exist or is not a directory", location);
> }
>
> + setIncludeLevel();
> +
> // scan source directories and dest directory to build up
> // compile lists
> resetFileLists();
> @@ -485,7 +492,14 @@
> m.setFrom("*.java");
> m.setTo("*.class");
> SourceFileScanner sfs = new SourceFileScanner(this);
> - File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir,
> m);
> + File[] newFiles = null;
> + if ( includeAllFiles ) {
> + newFiles = new File[files.length];
> + for (int i=0; i + newFiles[i] = new File(srcDir, files[i]);
> + } else {
> + newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
> + }
>
> if (newFiles.length > 0) {
> File[] newCompileList = new File[compileList.length +
> @@ -501,6 +515,29 @@
> /** Gets the list of files to be compiled. */
> public File[] getFileList() {
> return compileList;
> + }
> +
> + /**
> + * Determines if all files get included or if time-stamps should be
> + * evaluated. If the include level (defined in MatchingTask) is
> set to
> + * "all", then all files that match the include/exclude criteria
> are
> + * added. Whereas, if the include level is set to "outofdate" or
> + * anything other then "all", then the default criteria of matching
> is
> + * used (i.e.: all files that match include/exclude and who's
> classes
> + * are missing or out of date).
> + */
> + private void setIncludeLevel() {
> + String level = getIncludeLevel();
> + if ( level == null ) {
> + includeAllFiles = false;
> + return;
> + }
> + if ( level.equalsIgnoreCase( "all" ) ) {
> + includeAllFiles = true;
> + return;
> + }
> + if ( level.equalsIgnoreCase( "outofdate" ) )
> + includeAllFiles = false;
> }
>
> }
> > --- MatchingTask.java Mon Jan 29 21:06:22 2001
> +++ MatchingTask.java.new Mon Jan 29 19:51:20 2001
> @@ -75,6 +75,8 @@
>
> protected boolean useDefaultExcludes = true;
> protected FileSet fileset = new FileSet();
> + /** The level of which to include files. */
> + private String level = null;
>
> /**
> * add a name entry on the include list
> @@ -199,6 +201,19 @@
> */
> public void setExcludesfile(File excludesfile) {
> fileset.setExcludesfile(excludesfile);
> + }
> +
> + /**
> + * Sets the level to which this include/exclude set should work.
> + * It is up to sub-classes to determin what each level means.
> This
> + * level functionality is defined here for commonality purposes.
> + */
> + public void setIncludelevel( String level ) {
> + this.level = level;
> + }
> +
> + protected String getIncludeLevel() {
> + return level;
> }
>
> }
>
> > ---------------------------------------------------------------------
> To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ant-dev-help@jakarta.apache.org
=====
(holtdl@yahoo.com)
__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/