diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-06-09 13:07:25 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-06-14 09:47:11 +0000 |
commit | 4a3a382ea2f7ed6f55b0655acbf780f28ba25159 (patch) | |
tree | e9f6c5a50a0637fd74d3fabc348c7ff73fdac988 /src/lib/corelib/buildgraph/buildgraphloader.cpp | |
parent | 002542825419d63291e69569f82aa6857ec16117 (diff) |
API: Allow synchronous retrieval of build graph data
This is needed to import builds into Qt Creator.
Task-number: QBS-1059
Change-Id: I8a1b226d3f0044c7e90a61d195796a1e8be9a9de
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/buildgraphloader.cpp')
-rw-r--r-- | src/lib/corelib/buildgraph/buildgraphloader.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp index 1120cea98..6b094164a 100644 --- a/src/lib/corelib/buildgraph/buildgraphloader.cpp +++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp @@ -54,6 +54,7 @@ #include <language/qualifiedid.h> #include <language/resolvedfilecontext.h> #include <logging/translator.h> +#include <tools/buildgraphlocker.h> #include <tools/fileinfo.h> #include <tools/persistence.h> #include <tools/profiling.h> @@ -138,6 +139,21 @@ BuildGraphLoadResult BuildGraphLoader::load(const TopLevelProjectPtr &existingPr return m_result; } +TopLevelProjectConstPtr BuildGraphLoader::loadProject(const QString &bgFilePath) +{ + class LogSink : public ILogSink { + void doPrintMessage(LoggerLevel, const QString &, const QString &) override { } + } dummySink; + Logger dummyLogger(&dummySink); + BuildGraphLocker bgLocker(bgFilePath, dummyLogger, false, nullptr); + PersistentPool pool(dummyLogger); + pool.load(bgFilePath); + const TopLevelProjectPtr project = TopLevelProject::create(); + project->load(pool); + project->setBuildConfiguration(pool.headData().projectConfig); + return project; +} + void BuildGraphLoader::loadBuildGraphFromDisk() { const QString projectId = TopLevelProject::deriveId(m_parameters.finalBuildConfigurationTree()); |