forked from qt-creator/qt-creator
ClangPchManager: Add BuildDependenciesProvider
It is still unfinished but I want to add other changes first. Change-Id: Ife7ac56576f85d800633ea1e8f1c3f4f16486d5f Task-number: QTCREATORBUG-21377 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "builddependency.h"
|
||||||
|
|
||||||
|
#include "projectpartcontainerv2.h"
|
||||||
|
|
||||||
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
class BuildDependenciesGeneratorInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~BuildDependenciesGeneratorInterface() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ClangBackEnd
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "builddependenciesprovider.h"
|
||||||
|
|
||||||
|
#include "builddependenciesstorageinterface.h"
|
||||||
|
#include "modifiedtimecheckerinterface.h"
|
||||||
|
#include "builddependenciesgeneratorinterface.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
template<class OutputContainer,
|
||||||
|
class InputContainer1,
|
||||||
|
class InputContainer2>
|
||||||
|
OutputContainer setUnion(InputContainer1 &&input1,
|
||||||
|
InputContainer2 &&input2)
|
||||||
|
{
|
||||||
|
OutputContainer results;
|
||||||
|
results.reserve(input1.size() + input2.size());
|
||||||
|
|
||||||
|
std::set_union(std::begin(input1),
|
||||||
|
std::end(input1),
|
||||||
|
std::begin(input2),
|
||||||
|
std::end(input2),
|
||||||
|
std::back_inserter(results));
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildDependency BuildDependenciesProvider::create(const V2::ProjectPartContainer &projectPart) const
|
||||||
|
{
|
||||||
|
SourceEntries includes = createSourceEntriesFromStorage(projectPart.sourcePathIds);
|
||||||
|
|
||||||
|
if (!m_modifiedTimeChecker.isUpToDate(includes))
|
||||||
|
return m_buildDependenciesGenerator.create(projectPart);
|
||||||
|
|
||||||
|
return createBuildDependencyFromStorage(std::move(includes));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildDependency BuildDependenciesProvider::createBuildDependencyFromStorage(SourceEntries &&includes) const
|
||||||
|
{
|
||||||
|
BuildDependency buildDependency;
|
||||||
|
|
||||||
|
buildDependency.usedMacros = createUsedMacrosFromStorage(includes);
|
||||||
|
buildDependency.includes = std::move(includes);
|
||||||
|
|
||||||
|
return buildDependency;
|
||||||
|
}
|
||||||
|
|
||||||
|
UsedMacros BuildDependenciesProvider::createUsedMacrosFromStorage(const SourceEntries &includes) const
|
||||||
|
{
|
||||||
|
UsedMacros usedMacros;
|
||||||
|
usedMacros.reserve(1024);
|
||||||
|
|
||||||
|
for (const SourceEntry &entry : includes) {
|
||||||
|
UsedMacros macros = m_buildDependenciesStorage.fetchUsedMacros(entry.sourceId);
|
||||||
|
std::sort(macros.begin(), macros.end());
|
||||||
|
usedMacros.insert(usedMacros.end(),
|
||||||
|
std::make_move_iterator(macros.begin()),
|
||||||
|
std::make_move_iterator(macros.end()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return usedMacros;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceEntries BuildDependenciesProvider::createSourceEntriesFromStorage(
|
||||||
|
const FilePathIds &sourcePathIds) const
|
||||||
|
{
|
||||||
|
SourceEntries includes;
|
||||||
|
|
||||||
|
for (FilePathId sourcePathId : sourcePathIds) {
|
||||||
|
SourceEntries entries = m_buildDependenciesStorage.fetchDependSources(sourcePathId);
|
||||||
|
SourceEntries mergedEntries = setUnion<SourceEntries>(includes, entries);
|
||||||
|
|
||||||
|
includes = std::move(mergedEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
return includes;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ClangBackEnd
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "builddependenciesproviderinterface.h"
|
||||||
|
|
||||||
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
class BuildDependenciesStorageInterface;
|
||||||
|
class ModifiedTimeCheckerInterface;
|
||||||
|
class BuildDependenciesGeneratorInterface;
|
||||||
|
|
||||||
|
class BuildDependenciesProvider : public BuildDependenciesProviderInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BuildDependenciesProvider(BuildDependenciesStorageInterface &buildDependenciesStorage,
|
||||||
|
ModifiedTimeCheckerInterface &modifiedTimeChecker,
|
||||||
|
BuildDependenciesGeneratorInterface &buildDependenciesGenerator)
|
||||||
|
: m_buildDependenciesStorage(buildDependenciesStorage),
|
||||||
|
m_modifiedTimeChecker(modifiedTimeChecker),
|
||||||
|
m_buildDependenciesGenerator(buildDependenciesGenerator)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildDependency create(const V2::ProjectPartContainer &projectPart) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BuildDependency createBuildDependencyFromStorage(SourceEntries &&includes) const;
|
||||||
|
UsedMacros createUsedMacrosFromStorage(const SourceEntries &includes) const;
|
||||||
|
SourceEntries createSourceEntriesFromStorage(const FilePathIds &sourcePathIds) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BuildDependenciesStorageInterface &m_buildDependenciesStorage;
|
||||||
|
ModifiedTimeCheckerInterface &m_modifiedTimeChecker;
|
||||||
|
BuildDependenciesGeneratorInterface &m_buildDependenciesGenerator;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ClangBackEnd
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "builddependencies.h"
|
#include "builddependency.h"
|
||||||
|
|
||||||
#include "projectpartcontainerv2.h"
|
#include "projectpartcontainerv2.h"
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ namespace ClangBackEnd {
|
|||||||
class BuildDependenciesProviderInterface
|
class BuildDependenciesProviderInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) = 0;
|
virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~BuildDependenciesProviderInterface() = default;
|
~BuildDependenciesProviderInterface() = default;
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 <builddependency.h>
|
||||||
|
#include <filepathid.h>
|
||||||
|
#include <filestatus.h>
|
||||||
|
#include <sourcedependency.h>
|
||||||
|
#include <usedmacro.h>
|
||||||
|
|
||||||
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
class BuildDependenciesStorageInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BuildDependenciesStorageInterface() = default;
|
||||||
|
BuildDependenciesStorageInterface(const BuildDependenciesStorageInterface &) = delete;
|
||||||
|
BuildDependenciesStorageInterface &operator=(const BuildDependenciesStorageInterface &) = delete;
|
||||||
|
|
||||||
|
virtual void updateSources(const SourceEntries &sourceIds) = 0;
|
||||||
|
virtual void insertOrUpdateUsedMacros(const UsedMacros &usedMacros) = 0;
|
||||||
|
virtual void insertFileStatuses(const FileStatuses &fileStatuses) = 0;
|
||||||
|
virtual void insertOrUpdateSourceDependencies(const SourceDependencies &sourceDependencies) = 0;
|
||||||
|
virtual long long fetchLowestLastModifiedTime(FilePathId sourceId) const = 0;
|
||||||
|
virtual SourceEntries fetchDependSources(FilePathId sourceId) const = 0;
|
||||||
|
virtual UsedMacros fetchUsedMacros(FilePathId sourceId) const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~BuildDependenciesStorageInterface() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ClangBackEnd
|
||||||
@@ -25,18 +25,18 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <filepathid.h>
|
#include "sourceentry.h"
|
||||||
|
#include "usedmacro.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
class BuildDependency
|
class BuildDependency
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FilePathIds includeIds;
|
SourceEntries includes;
|
||||||
FilePathIds topIncludeIds;
|
FilePathIds topIncludeIds;
|
||||||
FilePathIds topsSystemIncludeIds;
|
FilePathIds topsSystemIncludeIds;
|
||||||
|
UsedMacros usedMacros;
|
||||||
};
|
};
|
||||||
|
|
||||||
using BuildDependencies = std::vector<BuildDependency>;
|
using BuildDependencies = std::vector<BuildDependency>;
|
||||||
@@ -4,7 +4,8 @@ SOURCES += \
|
|||||||
$$PWD/pchmanagerserver.cpp \
|
$$PWD/pchmanagerserver.cpp \
|
||||||
$$PWD/projectparts.cpp \
|
$$PWD/projectparts.cpp \
|
||||||
$$PWD/projectpartqueue.cpp \
|
$$PWD/projectpartqueue.cpp \
|
||||||
$$PWD/pchtaskgenerator.cpp
|
$$PWD/pchtaskgenerator.cpp \
|
||||||
|
$$PWD/builddependenciesprovider.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/pchmanagerserver.h \
|
$$PWD/pchmanagerserver.h \
|
||||||
@@ -28,7 +29,12 @@ HEADERS += \
|
|||||||
$$PWD/pchtaskgenerator.h \
|
$$PWD/pchtaskgenerator.h \
|
||||||
$$PWD/pchtask.h \
|
$$PWD/pchtask.h \
|
||||||
$$PWD/builddependenciesproviderinterface.h \
|
$$PWD/builddependenciesproviderinterface.h \
|
||||||
$$PWD/builddependencies.h
|
$$PWD/builddependenciesprovider.h \
|
||||||
|
$$PWD/builddependenciesstorageinterface.h \
|
||||||
|
$$PWD/builddependency.h \
|
||||||
|
$$PWD/modifiedtimecheckerinterface.h \
|
||||||
|
$$PWD/sourceentry.h \
|
||||||
|
$$PWD/builddependenciesgeneratorinterface.h
|
||||||
|
|
||||||
!isEmpty(LIBTOOLING_LIBS) {
|
!isEmpty(LIBTOOLING_LIBS) {
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "sourceentry.h"
|
||||||
|
|
||||||
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
class ModifiedTimeCheckerInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ModifiedTimeCheckerInterface() = default;
|
||||||
|
ModifiedTimeCheckerInterface(const ModifiedTimeCheckerInterface &) = delete;
|
||||||
|
ModifiedTimeCheckerInterface &operator=(const ModifiedTimeCheckerInterface &) = delete;
|
||||||
|
|
||||||
|
virtual bool isUpToDate(const SourceEntries &sourceEntries) const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~ModifiedTimeCheckerInterface() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ClangBackEnd
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "builddependencies.h"
|
#include "builddependency.h"
|
||||||
|
|
||||||
#include <utils/smallstringvector.h>
|
#include <utils/smallstringvector.h>
|
||||||
|
|
||||||
|
|||||||
80
src/tools/clangpchmanagerbackend/source/sourceentry.h
Normal file
80
src/tools/clangpchmanagerbackend/source/sourceentry.h
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 {
|
||||||
|
|
||||||
|
enum SourceType : unsigned char
|
||||||
|
{
|
||||||
|
Any,
|
||||||
|
TopInclude,
|
||||||
|
TopSystemInclude
|
||||||
|
};
|
||||||
|
|
||||||
|
class TimeStamp
|
||||||
|
{
|
||||||
|
using int64 = long long;
|
||||||
|
public:
|
||||||
|
TimeStamp(int64 value)
|
||||||
|
: value(value)
|
||||||
|
{}
|
||||||
|
|
||||||
|
operator int64() const
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64 value = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SourceEntry
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
friend
|
||||||
|
bool operator<(SourceEntry first, SourceEntry second)
|
||||||
|
{
|
||||||
|
return first.sourceId < second.sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend
|
||||||
|
bool operator==(SourceEntry first, SourceEntry second)
|
||||||
|
{
|
||||||
|
return first.sourceId == second.sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
FilePathId sourceId;
|
||||||
|
SourceType sourceType = SourceType::Any;
|
||||||
|
TimeStamp lastModified;
|
||||||
|
};
|
||||||
|
|
||||||
|
using SourceEntries = std::vector<SourceEntry>;
|
||||||
|
|
||||||
|
}
|
||||||
152
tests/unit/unittest/builddependenciesprovider-test.cpp
Normal file
152
tests/unit/unittest/builddependenciesprovider-test.cpp
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "googletest.h"
|
||||||
|
|
||||||
|
#include "mockbuilddependencystorage.h"
|
||||||
|
#include "mockmodifiedtimechecker.h"
|
||||||
|
#include "mockbuilddependenciesgenerator.h"
|
||||||
|
|
||||||
|
#include <builddependenciesprovider.h>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
using ClangBackEnd::BuildDependency;
|
||||||
|
using ClangBackEnd::BuildDependencies;
|
||||||
|
using ClangBackEnd::FilePathId;
|
||||||
|
using ClangBackEnd::FilePathIds;
|
||||||
|
using ClangBackEnd::SourceEntry;
|
||||||
|
using ClangBackEnd::SourceEntries;
|
||||||
|
using ClangBackEnd::SourceType;
|
||||||
|
using ClangBackEnd::UsedMacro;
|
||||||
|
using ClangBackEnd::UsedMacros;
|
||||||
|
|
||||||
|
MATCHER_P(HasSourceId, sourceId, std::string(negation ? "hasn't" : "has")
|
||||||
|
+ " sourceId " + PrintToString(sourceId))
|
||||||
|
{
|
||||||
|
const SourceEntry & sourceEntry = arg;
|
||||||
|
|
||||||
|
return sourceEntry.sourceId.filePathId == sourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
class BuildDependenciesProvider : public testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
NiceMock<MockBuildDependenciesStorage> mockBuildDependenciesStorage;
|
||||||
|
NiceMock<MockModifiedTimeChecker> mockModifiedTimeChecker;
|
||||||
|
NiceMock<MockBuildDependenciesGenerator> mockBuildDependenciesGenerator;
|
||||||
|
ClangBackEnd::BuildDependenciesProvider provider{mockBuildDependenciesStorage, mockModifiedTimeChecker, mockBuildDependenciesGenerator};
|
||||||
|
ClangBackEnd::V2::ProjectPartContainer projectPart1{"ProjectPart1",
|
||||||
|
{"--yi"},
|
||||||
|
{{"YI","1"}},
|
||||||
|
{"/yi"},
|
||||||
|
{{1, 1}},
|
||||||
|
{{1, 2}}};
|
||||||
|
ClangBackEnd::V2::ProjectPartContainer projectPart2{"ProjectPart2",
|
||||||
|
{"--er"},
|
||||||
|
{{"ER","2"}},
|
||||||
|
{"/er"},
|
||||||
|
{{1, 1}},
|
||||||
|
{{1, 2}, {1, 3}, {1, 4}}};
|
||||||
|
SourceEntries firstSources{{{1, 1}, SourceType::Any, 1}, {{1, 2}, SourceType::Any, 1}, {{1, 10}, SourceType::Any, 1}};
|
||||||
|
SourceEntries secondSources{{{1, 1}, SourceType::Any, 1}, {{1, 3}, SourceType::Any, 1}, {{1, 8}, SourceType::Any, 1}};
|
||||||
|
SourceEntries thirdSources{{{1, 4}, SourceType::Any, 1}, {{1, 8}, SourceType::Any, 1}, {{1, 10}, SourceType::Any, 1}};
|
||||||
|
UsedMacros firstUsedMacros{{"YI", {1, 1}}};
|
||||||
|
UsedMacros secondUsedMacros{{"LIANG", {1, 2}}, {"ER", {1, 2}}};
|
||||||
|
UsedMacros thirdUsedMacros{{"SAN", {1, 10}}};
|
||||||
|
BuildDependency buildDependency{secondSources, {}, {}, {}};
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromStorageIfTimeStampsAreUpToDate)
|
||||||
|
{
|
||||||
|
InSequence s;
|
||||||
|
|
||||||
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 2})).WillRepeatedly(Return(firstSources));
|
||||||
|
EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true));
|
||||||
|
EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)).Times(0);
|
||||||
|
|
||||||
|
provider.create(projectPart1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(BuildDependenciesProvider, FetchDependSourcesFromStorage)
|
||||||
|
{
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 2})).WillByDefault(Return(firstSources));
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 3})).WillByDefault(Return(secondSources));
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 4})).WillByDefault(Return(thirdSources));
|
||||||
|
ON_CALL(mockModifiedTimeChecker, isUpToDate(_)).WillByDefault(Return(true));
|
||||||
|
|
||||||
|
auto buildDependency = provider.create(projectPart2);
|
||||||
|
|
||||||
|
ASSERT_THAT(buildDependency.includes, ElementsAre(HasSourceId(1), HasSourceId(2), HasSourceId(3), HasSourceId(4), HasSourceId(8), HasSourceId(10)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromGeneratorIfTimeStampsAreNotUpToDate)
|
||||||
|
{
|
||||||
|
InSequence s;
|
||||||
|
|
||||||
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 2})).WillRepeatedly(Return(firstSources));
|
||||||
|
EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(false));
|
||||||
|
EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1));
|
||||||
|
|
||||||
|
provider.create(projectPart1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(BuildDependenciesProvider, FetchDependSourcesFromGenerator)
|
||||||
|
{
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 2})).WillByDefault(Return(firstSources));
|
||||||
|
ON_CALL(mockModifiedTimeChecker, isUpToDate(_)).WillByDefault(Return(false));
|
||||||
|
ON_CALL(mockBuildDependenciesGenerator, create(projectPart1)).WillByDefault(Return(buildDependency));
|
||||||
|
|
||||||
|
auto buildDependency = provider.create(projectPart1);
|
||||||
|
|
||||||
|
ASSERT_THAT(buildDependency.includes, ElementsAre(HasSourceId(1), HasSourceId(3), HasSourceId(8)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(BuildDependenciesProvider, CreateCallsFetchUsedMacrosFromStorageIfTimeStampsAreUpToDate)
|
||||||
|
{
|
||||||
|
InSequence s;
|
||||||
|
|
||||||
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 2})).WillRepeatedly(Return(firstSources));
|
||||||
|
EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true));
|
||||||
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros(FilePathId{1, 1}));
|
||||||
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros(FilePathId{1, 2}));
|
||||||
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros(FilePathId{1, 10}));
|
||||||
|
|
||||||
|
provider.create(projectPart1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(BuildDependenciesProvider, FetchUsedMacrosFromStorageIfDependSourcesAreUpToDate)
|
||||||
|
{
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchDependSources(FilePathId{1, 2})).WillByDefault(Return(firstSources));
|
||||||
|
ON_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillByDefault(Return(true));
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchUsedMacros(FilePathId{1, 1})).WillByDefault(Return(firstUsedMacros));
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchUsedMacros(FilePathId{1, 2})).WillByDefault(Return(secondUsedMacros));
|
||||||
|
ON_CALL(mockBuildDependenciesStorage, fetchUsedMacros(FilePathId{1, 10})).WillByDefault(Return(thirdUsedMacros));
|
||||||
|
|
||||||
|
auto buildDependency = provider.create(projectPart1);
|
||||||
|
|
||||||
|
ASSERT_THAT(buildDependency.usedMacros, ElementsAre(UsedMacro{"YI", {1, 1}}, UsedMacro{"ER", {1, 2}}, UsedMacro{"LIANG", {1, 2}}, UsedMacro{"SAN", {1, 10}}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <sourcelocations.h>
|
#include <sourcelocations.h>
|
||||||
|
|
||||||
#include <builddependencies.h>
|
#include <builddependency.h>
|
||||||
#include <clangcodemodelclientmessages.h>
|
#include <clangcodemodelclientmessages.h>
|
||||||
#include <clangcodemodelservermessages.h>
|
#include <clangcodemodelservermessages.h>
|
||||||
#include <clangdocumentsuspenderresumer.h>
|
#include <clangdocumentsuspenderresumer.h>
|
||||||
@@ -1015,11 +1015,29 @@ std::ostream &operator<<(std::ostream &out, const PchTask &task)
|
|||||||
std::ostream &operator<<(std::ostream &out, const BuildDependency &dependency)
|
std::ostream &operator<<(std::ostream &out, const BuildDependency &dependency)
|
||||||
{
|
{
|
||||||
return out << "("
|
return out << "("
|
||||||
<< dependency.includeIds << ", "
|
<< dependency.includes << ", "
|
||||||
<< dependency.topsSystemIncludeIds << ", "
|
<< dependency.topsSystemIncludeIds << ", "
|
||||||
<< dependency.topIncludeIds << ")";
|
<< dependency.topIncludeIds << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *sourceTypeString(SourceType sourceType)
|
||||||
|
{
|
||||||
|
using ClangBackEnd::SymbolTag;
|
||||||
|
|
||||||
|
switch (sourceType) {
|
||||||
|
case SourceType::Any: return "Any";
|
||||||
|
case SourceType::TopInclude: return "TopInclude";
|
||||||
|
case SourceType::TopSystemInclude: return "TopSystemInclude";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &out, const SourceEntry &entry)
|
||||||
|
{
|
||||||
|
return out << "(" << entry.sourceId << ", " << sourceTypeString(entry.sourceType) << ")";
|
||||||
|
}
|
||||||
|
|
||||||
void PrintTo(const FilePath &filePath, ::std::ostream *os)
|
void PrintTo(const FilePath &filePath, ::std::ostream *os)
|
||||||
{
|
{
|
||||||
*os << filePath;
|
*os << filePath;
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ class SymbolIndexerTask;
|
|||||||
class PchCreatorIncludes;
|
class PchCreatorIncludes;
|
||||||
class PchTask;
|
class PchTask;
|
||||||
class BuildDependency;
|
class BuildDependency;
|
||||||
|
class SourceEntry;
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const SourceLocationEntry &entry);
|
std::ostream &operator<<(std::ostream &out, const SourceLocationEntry &entry);
|
||||||
std::ostream &operator<<(std::ostream &out, const IdPaths &idPaths);
|
std::ostream &operator<<(std::ostream &out, const IdPaths &idPaths);
|
||||||
@@ -254,6 +255,7 @@ std::ostream &operator<<(std::ostream &out, const SymbolIndexerTask &task);
|
|||||||
std::ostream &operator<<(std::ostream &out, const PchCreatorIncludes &includes);
|
std::ostream &operator<<(std::ostream &out, const PchCreatorIncludes &includes);
|
||||||
std::ostream &operator<<(std::ostream &out, const PchTask &task);
|
std::ostream &operator<<(std::ostream &out, const PchTask &task);
|
||||||
std::ostream &operator<<(std::ostream &out, const BuildDependency &dependency);
|
std::ostream &operator<<(std::ostream &out, const BuildDependency &dependency);
|
||||||
|
std::ostream &operator<<(std::ostream &out, const SourceEntry &entry);
|
||||||
|
|
||||||
void PrintTo(const FilePath &filePath, ::std::ostream *os);
|
void PrintTo(const FilePath &filePath, ::std::ostream *os);
|
||||||
void PrintTo(const FilePathView &filePathView, ::std::ostream *os);
|
void PrintTo(const FilePathView &filePathView, ::std::ostream *os);
|
||||||
|
|||||||
38
tests/unit/unittest/mockbuilddependenciesgenerator.h
Normal file
38
tests/unit/unittest/mockbuilddependenciesgenerator.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "googletest.h"
|
||||||
|
|
||||||
|
#include <builddependenciesgeneratorinterface.h>
|
||||||
|
|
||||||
|
class MockBuildDependenciesGenerator : public ClangBackEnd::BuildDependenciesGeneratorInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MOCK_METHOD1(create,
|
||||||
|
ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart));
|
||||||
|
};
|
||||||
|
|
||||||
@@ -32,6 +32,6 @@
|
|||||||
class MockBuildDependenciesProvider : public ClangBackEnd::BuildDependenciesProviderInterface
|
class MockBuildDependenciesProvider : public ClangBackEnd::BuildDependenciesProviderInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(create,
|
MOCK_CONST_METHOD1(create,
|
||||||
ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart));
|
ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart));
|
||||||
};
|
};
|
||||||
|
|||||||
50
tests/unit/unittest/mockbuilddependencystorage.h
Normal file
50
tests/unit/unittest/mockbuilddependencystorage.h
Normal file
@@ -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 "googletest.h"
|
||||||
|
|
||||||
|
#include <builddependenciesstorageinterface.h>
|
||||||
|
|
||||||
|
class MockBuildDependenciesStorage : public ClangBackEnd::BuildDependenciesStorageInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MOCK_METHOD1(updateSources,
|
||||||
|
void (const ClangBackEnd::SourceEntries &sources));
|
||||||
|
MOCK_METHOD1(insertOrUpdateUsedMacros,
|
||||||
|
void (const ClangBackEnd::UsedMacros &usedMacros));
|
||||||
|
MOCK_METHOD1(insertFileStatuses,
|
||||||
|
void (const ClangBackEnd::FileStatuses &fileStatuses));
|
||||||
|
MOCK_METHOD1(insertOrUpdateSourceDependencies,
|
||||||
|
void (const ClangBackEnd::SourceDependencies &sourceDependencies));
|
||||||
|
MOCK_CONST_METHOD1(fetchLowestLastModifiedTime,
|
||||||
|
long long (ClangBackEnd::FilePathId sourceId));
|
||||||
|
MOCK_CONST_METHOD1(fetchDependSources,
|
||||||
|
ClangBackEnd::SourceEntries (ClangBackEnd::FilePathId sourceId));
|
||||||
|
MOCK_CONST_METHOD1(fetchUsedMacros,
|
||||||
|
ClangBackEnd::UsedMacros (ClangBackEnd::FilePathId sourceId));
|
||||||
|
};
|
||||||
|
|
||||||
37
tests/unit/unittest/mockmodifiedtimechecker.h
Normal file
37
tests/unit/unittest/mockmodifiedtimechecker.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "googletest.h"
|
||||||
|
|
||||||
|
#include <modifiedtimecheckerinterface.h>
|
||||||
|
|
||||||
|
class MockModifiedTimeChecker : public ClangBackEnd::ModifiedTimeCheckerInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MOCK_CONST_METHOD1(isUpToDate,
|
||||||
|
bool (const ClangBackEnd::SourceEntries &sourceEntries));
|
||||||
|
};
|
||||||
@@ -35,6 +35,8 @@ using ClangBackEnd::BuildDependency;
|
|||||||
using ClangBackEnd::BuildDependencies;
|
using ClangBackEnd::BuildDependencies;
|
||||||
using ClangBackEnd::FilePathId;
|
using ClangBackEnd::FilePathId;
|
||||||
using ClangBackEnd::PchTask;
|
using ClangBackEnd::PchTask;
|
||||||
|
using ClangBackEnd::SourceEntries;
|
||||||
|
using ClangBackEnd::SourceType;
|
||||||
|
|
||||||
class PchTaskGenerator : public testing::Test
|
class PchTaskGenerator : public testing::Test
|
||||||
{
|
{
|
||||||
@@ -47,7 +49,8 @@ protected:
|
|||||||
{"/yi"},
|
{"/yi"},
|
||||||
{{1, 1}},
|
{{1, 1}},
|
||||||
{{1, 2}}};
|
{{1, 2}}};
|
||||||
BuildDependency buildDependency{{{1, 1}}, {}, {}};
|
SourceEntries firstSources{{{1, 1}, SourceType::Any, 1}, {{1, 2}, SourceType::Any, 1}, {{1, 10}, SourceType::Any, 1}};
|
||||||
|
BuildDependency buildDependency{firstSources, {}, {}, {}};
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(PchTaskGenerator, Create)
|
TEST_F(PchTaskGenerator, Create)
|
||||||
@@ -60,7 +63,7 @@ TEST_F(PchTaskGenerator, Create)
|
|||||||
ElementsAre(
|
ElementsAre(
|
||||||
AllOf(Field(&PchTask::ids, ElementsAre("ProjectPart1")),
|
AllOf(Field(&PchTask::ids, ElementsAre("ProjectPart1")),
|
||||||
Field(&PchTask::buildDependency,
|
Field(&PchTask::buildDependency,
|
||||||
Field(&BuildDependency::includeIds, ElementsAre(FilePathId{1, 1}))))));
|
Field(&BuildDependency::includes, firstSources)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ SOURCES += \
|
|||||||
compileroptionsbuilder-test.cpp \
|
compileroptionsbuilder-test.cpp \
|
||||||
usedmacroandsourcestorage-test.cpp \
|
usedmacroandsourcestorage-test.cpp \
|
||||||
pchtaskgenerator-test.cpp \
|
pchtaskgenerator-test.cpp \
|
||||||
compilationdatabaseutils-test.cpp
|
compilationdatabaseutils-test.cpp \
|
||||||
|
builddependenciesprovider-test.cpp
|
||||||
|
|
||||||
!isEmpty(LIBCLANG_LIBS) {
|
!isEmpty(LIBCLANG_LIBS) {
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@@ -250,7 +251,10 @@ HEADERS += \
|
|||||||
mockprocessormanager.h \
|
mockprocessormanager.h \
|
||||||
mocktaskscheduler.h \
|
mocktaskscheduler.h \
|
||||||
mockusedmacroandsourcestorage.h \
|
mockusedmacroandsourcestorage.h \
|
||||||
mockbuilddependenciesprovider.h
|
mockbuilddependenciesprovider.h \
|
||||||
|
mockbuilddependencystorage.h \
|
||||||
|
mockmodifiedtimechecker.h \
|
||||||
|
mockbuilddependenciesgenerator.h
|
||||||
|
|
||||||
!isEmpty(LIBCLANG_LIBS) {
|
!isEmpty(LIBCLANG_LIBS) {
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|||||||
Reference in New Issue
Block a user