Menu

#390 CL task rebuilds too many files

0.85
closed-fixed
Tasks (408)
5
2014-08-17
2005-04-27
Robert Blum
No

The update-check for CL is a bit too generous - if
*any* of the submitted .cpp files are out of date with
respect to their header, *all* of them are rebuilt.

This is not a problem were I call [cl] by hand, but the
solution task submits batches of files based on
configuration groups. If all files share the same
build configuration, having a single one of them out of
date causes all of them to be rebuilt..

I.e. you have 90 files including foo.h, 1 file
including bar.h. All CPP files share same config. Touch
bar.h, get 91 compiles (instead of 1)

I'm resorting to evil hackery to fix this for now
(deadlines and all)

In ClTask.cs, add a private member for outdated files:

private StringCollection _OutdatedFileNames;

Then, in ExecuteTask, use that instead of
Sources.Filenames, with some special handling thrown in
for PCHs

_OutdatedFileNames = new StringCollection();

if (NeedsCompiling()) {

// If we need compiling, but Outdate File
collection is empty,
// it's PCH stuff - mark all files as outdated
if( _OutdatedFileNames.Count == 0 ) {
Log(Level.Verbose, "PCH out of date, recompiling
all.");
_OutdatedFileNames = Sources.FileNames;
}

Log(Level.Info, "Compiling {0} files to
'{1}'.",
_OutdatedFileNames.Count,
OutputDir.FullName);

.... lots of ExecuteTask code ... then, building the
list of files in ExecuteTask

// write each of the filenames
//foreach (string filename in
Sources.FileNames) {
foreach (string filename in _OutdatedFileNames ) {

writer.WriteLine(QuoteArgumentValue(filename));
}

... And finally, a modified AreObjsUpToDate that
collects all outdated cpp files

private bool AreObjsUpToDate() {
foreach (string filename in
Sources.FileNames) {
// if the source file does not exist,
then we'll consider it
// not up-to-date
if (!File.Exists(filename)) {
Log(Level.Verbose, "'{0}' does not
exist, recompiling.",
filename);
_OutdatedFileNames.Add( filename );
}

if (!IsObjUpToDate(filename)) {
_OutdatedFileNames.Add( filename );
}

}

// If we didn't have any outdated files, the OBJs
are up to date
return ( _OutdatedFileNames.Count ==0 );
}

Discussion

  • Gert Driesen

    Gert Driesen - 2005-05-04
    • status: open --> closed
     
  • Gert Driesen

    Gert Driesen - 2005-05-04
    • labels: --> Tasks
    • status: closed --> closed-fixed
     
  • Gert Driesen

    Gert Driesen - 2005-05-04

    Logged In: YES
    user_id=707851

    This is now fixed in cvs.

    Thanks for the report !

     
  • Gert Driesen

    Gert Driesen - 2005-05-04
    • milestone: --> 0.85
    • assigned_to: nobody --> drieseng
     

Log in to post a comment.