diff options
author | David Cole <david.cole@kitware.com> | 2012-08-24 18:23:42 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-08-24 18:23:42 (GMT) |
commit | 6d4a3053e63e00f0b0d002ddecd81ff489c97355 (patch) | |
tree | 9a227bf0bbdcc2a933054255aef3a8ac9b4e5616 | |
parent | bc147d99caa9186b2dc0a431bd6c0f49a1ded594 (diff) | |
parent | 8aed02ae0f753dce76a167367ecf54be1d04de2b (diff) | |
download | CMake-6d4a3053e63e00f0b0d002ddecd81ff489c97355.zip CMake-6d4a3053e63e00f0b0d002ddecd81ff489c97355.tar.gz CMake-6d4a3053e63e00f0b0d002ddecd81ff489c97355.tar.bz2 |
Merge topic 'DependencyScanning_13474'
8aed02a -fix Java dependency scanning, broken in previous commit
7ae4479 -fix line length
87fe428 fix #13474: also rescan dependencies if the depender does not exist
-rw-r--r-- | Source/cmDepends.cxx | 63 | ||||
-rw-r--r-- | Source/cmDepends.h | 1 | ||||
-rw-r--r-- | Source/cmDependsJava.cxx | 2 | ||||
-rw-r--r-- | Source/cmDependsJava.h | 3 |
4 files changed, 50 insertions, 19 deletions
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 545fe97..166a584 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -98,7 +98,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile, // Check whether dependencies must be regenerated. bool okay = true; std::ifstream fin(internalFile); - if(!(fin && this->CheckDependencies(fin, validDeps))) + if(!(fin && this->CheckDependencies(fin, internalFile, validDeps))) { // Clear all dependencies so they will be regenerated. this->Clear(makeFile); @@ -143,6 +143,7 @@ bool cmDepends::WriteDependencies(const char*, const char*, //---------------------------------------------------------------------------- bool cmDepends::CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map<std::string, DependencyVector>& validDeps) { // Parse dependencies from the stream. If any dependee is missing @@ -186,8 +187,11 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, } */ - // Dependencies must be regenerated if the dependee does not exist - // or if the depender exists and is older than the dependee. + // Dependencies must be regenerated + // * if the dependee does not exist + // * if the depender exists and is older than the dependee. + // * if the depender does not exist, but the dependee is newer than the + // depends file bool regenerate = false; const char* dependee = this->Dependee+1; const char* depender = this->Depender; @@ -211,24 +215,49 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, cmSystemTools::Stdout(msg.str().c_str()); } } - else if(dependerExists) + else { - // The dependee and depender both exist. Compare file times. - int result = 0; - if((!this->FileComparison->FileTimeCompare(depender, dependee, - &result) || result < 0)) + if(dependerExists) { - // The depender is older than the dependee. - regenerate = true; + // The dependee and depender both exist. Compare file times. + int result = 0; + if((!this->FileComparison->FileTimeCompare(depender, dependee, + &result) || result < 0)) + { + // The depender is older than the dependee. + regenerate = true; - // Print verbose output. - if(this->Verbose) + // Print verbose output. + if(this->Verbose) + { + cmOStringStream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depender \"" + << depender << "\"." << std::endl; + cmSystemTools::Stdout(msg.str().c_str()); + } + } + } + else + { + // The dependee exists, but the depender doesn't. Regenerate if the + // internalDepends file is older than the dependee. + int result = 0; + if((!this->FileComparison->FileTimeCompare(internalDependsFileName, + dependee, &result) || result < 0)) { - cmOStringStream msg; - msg << "Dependee \"" << dependee - << "\" is newer than depender \"" - << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + // The depends-file is older than the dependee. + regenerate = true; + + // Print verbose output. + if(this->Verbose) + { + cmOStringStream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depends file \"" + << internalDependsFileName << "\"." << std::endl; + cmSystemTools::Stdout(msg.str().c_str()); + } } } } diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 100e187..f7dc881 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -83,6 +83,7 @@ protected: // Return false if dependencies must be regenerated and true // otherwise. virtual bool CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map<std::string, DependencyVector>& validDeps); // Finalize the dependency information for the target. diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 1d84914..ba0e8fb 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -38,7 +38,7 @@ bool cmDependsJava::WriteDependencies(const char *src, const char *, return true; } -bool cmDependsJava::CheckDependencies(std::istream&, +bool cmDependsJava::CheckDependencies(std::istream&, const char*, std::map<std::string, DependencyVector >&) { return true; diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index fe6fef5..bf7e234 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -32,7 +32,8 @@ protected: virtual bool WriteDependencies(const char *src, const char *file, std::ostream& makeDepends, std::ostream& internalDepends); virtual bool CheckDependencies(std::istream& internalDepends, - std::map<std::string, DependencyVector >& validDeps); + const char* internalDependsFileName, + std::map<std::string, DependencyVector>& validDeps); private: cmDependsJava(cmDependsJava const&); // Purposely not implemented. |