diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-12 14:06:53 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-12 12:15:58 +0000 |
commit | 356e3a633924dceebe4aed5d236cd8bdd2f1d7d3 (patch) | |
tree | 02db114b307b2b508d72452360a9468fd4fbf671 /src/lib/corelib/buildgraph/executor.cpp | |
parent | f152d9e4ecaf4c36abb7270dfa5ab7747927ac32 (diff) |
Executor: Sync file dependency timestamps once
... instead of doing it again for every artifact. Typically, artifacts
share a lot of file dependencies (e.g. external header files). The old
code retrieved such timestamps over and over again during the same
build.
Change-Id: I100287eff93792adcc4b10847173081809439cac
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/executor.cpp')
-rw-r--r-- | src/lib/corelib/buildgraph/executor.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index 8950577f8..86438ec4f 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -402,13 +402,9 @@ bool Executor::isUpToDate(Artifact *artifact) const for (FileDependency *fileDependency : qAsConst(artifact->fileDependencies)) { if (!fileDependency->timestamp().isValid()) { - FileInfo fi(fileDependency->filePath()); - fileDependency->setTimestamp(fi.lastModified()); - if (!fileDependency->timestamp().isValid()) { - qCDebug(lcUpToDateCheck) << "file dependency doesn't exist" - << fileDependency->filePath(); - return false; - } + qCDebug(lcUpToDateCheck) << "file dependency doesn't exist" + << fileDependency->filePath(); + return false; } qCDebug(lcUpToDateCheck) << "file dependency timestamp" << fileDependency->timestamp().toString() @@ -793,9 +789,7 @@ void Executor::rescueOldBuildData(Artifact *artifact, bool *childrenAdded = 0) << "not in the project's list of dependencies anymore."; break; } - FileDependency * const dep = static_cast<FileDependency *>(*depIt); - dep->clearTimestamp(); - artifact->fileDependencies.insert(dep); + artifact->fileDependencies.insert(static_cast<FileDependency *>(*depIt)); } if (canRescue) { @@ -1150,7 +1144,9 @@ void Executor::syncFileDependencies() Set<FileDependency *> &globalFileDepList = m_project->buildData->fileDependencies; for (auto it = globalFileDepList.begin(); it != globalFileDepList.end(); ) { FileDependency * const dep = *it; - if (FileInfo(dep->filePath()).exists()) { + FileInfo fi(dep->filePath()); + if (fi.exists()) { + dep->setTimestamp(fi.lastModified()); ++it; continue; } @@ -1175,6 +1171,7 @@ void Executor::syncFileDependencies() it = globalFileDepList.erase(it); delete dep; } else { + dep->clearTimestamp(); ++it; } } @@ -1192,13 +1189,6 @@ void Executor::prepareArtifact(Artifact *artifact) m_changedSourceArtifacts.push_back(artifact); possiblyInstallArtifact(artifact); } - - // Timestamps of file dependencies must be invalid for every build. - // TODO: These should be a subset of ProjectBuildData::fileDependencies, so clear the - // timestamps in syncFileDepencencies() instead. - // TODO: Verify this assumption in the sanity checks. - for (FileDependency * const fileDependency : qAsConst(artifact->fileDependencies)) - fileDependency->clearTimestamp(); } void Executor::setupForBuildingSelectedFiles(const BuildGraphNode *node) |