aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2012-12-03 12:30:33 +0100
committerJoerg Bornemann <joerg.bornemann@digia.com>2012-12-05 15:49:40 +0100
commit8fe229f85afb621c7b3dfe575a19518802bd4d41 (patch)
tree892ff387688ec792f6703608ac0e91fef314ab5b
parent8d536f021db8cf46584af3e0bc6ab6f64125171e (diff)
Store the build graph also after resolving a project.
Otherwise, the resolving will be done over and over again for repeated calls to "qbs status" and "qbs properties" as well as for IDEs that load a project without necessarily building it, which is a common use case. Change-Id: I35a822c27c0deb62c416ec34c8aff1195dd3bb73 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/lib/api/internaljobs.cpp20
-rw-r--r--src/lib/api/internaljobs.h1
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp2
3 files changed, 14 insertions, 9 deletions
diff --git a/src/lib/api/internaljobs.cpp b/src/lib/api/internaljobs.cpp
index d877491dd..994f7bf74 100644
--- a/src/lib/api/internaljobs.cpp
+++ b/src/lib/api/internaljobs.cpp
@@ -90,6 +90,14 @@ void InternalJob::cancel()
m_observer->cancel();
}
+void InternalJob::storeBuildGraph(const BuildProject *buildProject)
+{
+ try {
+ buildProject->store();
+ } catch (const Error &error) {
+ qbsWarning() << error.toString();
+ }
+}
InternalSetupProjectJob::InternalSetupProjectJob(QObject *parent)
: InternalJob(parent), m_running(false)
@@ -189,6 +197,8 @@ void InternalSetupProjectJob::execute()
m_buildProject->rescueDependencies(loadResult.loadedProject);
}
+ storeBuildGraph(m_buildProject.data());
+
// The evalutation context cannot be re-used for building, which runs in a different thread.
m_buildProject->setEvaluationContext(RulesEvaluationContextPtr());
}
@@ -211,16 +221,10 @@ void BuildGraphTouchingJob::setup(const QList<BuildProductPtr> &products,
void BuildGraphTouchingJob::storeBuildGraph()
{
- try {
- if (m_buildOptions.dryRun)
- return;
- m_products.first()->project->store();
- } catch (const Error &error) {
- qbsWarning() << error.toString();
- }
+ if (!m_buildOptions.dryRun)
+ InternalJob::storeBuildGraph(m_products.first()->project);
}
-
InternalBuildJob::InternalBuildJob(QObject *parent) : BuildGraphTouchingJob(parent)
{
}
diff --git a/src/lib/api/internaljobs.h b/src/lib/api/internaljobs.h
index ed82be5c7..00c9eb250 100644
--- a/src/lib/api/internaljobs.h
+++ b/src/lib/api/internaljobs.h
@@ -58,6 +58,7 @@ protected:
JobObserver *observer() const { return m_observer; }
void setError(const Error &error) { m_error = error; }
+ void storeBuildGraph(const BuildProject *buildProject);
signals:
void finished(Internal::InternalJob *job);
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 608a2c5c4..ec2a95fa9 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -216,7 +216,7 @@ void TestBlackbox::build_project_dry_run()
QCOMPARE(runQbs(QStringList() << "-n"), 0);
const QStringList &buildDirContents
= QDir(buildDir).entryList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs);
- QVERIFY2(buildDirContents.isEmpty(), qPrintable(buildDirContents.join(" ")));
+ QVERIFY2(buildDirContents.count() == 1, qPrintable(buildDirContents.join(" ")));
}
void TestBlackbox::track_qrc()