diff options
author | Marco Bubke <marco.bubke@qt.io> | 2018-10-24 16:46:41 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2018-10-25 13:35:11 +0000 |
commit | f8ec57919f47ef123a290ab7203ab06362d4ccfb (patch) | |
tree | 31f1706057d0b20e5c8c2ba335d790328366b103 /src/tools | |
parent | ee2122be702dd3ef502c679535296d7fadad01a4 (diff) | |
download | qt-creator-f8ec57919f47ef123a290ab7203ab06362d4ccfb.tar.gz |
ClangPchManager: Add PchTaskGenerator
Task-number: QTCREATORBUG-21358
Change-Id: Ia460ce82c3c896f4d0ac00638d03800a55dd27dc
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/tools')
7 files changed, 242 insertions, 4 deletions
diff --git a/src/tools/clangpchmanagerbackend/source/builddependencies.h b/src/tools/clangpchmanagerbackend/source/builddependencies.h new file mode 100644 index 0000000000..9e0eb3f629 --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/builddependencies.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include <filepathid.h> + +#include <vector> + +namespace ClangBackEnd { + +class BuildDependency +{ +public: + FilePathIds includeIds; + FilePathIds topIncludeIds; + FilePathIds topsSystemIncludeIds; +}; + +using BuildDependencies = std::vector<BuildDependency>; + +} diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h b/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h new file mode 100644 index 0000000000..b02831a7ba --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "builddependencies.h" + +#include "projectpartcontainerv2.h" + +namespace ClangBackEnd { + +class BuildDependenciesProviderInterface +{ +public: + virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) = 0; + +protected: + ~BuildDependenciesProviderInterface() = default; +}; + +} // namespace ClangBackEnd + diff --git a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri index f0104c00ea..ad17b98f18 100644 --- a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri +++ b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri @@ -3,7 +3,8 @@ INCLUDEPATH += $$PWD SOURCES += \ $$PWD/pchmanagerserver.cpp \ $$PWD/projectparts.cpp \ - $$PWD/projectpartqueue.cpp + $$PWD/projectpartqueue.cpp \ + $$PWD/pchtaskgenerator.cpp HEADERS += \ $$PWD/pchmanagerserver.h \ @@ -23,7 +24,11 @@ HEADERS += \ $$PWD/precompiledheaderstorage.h \ $$PWD/precompiledheaderstorageinterface.h \ $$PWD/usedmacroandsourcestorageinterface.h \ - $$PWD/usedmacroandsourcestorage.h + $$PWD/usedmacroandsourcestorage.h \ + $$PWD/pchtaskgenerator.h \ + $$PWD/pchtask.h \ + $$PWD/builddependenciesproviderinterface.h \ + $$PWD/builddependencies.h !isEmpty(LIBTOOLING_LIBS) { SOURCES += \ diff --git a/src/tools/clangpchmanagerbackend/source/pchtask.h b/src/tools/clangpchmanagerbackend/source/pchtask.h new file mode 100644 index 0000000000..39c7bbf01a --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/pchtask.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "builddependencies.h" + +#include <utils/smallstringvector.h> + +namespace ClangBackEnd { + +class PchTask +{ +public: + PchTask(Utils::SmallStringVector &&ids, BuildDependency &&buildDependency) + : ids(std::move(ids)), + buildDependency(std::move(buildDependency)) + { + } + + Utils::SmallStringVector ids; + BuildDependency buildDependency; +}; + +using PchTasks = std::vector<PchTask>; +} diff --git a/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp new file mode 100644 index 0000000000..a9be6f9c25 --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "pchtaskgenerator.h" + +#include "builddependenciesproviderinterface.h" + +#include <utils/algorithm.h> + +namespace ClangBackEnd { + +PchTasks PchTaskGenerator::create(V2::ProjectPartContainers &&projectParts) +{ + PchTasks tasks; + tasks.reserve(projectParts.size() * 2); + + for (auto &projectPart : projectParts) { + tasks.emplace_back(std::initializer_list<Utils::SmallString>{{projectPart.projectPartId}}, + m_buildDependenciesProvider.create(projectPart)); + } + + return tasks; +} + +} // namespace ClangBackEnd diff --git a/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h new file mode 100644 index 0000000000..c629d10760 --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/pchtaskgenerator.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "pchtask.h" + +#include <projectpartcontainerv2.h> + +namespace ClangBackEnd { + +class BuildDependenciesProviderInterface; + +class PchTaskGenerator +{ +public: + PchTaskGenerator(BuildDependenciesProviderInterface &buildDependenciesProvider) + : m_buildDependenciesProvider(buildDependenciesProvider) + {} + + PchTasks create(V2::ProjectPartContainers &&projectParts); + +private: + BuildDependenciesProviderInterface &m_buildDependenciesProvider; +}; + + +} // namespace ClangBackEnd diff --git a/src/tools/clangpchmanagerbackend/source/taskscheduler.h b/src/tools/clangpchmanagerbackend/source/taskscheduler.h index 35c3c51984..129cbbe9db 100644 --- a/src/tools/clangpchmanagerbackend/source/taskscheduler.h +++ b/src/tools/clangpchmanagerbackend/source/taskscheduler.h @@ -63,11 +63,11 @@ public: using ProcessorInterface = typename ProcessorManager::Processor; using Future = std::future<ProcessorInterface&>; - TaskScheduler(ProcessorManager &symbolsCollectorManager, + TaskScheduler(ProcessorManager &processorManager, QueueInterface &queue, uint hardwareConcurrency, std::launch launchPolicy = std::launch::async) - : m_processorManager(symbolsCollectorManager), + : m_processorManager(processorManager), m_queue(queue), m_hardwareConcurrency(hardwareConcurrency), m_launchPolicy(launchPolicy) |