forked from qt-creator/qt-creator
CppTools: Move ProjectFileCategorizer tests to plugin
Change-Id: I51d66d9ff9a14e2dd04cf25448ccc8c85bcbce97 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -254,6 +254,13 @@ private slots:
|
||||
void test_headerPathFilter_removeGccInternalPathsExceptForStandardPaths();
|
||||
void test_headerPathFilter_clangHeadersAndCppIncludesPathsOrderNoVersion();
|
||||
void test_headerPathFilter_clangHeadersAndCppIncludesPathsOrderAndroidClang();
|
||||
void test_projectFileCategorizer_c();
|
||||
void test_projectFileCategorizer_cxxWithUnambiguousHeaderSuffix();
|
||||
void test_projectFileCategorizer_cxxWithAmbiguousHeaderSuffix();
|
||||
void test_projectFileCategorizer_objectiveC();
|
||||
void test_projectFileCategorizer_objectiveCxx();
|
||||
void test_projectFileCategorizer_mixedCAndCxx();
|
||||
void test_projectFileCategorizer_ambiguousHeaderOnly();
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@@ -7,11 +7,9 @@ shared {
|
||||
HEADERS += \
|
||||
$$PWD/cppprojectfile.h \
|
||||
$$PWD/senddocumenttracker.h \
|
||||
$$PWD/projectpart.h \
|
||||
$$PWD/cppprojectfilecategorizer.h
|
||||
$$PWD/projectpart.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/cppprojectfile.cpp \
|
||||
$$PWD/senddocumenttracker.cpp \
|
||||
$$PWD/projectpart.cpp \
|
||||
$$PWD/cppprojectfilecategorizer.cpp
|
||||
$$PWD/projectpart.cpp
|
||||
|
@@ -23,6 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "cppprojectfilecategorizer.h"
|
||||
#include "cppprojectinfogenerator.h"
|
||||
#include "cppprojectpartchooser.h"
|
||||
#include "cpptoolsplugin.h"
|
||||
@@ -714,5 +715,109 @@ void CppToolsPlugin::test_headerPathFilter_clangHeadersAndCppIncludesPathsOrderA
|
||||
t.builtIn("C:/Android/sdk/ndk-bundle/sysroot/usr/include")}));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_projectFileCategorizer_c()
|
||||
{
|
||||
const ProjectFileCategorizer categorizer({}, {"foo.c", "foo.h"});
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.c", ProjectFile::CSource),
|
||||
ProjectFile("foo.h", ProjectFile::CHeader),
|
||||
};
|
||||
|
||||
QCOMPARE(categorizer.cSources(), expected);
|
||||
QVERIFY(categorizer.cxxSources().isEmpty());
|
||||
QVERIFY(categorizer.objcSources().isEmpty());
|
||||
QVERIFY(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_projectFileCategorizer_cxxWithUnambiguousHeaderSuffix()
|
||||
{
|
||||
const ProjectFileCategorizer categorizer({}, {"foo.cpp", "foo.hpp"});
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.cpp", ProjectFile::CXXSource),
|
||||
ProjectFile("foo.hpp", ProjectFile::CXXHeader),
|
||||
};
|
||||
|
||||
QCOMPARE(categorizer.cxxSources(), expected);
|
||||
QVERIFY(categorizer.cSources().isEmpty());
|
||||
QVERIFY(categorizer.objcSources().isEmpty());
|
||||
QVERIFY(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_projectFileCategorizer_cxxWithAmbiguousHeaderSuffix()
|
||||
{
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.cpp", ProjectFile::CXXSource),
|
||||
ProjectFile("foo.h", ProjectFile::CXXHeader),
|
||||
};
|
||||
|
||||
const ProjectFileCategorizer categorizer({}, {"foo.cpp", "foo.h"});
|
||||
|
||||
QCOMPARE(categorizer.cxxSources(), expected);
|
||||
QVERIFY(categorizer.cSources().isEmpty());
|
||||
QVERIFY(categorizer.objcSources().isEmpty());
|
||||
QVERIFY(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_projectFileCategorizer_objectiveC()
|
||||
{
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.m", ProjectFile::ObjCSource),
|
||||
ProjectFile("foo.h", ProjectFile::ObjCHeader),
|
||||
};
|
||||
|
||||
const ProjectFileCategorizer categorizer({}, {"foo.m", "foo.h"});
|
||||
|
||||
QCOMPARE(categorizer.objcSources(), expected);
|
||||
QVERIFY(categorizer.cxxSources().isEmpty());
|
||||
QVERIFY(categorizer.cSources().isEmpty());
|
||||
QVERIFY(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_projectFileCategorizer_objectiveCxx()
|
||||
{
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.mm", ProjectFile::ObjCXXSource),
|
||||
ProjectFile("foo.h", ProjectFile::ObjCXXHeader),
|
||||
};
|
||||
|
||||
const ProjectFileCategorizer categorizer({}, {"foo.mm", "foo.h"});
|
||||
|
||||
QCOMPARE(categorizer.objcxxSources(), expected);
|
||||
QVERIFY(categorizer.objcSources().isEmpty());
|
||||
QVERIFY(categorizer.cSources().isEmpty());
|
||||
QVERIFY(categorizer.cxxSources().isEmpty());
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_projectFileCategorizer_mixedCAndCxx()
|
||||
{
|
||||
const ProjectFiles expectedCxxSources {
|
||||
ProjectFile("foo.cpp", ProjectFile::CXXSource),
|
||||
ProjectFile("foo.h", ProjectFile::CXXHeader),
|
||||
ProjectFile("bar.h", ProjectFile::CXXHeader),
|
||||
};
|
||||
const ProjectFiles expectedCSources {
|
||||
ProjectFile("bar.c", ProjectFile::CSource),
|
||||
ProjectFile("foo.h", ProjectFile::CHeader),
|
||||
ProjectFile("bar.h", ProjectFile::CHeader),
|
||||
};
|
||||
|
||||
const ProjectFileCategorizer categorizer({}, {"foo.cpp", "foo.h", "bar.c", "bar.h"});
|
||||
|
||||
QCOMPARE(categorizer.cxxSources(), expectedCxxSources);
|
||||
QCOMPARE(categorizer.cSources(), expectedCSources);
|
||||
QVERIFY(categorizer.objcSources().isEmpty());
|
||||
QVERIFY(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_projectFileCategorizer_ambiguousHeaderOnly()
|
||||
{
|
||||
const ProjectFileCategorizer categorizer({}, {"foo.h"});
|
||||
|
||||
QCOMPARE(categorizer.cSources(), {ProjectFile("foo.h", ProjectFile::CHeader)});
|
||||
QCOMPARE(categorizer.cxxSources(), {ProjectFile("foo.h", ProjectFile::CXXHeader)});
|
||||
QCOMPARE(categorizer.objcSources(), {ProjectFile("foo.h", ProjectFile::ObjCHeader)});
|
||||
QCOMPARE(categorizer.objcxxSources(), {ProjectFile("foo.h", ProjectFile::ObjCXXHeader)});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
@@ -36,14 +36,12 @@ add_qtc_test(unittest GTEST
|
||||
QTC_RESOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator"
|
||||
TESTDATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data"
|
||||
ECHOSERVER="$<TARGET_FILE_DIR:echo>/echo"
|
||||
CPPTOOLS_JSON="${CMAKE_CURRENT_BINARY_DIR}/CppTools.json"
|
||||
SOURCES
|
||||
abstractviewmock.h
|
||||
clientserverinprocess-test.cpp
|
||||
clientserveroutsideprocess-test.cpp
|
||||
compare-operators.h
|
||||
conditionally-disabled-tests.h
|
||||
cppprojectfilecategorizer-test.cpp
|
||||
dummyclangipcclient.h
|
||||
dynamicastmatcherdiagnosticcontainer-matcher.h
|
||||
eventspy.cpp eventspy.h
|
||||
@@ -59,7 +57,6 @@ add_qtc_test(unittest GTEST
|
||||
lastchangedrowid-test.cpp
|
||||
lineprefixer-test.cpp
|
||||
matchingtext-test.cpp
|
||||
mimedatabase-utilities.cpp mimedatabase-utilities.h
|
||||
mockclangcodemodelclient.h
|
||||
mockclangcodemodelserver.h
|
||||
mockcppmodelmanager.h
|
||||
@@ -165,16 +162,6 @@ add_custom_command(TARGET unittest POST_BUILD
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/data"
|
||||
)
|
||||
|
||||
# create fake CppTools.json for the mime type definitions
|
||||
file(READ "../../../src/plugins/cpptools/CppTools.json.in" plugin_json_in)
|
||||
string(REPLACE "\\\"" "\"" plugin_json_in ${plugin_json_in})
|
||||
string(REPLACE "\\'" "'" plugin_json_in ${plugin_json_in})
|
||||
string(REPLACE "$$QTCREATOR_VERSION" "${IDE_VERSION}" plugin_json_in ${plugin_json_in})
|
||||
string(REPLACE "$$QTCREATOR_COMPAT_VERSION" "${IDE_VERSION_COMPAT}" plugin_json_in ${plugin_json_in})
|
||||
string(REPLACE "$$QTCREATOR_COPYRIGHT_YEAR" "${IDE_COPYRIGHT_YEAR}" plugin_json_in ${plugin_json_in})
|
||||
string(REPLACE "$$dependencyList" "\"Dependencies\" : []" plugin_json_in ${plugin_json_in})
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CppTools.json" ${plugin_json_in})
|
||||
|
||||
extend_qtc_test(unittest
|
||||
CONDITION TARGET libclang
|
||||
INCLUDES "${CLANG_INCLUDE_DIRS}"
|
||||
@@ -452,7 +439,6 @@ extend_qtc_test(unittest
|
||||
cppprojectfile.cpp cppprojectfile.h
|
||||
senddocumenttracker.cpp senddocumenttracker.h
|
||||
projectpart.cpp projectpart.h
|
||||
cppprojectfilecategorizer.cpp cppprojectfilecategorizer.h
|
||||
)
|
||||
|
||||
extend_qtc_test(unittest
|
||||
|
@@ -1,200 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 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 "gtest-qt-printing.h"
|
||||
#include "mimedatabase-utilities.h"
|
||||
|
||||
#include <cpptools/cppprojectfilecategorizer.h>
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
|
||||
using CppTools::ProjectFile;
|
||||
using CppTools::ProjectFiles;
|
||||
using CppTools::ProjectFileCategorizer;
|
||||
|
||||
using testing::IsNull;
|
||||
using testing::NotNull;
|
||||
using testing::Eq;
|
||||
using testing::Gt;
|
||||
using testing::Contains;
|
||||
using testing::EndsWith;
|
||||
using testing::AllOf;
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
void PrintTo(const ProjectFile &projectFile, std::ostream *os)
|
||||
{
|
||||
*os << "ProjectFile(";
|
||||
QString output;
|
||||
QDebug(&output) << projectFile;
|
||||
*os << qPrintable(output);
|
||||
*os << ")";
|
||||
}
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
namespace {
|
||||
|
||||
class ProjectFileCategorizer : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
static ProjectFiles singleFile(const QString &filePath, ProjectFile::Kind kind);
|
||||
|
||||
protected:
|
||||
const QString dummyProjectPartName;
|
||||
};
|
||||
|
||||
using ProjectFileCategorizerVerySlowTest = ProjectFileCategorizer;
|
||||
|
||||
TEST_F(ProjectFileCategorizerVerySlowTest, C)
|
||||
{
|
||||
const QStringList inputFilePaths = QStringList() << "foo.c" << "foo.h";
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.c", ProjectFile::CSource),
|
||||
ProjectFile("foo.h", ProjectFile::CHeader),
|
||||
};
|
||||
|
||||
::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths};
|
||||
|
||||
ASSERT_THAT(categorizer.cSources(), Eq(expected));
|
||||
ASSERT_TRUE(categorizer.cxxSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ProjectFileCategorizerVerySlowTest, CxxWithUnambiguousHeaderSuffix)
|
||||
{
|
||||
const QStringList inputFilePaths = QStringList() << "foo.cpp" << "foo.hpp";
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.cpp", ProjectFile::CXXSource),
|
||||
ProjectFile("foo.hpp", ProjectFile::CXXHeader),
|
||||
};
|
||||
|
||||
::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths};
|
||||
|
||||
ASSERT_THAT(categorizer.cxxSources(), Eq(expected));
|
||||
ASSERT_TRUE(categorizer.cSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ProjectFileCategorizerVerySlowTest, CxxWithAmbiguousHeaderSuffix)
|
||||
{
|
||||
const QStringList inputFilePaths = QStringList() << "foo.cpp" << "foo.h";
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.cpp", ProjectFile::CXXSource),
|
||||
ProjectFile("foo.h", ProjectFile::CXXHeader),
|
||||
};
|
||||
|
||||
::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths};
|
||||
|
||||
ASSERT_THAT(categorizer.cxxSources(), Eq(expected));
|
||||
ASSERT_TRUE(categorizer.cSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ProjectFileCategorizerVerySlowTest, ObjectiveC)
|
||||
{
|
||||
const QStringList inputFilePaths = QStringList() << "foo.m" << "foo.h";
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.m", ProjectFile::ObjCSource),
|
||||
ProjectFile("foo.h", ProjectFile::ObjCHeader),
|
||||
};
|
||||
|
||||
::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths};
|
||||
|
||||
ASSERT_THAT(categorizer.objcSources(), Eq(expected));
|
||||
ASSERT_TRUE(categorizer.cxxSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.cSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ProjectFileCategorizerVerySlowTest, ObjectiveCxx)
|
||||
{
|
||||
const QStringList inputFilePaths = QStringList() << "foo.mm" << "foo.h";
|
||||
const ProjectFiles expected {
|
||||
ProjectFile("foo.mm", ProjectFile::ObjCXXSource),
|
||||
ProjectFile("foo.h", ProjectFile::ObjCXXHeader),
|
||||
};
|
||||
|
||||
::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths};
|
||||
|
||||
ASSERT_THAT(categorizer.objcxxSources(), Eq(expected));
|
||||
ASSERT_TRUE(categorizer.objcSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.cSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.cxxSources().isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ProjectFileCategorizerVerySlowTest, MixedCAndCxx)
|
||||
{
|
||||
const QStringList inputFilePaths = QStringList() << "foo.cpp" << "foo.h"
|
||||
<< "bar.c" << "bar.h";
|
||||
const ProjectFiles expectedCxxSources {
|
||||
ProjectFile("foo.cpp", ProjectFile::CXXSource),
|
||||
ProjectFile("foo.h", ProjectFile::CXXHeader),
|
||||
ProjectFile("bar.h", ProjectFile::CXXHeader),
|
||||
};
|
||||
const ProjectFiles expectedCSources {
|
||||
ProjectFile("bar.c", ProjectFile::CSource),
|
||||
ProjectFile("foo.h", ProjectFile::CHeader),
|
||||
ProjectFile("bar.h", ProjectFile::CHeader),
|
||||
};
|
||||
|
||||
::ProjectFileCategorizer categorizer{dummyProjectPartName, inputFilePaths};
|
||||
|
||||
ASSERT_THAT(categorizer.cxxSources(), Eq(expectedCxxSources));
|
||||
ASSERT_THAT(categorizer.cSources(), Eq(expectedCSources));
|
||||
ASSERT_TRUE(categorizer.objcSources().isEmpty());
|
||||
ASSERT_TRUE(categorizer.objcxxSources().isEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ProjectFileCategorizerVerySlowTest, AmbiguousHeaderOnly)
|
||||
{
|
||||
::ProjectFileCategorizer categorizer{dummyProjectPartName, QStringList() << "foo.h"};
|
||||
|
||||
ASSERT_THAT(categorizer.cSources(), Eq(singleFile("foo.h", ProjectFile::CHeader)));
|
||||
ASSERT_THAT(categorizer.cxxSources(), Eq(singleFile("foo.h", ProjectFile::CXXHeader)));
|
||||
ASSERT_THAT(categorizer.objcSources(), Eq(singleFile("foo.h", ProjectFile::ObjCHeader)));
|
||||
ASSERT_THAT(categorizer.objcxxSources(), Eq(singleFile("foo.h", ProjectFile::ObjCXXHeader)));
|
||||
}
|
||||
|
||||
void ProjectFileCategorizer::SetUp()
|
||||
{
|
||||
ASSERT_TRUE(MimeDataBaseUtilities::addCppToolsMimeTypes());
|
||||
}
|
||||
|
||||
QVector<CppTools::ProjectFile>ProjectFileCategorizer::singleFile(const QString &filePath,
|
||||
ProjectFile::Kind kind)
|
||||
{
|
||||
return { ProjectFile(filePath, kind) };
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
@@ -1,63 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 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 "mimedatabase-utilities.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QString>
|
||||
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
namespace MimeDataBaseUtilities
|
||||
{
|
||||
|
||||
bool addCppToolsMimeTypes()
|
||||
{
|
||||
static bool alreadyAdded = false;
|
||||
if (alreadyAdded)
|
||||
return true;
|
||||
|
||||
const QString filePath = CPPTOOLS_JSON;
|
||||
QFile file(filePath);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
auto doc = QJsonDocument::fromJson(file.readAll());
|
||||
QJsonValue mimetypes = doc.object().value("Mimetypes");
|
||||
|
||||
QString mimetypeString;
|
||||
if (!Utils::readMultiLineString(mimetypes, &mimetypeString))
|
||||
return false;
|
||||
Utils::addMimeTypes(filePath, mimetypeString.trimmed().toUtf8());
|
||||
alreadyAdded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 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 <functional>
|
||||
|
||||
namespace MimeDataBaseUtilities
|
||||
{
|
||||
bool addCppToolsMimeTypes();
|
||||
}
|
@@ -55,17 +55,10 @@ QMAKE_CXXFLAGS += /bigobj /wd4267 /wd4141 /wd4146 /wd4624
|
||||
QMAKE_LFLAGS += /INCREMENTAL
|
||||
|
||||
}
|
||||
# create fake CppTools.json for the mime type definitions
|
||||
dependencyList = "\"Dependencies\" : []"
|
||||
cpptoolsjson.input = $$PWD/../../../src/plugins/cpptools/CppTools.json.in
|
||||
cpptoolsjson.output = $$OUT_PWD/CppTools.json
|
||||
QMAKE_SUBSTITUTES += cpptoolsjson
|
||||
DEFINES += CPPTOOLS_JSON=\"R\\\"xxx($${cpptoolsjson.output})xxx\\\"\"
|
||||
|
||||
SOURCES += \
|
||||
clientserverinprocess-test.cpp \
|
||||
clientserveroutsideprocess-test.cpp \
|
||||
cppprojectfilecategorizer-test.cpp \
|
||||
fakeprocess.cpp \
|
||||
gtest-creator-printing.cpp \
|
||||
gtest-qt-printing.cpp \
|
||||
@@ -80,7 +73,6 @@ SOURCES += \
|
||||
lastchangedrowid-test.cpp \
|
||||
lineprefixer-test.cpp \
|
||||
listmodeleditor-test.cpp \
|
||||
mimedatabase-utilities.cpp \
|
||||
processevents-utilities.cpp \
|
||||
readandwritemessageblock-test.cpp \
|
||||
sizedarray-test.cpp \
|
||||
@@ -201,7 +193,6 @@ HEADERS += \
|
||||
gtest-qt-printing.h \
|
||||
gtest-std-printing.h \
|
||||
imagecachecollectormock.h \
|
||||
mimedatabase-utilities.h \
|
||||
mockclangcodemodelclient.h \
|
||||
mockclangcodemodelserver.h \
|
||||
mockimagecachegenerator.h \
|
||||
|
@@ -50,14 +50,13 @@ Project {
|
||||
QtcProduct {
|
||||
name: "Unit test"
|
||||
condition: qtc_gtest_gmock.hasRepo || qtc_gtest_gmock.externalLibsPresent
|
||||
type: ["application", "autotest", "json_copy"]
|
||||
type: ["application", "autotest"]
|
||||
consoleApplication: true
|
||||
destinationDirectory: FileInfo.joinPaths(project.buildDirectory,
|
||||
FileInfo.relativePath(project.ide_source_tree, sourceDirectory))
|
||||
install: false
|
||||
|
||||
Depends { name: "echoserver" }
|
||||
Depends { name: "pluginjson" }
|
||||
Depends { name: "libclang"; required: false }
|
||||
Depends { name: "clang_defines" }
|
||||
|
||||
@@ -75,7 +74,6 @@ Project {
|
||||
|
||||
Depends { name: "qtc_gtest_gmock" }
|
||||
|
||||
pluginjson.useVcsData: false
|
||||
sqlite_sources.buildSharedLib: false
|
||||
|
||||
cpp.defines: {
|
||||
@@ -97,7 +95,6 @@ Project {
|
||||
"echoserver", "echo") + '"',
|
||||
'RELATIVE_DATA_PATH="' + FileInfo.relativePath(destinationDirectory,
|
||||
FileInfo.joinPaths(project.sourceDirectory, "share", "qtcreator")) + '"',
|
||||
'CPPTOOLS_JSON="' + FileInfo.joinPaths(destinationDirectory, "CppTools.json") + '"',
|
||||
];
|
||||
if (libclang.present) {
|
||||
defines.push("CLANG_UNIT_TESTS");
|
||||
@@ -174,7 +171,6 @@ Project {
|
||||
"compare-operators.h",
|
||||
"compilationdatabaseutils-test.cpp",
|
||||
"conditionally-disabled-tests.h",
|
||||
"cppprojectfilecategorizer-test.cpp",
|
||||
"createtablesqlstatementbuilder-test.cpp",
|
||||
"dummyclangipcclient.h",
|
||||
"dynamicastmatcherdiagnosticcontainer-matcher.h",
|
||||
@@ -192,8 +188,6 @@ Project {
|
||||
"gtest-qt-printing.h",
|
||||
"lineprefixer-test.cpp",
|
||||
"matchingtext-test.cpp",
|
||||
"mimedatabase-utilities.cpp",
|
||||
"mimedatabase-utilities.h",
|
||||
"mockclangcodemodelclient.h",
|
||||
"mockclangcodemodelserver.h",
|
||||
"mockcppmodelmanager.h",
|
||||
@@ -321,12 +315,6 @@ Project {
|
||||
fileTags: []
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "json.in file"
|
||||
files: "../../../src/plugins/cpptools/CppTools.json.in"
|
||||
fileTags: "pluginJsonIn"
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "sources from clangbackend"
|
||||
condition: libclang.present
|
||||
@@ -484,8 +472,6 @@ Project {
|
||||
files: [
|
||||
"cppprojectfile.cpp",
|
||||
"cppprojectfile.h",
|
||||
"cppprojectfilecategorizer.cpp",
|
||||
"cppprojectfilecategorizer.h",
|
||||
"projectpart.cpp",
|
||||
"projectpart.h",
|
||||
"senddocumenttracker.cpp",
|
||||
@@ -544,19 +530,5 @@ Project {
|
||||
"diagnosticlocation.h",
|
||||
]
|
||||
}
|
||||
|
||||
Rule {
|
||||
inputs: "qt_plugin_metadata"
|
||||
Artifact {
|
||||
filePath: FileInfo.joinPaths(product.destinationDirectory, "CppTools.json")
|
||||
fileTags: "json_copy"
|
||||
}
|
||||
prepare: {
|
||||
var cmd = new JavaScriptCommand;
|
||||
cmd.description = "copying " + input.fileName;
|
||||
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); };
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user