summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2013-07-22 18:23:53 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2013-07-23 12:45:23 +0200
commit03590bb1ca6bd6fb84d7e23af3a39d419f869ddf (patch)
tree3e0d72f5a17311a853a2ee096b398b2097a9aaa4
parent81b9c927208215d14715f66fbf8e266dd442c727 (diff)
downloadqbs-03590bb1ca6bd6fb84d7e23af3a39d419f869ddf.tar.gz
provide "compile single file" functionality
To compile just one single file without any further effects, pass the file name to BuildOptions::setChangedFiles, and the file tags of the desired results to BuildOptions::setActiveFileTags. Task-number: QBS-283 Change-Id: I70213b248e1e07fd7524a54f7f2e4f250621967f Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
-rw-r--r--src/lib/buildgraph/executor.cpp9
-rw-r--r--src/lib/buildgraph/executor.h1
-rw-r--r--src/lib/tools/buildoptions.cpp22
-rw-r--r--src/lib/tools/buildoptions.h3
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);