diff options
-rw-r--r-- | src/lib/buildgraph/executor.cpp | 9 | ||||
-rw-r--r-- | src/lib/buildgraph/executor.h | 1 | ||||
-rw-r--r-- | src/lib/tools/buildoptions.cpp | 22 | ||||
-rw-r--r-- | src/lib/tools/buildoptions.h | 3 |
4 files changed, 35 insertions, 0 deletions
diff --git a/src/lib/buildgraph/executor.cpp b/src/lib/buildgraph/executor.cpp index b41c5dd93..596672ebc 100644 --- a/src/lib/buildgraph/executor.cpp +++ b/src/lib/buildgraph/executor.cpp @@ -182,6 +182,7 @@ void Executor::doBuild() m_leaves.clear(); m_error.clear(); m_explicitlyCanceled = false; + m_activeFileTags = FileTags::fromStringList(m_buildOptions.activeFileTags()); setState(ExecutorRunning); @@ -416,6 +417,14 @@ void Executor::buildArtifact(Artifact *artifact) } } + // Skip if we're building just one file and the file tags do not match. + if (!m_activeFileTags.isEmpty() && !m_activeFileTags.matches(artifact->fileTags)) { + if (m_doDebug) + m_logger.qbsDebug() << "[EXEC] file tags do not match. Skipping."; + finishArtifact(artifact); + return; + } + // Skip transformers that do not need to be built. if (!mustExecuteTransformer(artifact->transformer)) { if (m_doDebug) diff --git a/src/lib/buildgraph/executor.h b/src/lib/buildgraph/executor.h index e55909744..1a3b44702 100644 --- a/src/lib/buildgraph/executor.h +++ b/src/lib/buildgraph/executor.h @@ -129,6 +129,7 @@ private: int m_mocEffort; ErrorInfo m_error; bool m_explicitlyCanceled; + FileTags m_activeFileTags; const bool m_doTrace; const bool m_doDebug; }; diff --git a/src/lib/tools/buildoptions.cpp b/src/lib/tools/buildoptions.cpp index 945302e83..e836206fb 100644 --- a/src/lib/tools/buildoptions.cpp +++ b/src/lib/tools/buildoptions.cpp @@ -42,6 +42,7 @@ public: } QStringList changedFiles; + QStringList activeFileTags; int maxJobCount; bool dryRun; bool keepGoing; @@ -96,6 +97,27 @@ void BuildOptions::setChangedFiles(const QStringList &changedFiles) } /*! + * \brief The list of active file tags. + * \sa setActiveFileTags + */ +QStringList BuildOptions::activeFileTags() const +{ + return d->activeFileTags; +} + +/*! + * \brief Set the list of active file tags. + * If this list is non-empty, then every transformer with non-matching output file tags is skipped. + * E.g. set changed files to "foo.cpp" and activeFileTags to ["obj"] to run the compiler + * on foo.cpp without further processing like linking. + * \sa activeFileTags + */ +void BuildOptions::setActiveFileTags(const QStringList &fileTags) +{ + d->activeFileTags = fileTags; +} + +/*! * \brief Returns the default value for \c maxJobCount. * This value will be used when \c maxJobCount has not been set explicitly. */ diff --git a/src/lib/tools/buildoptions.h b/src/lib/tools/buildoptions.h index 0f40abb9e..7bf37c66e 100644 --- a/src/lib/tools/buildoptions.h +++ b/src/lib/tools/buildoptions.h @@ -48,6 +48,9 @@ public: QStringList changedFiles() const; void setChangedFiles(const QStringList &changedFiles); + QStringList activeFileTags() const; + void setActiveFileTags(const QStringList &fileTags); + static int defaultMaxJobCount(); int maxJobCount() const; void setMaxJobCount(int jobCount); |