diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-05-12 18:50:50 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-06-13 15:47:18 +0000 |
commit | 8b5e5af31e7c0860f8cf4f8fa50e7b322cadca62 (patch) | |
tree | 36a7e2fc38c7571cdf7e4c6b6449754e39cb993c /src/lib/corelib | |
parent | d5dc7a2571027168d1a74cbb2578848dc843e20e (diff) |
Transform the scanner plugin manager into a true generic plugin manager
...and fit the generator plugins into this new plugin structure.
Plugins are now handled entirely by the build system in a generic manner
and no part of qbscore (code or build files) has a direct reference to
any plugin regardless of whether qbs is being built as shared or static
libraries.
Change-Id: I4a20546ce275df71083ee22c2cb67f781c4de764
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib')
89 files changed, 225 insertions, 6270 deletions
diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp index fba895e2f..f06a0126e 100644 --- a/src/lib/corelib/api/project.cpp +++ b/src/lib/corelib/api/project.cpp @@ -71,7 +71,7 @@ #include <tools/installoptions.h> #include <tools/preferences.h> #include <tools/processresult.h> -#include <tools/scannerpluginmanager.h> +#include <tools/qbspluginmanager.h> #include <tools/scripttools.h> #include <tools/setupprojectparameters.h> #include <tools/qbsassert.h> @@ -83,11 +83,6 @@ #include <mutex> -#ifdef QBS_STATIC_LIB -extern "C" ScannerPlugin *cppScanners[]; -extern "C" ScannerPlugin *qtScanners[]; -#endif - namespace qbs { namespace Internal { @@ -111,11 +106,9 @@ static void loadPlugins(const QStringList &_pluginPaths, const Logger &logger) pluginPaths << pluginPath; } } - ScannerPluginManager::instance()->loadPlugins(pluginPaths, logger); -#ifdef QBS_STATIC_LIB - ScannerPluginManager::instance()->loadPlugins(cppScanners); - ScannerPluginManager::instance()->loadPlugins(qtScanners); -#endif + auto pluginManager = QbsPluginManager::instance(); + pluginManager->loadStaticPlugins(); + pluginManager->loadPlugins(pluginPaths, logger); qRegisterMetaType<ErrorInfo>("qbs::ErrorInfo"); qRegisterMetaType<ProcessResult>("qbs::ProcessResult"); diff --git a/src/lib/corelib/buildgraph/qtmocscanner.cpp b/src/lib/corelib/buildgraph/qtmocscanner.cpp index ccb959a0f..bc3df54f5 100644 --- a/src/lib/corelib/buildgraph/qtmocscanner.cpp +++ b/src/lib/corelib/buildgraph/qtmocscanner.cpp @@ -46,6 +46,7 @@ #include "rawscanresults.h" #include <language/scriptengine.h> #include <logging/translator.h> +#include <plugins/scanner/scanner.h> #include <tools/fileinfo.h> #include <tools/scannerpluginmanager.h> #include <tools/scripttools.h> diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs index f534cf239..eac9e709c 100644 --- a/src/lib/corelib/corelib.qbs +++ b/src/lib/corelib/corelib.qbs @@ -1,14 +1,11 @@ import qbs 1.0 QbsLibrary { - Depends { name: "clangcompilationdbgenerator" } - Depends { name: "visualstudiogenerator" } Depends { name: "cpp" } Depends { name: "Qt"; submodules: ["core-private", "network", "script", "xml"] } Depends { condition: qbsbuildconfig.enableProjectFileUpdates; name: "Qt.gui" } Depends { condition: qbsbuildconfig.enableUnitTests; name: "Qt.testlib" } - Depends { condition: Qt.core.staticBuild; name: "qbs_cpp_scanner" } - Depends { condition: Qt.core.staticBuild; name: "qbs_qt_scanner" } + Depends { condition: Qt.core.staticBuild; productTypes: ["qbsplugin"] } name: "qbscore" cpp.includePaths: base.concat([ ".", @@ -386,6 +383,8 @@ QbsLibrary { "projectgeneratormanager.cpp", "qbsassert.cpp", "qbsassert.h", + "qbspluginmanager.cpp", + "qbspluginmanager.h", "qbsprocess.cpp", "qbsprocess.h", "qttools.cpp", diff --git a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdb.pri b/src/lib/corelib/generators/clangcompilationdb/clangcompilationdb.pri deleted file mode 100644 index 61dc8f19e..000000000 --- a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdb.pri +++ /dev/null @@ -1,5 +0,0 @@ -HEADERS += \ - $$PWD/clangcompilationdbgenerator.h - -SOURCES += \ - $$PWD/clangcompilationdbgenerator.cpp diff --git a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdb.qbs b/src/lib/corelib/generators/clangcompilationdb/clangcompilationdb.qbs deleted file mode 100644 index c8f626190..000000000 --- a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdb.qbs +++ /dev/null @@ -1,19 +0,0 @@ -import qbs - -QbsLibrary { - type: ["staticlibrary"] - name: "clangcompilationdbgenerator" - install: false - - cpp.includePaths: base.concat([ - "../..", - ]) - - Depends { name: "cpp" } - Depends { name: "Qt.core" } - - files: [ - "clangcompilationdbgenerator.cpp", - "clangcompilationdbgenerator.h" - ] -} diff --git a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdbgenerator.cpp b/src/lib/corelib/generators/clangcompilationdb/clangcompilationdbgenerator.cpp deleted file mode 100644 index a3407cb09..000000000 --- a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdbgenerator.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qbs. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** 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-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "clangcompilationdbgenerator.h" - -#include <api/projectdata.h> -#include <logging/logger.h> -#include <logging/translator.h> -#include <tools/error.h> -#include <tools/installoptions.h> -#include <tools/shellutils.h> - -#include <QtCore/qdir.h> -#include <QtCore/qfile.h> -#include <QtCore/qjsonarray.h> -#include <QtCore/qjsondocument.h> -#include <QtCore/qjsonobject.h> - -namespace qbs { -using namespace Internal; - -const QString ClangCompilationDatabaseGenerator::DefaultDatabaseFileName = - QStringLiteral("compile_commands.json"); - -ClangCompilationDatabaseGenerator::ClangCompilationDatabaseGenerator() -{ -} - -QString ClangCompilationDatabaseGenerator::generatorName() const -{ - return QStringLiteral("clangdb"); -} - -void ClangCompilationDatabaseGenerator::generate() -{ - for (const Project &theProject : project().projects.values()) { - QJsonArray database; - const ProjectData projectData = theProject.projectData(); - const QString buildDir = projectData.buildDirectory(); - - for (const ProductData &productData : projectData.allProducts()) { - for (const GroupData &groupData : productData.groups()) { - for (const ArtifactData &sourceArtifact : groupData.allSourceArtifacts()) { - if (!hasValidInputFileTag(sourceArtifact.fileTags())) - continue; - - const QString filePath = sourceArtifact.filePath(); - ErrorInfo errorInfo; - const RuleCommandList rules = theProject.ruleCommands(productData, filePath, - QStringLiteral("obj"), - &errorInfo); - - if (errorInfo.hasError()) - throw errorInfo; - - for (const RuleCommand &rule : rules) { - if (rule.type() != RuleCommand::ProcessCommandType) - continue; - database.append(createEntry(filePath, buildDir, rule)); - } - } - } - } - - writeProjectDatabase(QDir(buildDir).filePath(DefaultDatabaseFileName), database); - } -} - -// See http://clang.llvm.org/docs/JSONCompilationDatabase.html -QJsonObject ClangCompilationDatabaseGenerator::createEntry(const QString &filePath, - const QString &buildDir, - const RuleCommand &ruleCommand) -{ - QString workDir = ruleCommand.workingDirectory(); - if (workDir.isEmpty()) - workDir = buildDir; - - const QStringList arguments = QStringList() << ruleCommand.executable() - << ruleCommand.arguments(); - - const QJsonObject object = { - { QStringLiteral("directory"), QJsonValue(workDir) }, - { QStringLiteral("arguments"), QJsonArray::fromStringList(arguments) }, - { QStringLiteral("file"), QJsonValue(filePath) } - }; - return object; -} - -void ClangCompilationDatabaseGenerator::writeProjectDatabase(const QString &filePath, - const QJsonArray &entries) -{ - const QJsonDocument database(entries); - QFile databaseFile(filePath); - - if (!databaseFile.open(QFile::WriteOnly)) - throw ErrorInfo(Tr::tr("Cannot open '%1' for writing: %2") - .arg(filePath) - .arg(databaseFile.errorString())); - - if (databaseFile.write(database.toJson()) == -1) - throw ErrorInfo(Tr::tr("Error while writing '%1': %2") - .arg(filePath) - .arg(databaseFile.errorString())); -} - -bool ClangCompilationDatabaseGenerator::hasValidInputFileTag(const QStringList &fileTags) const -{ - static const QStringList validFileTags = { - QStringLiteral("c"), - QStringLiteral("cpp"), - QStringLiteral("objc"), - QStringLiteral("objcpp") - }; - - for (const QString &tag : fileTags) { - if (validFileTags.contains(tag)) - return true; - } - return false; -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/generatableprojectiterator.h b/src/lib/corelib/generators/generatableprojectiterator.h index 295ed6d17..793627512 100644 --- a/src/lib/corelib/generators/generatableprojectiterator.h +++ b/src/lib/corelib/generators/generatableprojectiterator.h @@ -45,7 +45,7 @@ namespace qbs { -class GeneratableProjectIterator { +class QBS_EXPORT GeneratableProjectIterator { GeneratableProject project; public: diff --git a/src/lib/corelib/generators/generator.h b/src/lib/corelib/generators/generator.h index 9155f2c09..3ba436c0f 100644 --- a/src/lib/corelib/generators/generator.h +++ b/src/lib/corelib/generators/generator.h @@ -93,14 +93,4 @@ private: } // namespace qbs -#ifdef __cplusplus -extern "C" { -#endif - -typedef qbs::ProjectGenerator **(*getGenerators_f)(); - -#ifdef __cplusplus -} -#endif - #endif // GENERATORPLUGIN_H diff --git a/src/lib/corelib/generators/generatordata.h b/src/lib/corelib/generators/generatordata.h index 1d4685433..47f4acb93 100644 --- a/src/lib/corelib/generators/generatordata.h +++ b/src/lib/corelib/generators/generatordata.h @@ -52,14 +52,14 @@ typedef QMap<QString, Project> GeneratableProjectMap; typedef QMap<QString, ProjectData> GeneratableProjectDataMap; typedef QMap<QString, ProductData> GeneratableProductDataMap; -struct GeneratableProductData { +struct QBS_EXPORT GeneratableProductData { GeneratableProductDataMap data; QString name() const; CodeLocation location() const; QStringList dependencies() const; }; -struct GeneratableProjectData { +struct QBS_EXPORT GeneratableProjectData { struct Id { private: friend struct GeneratableProjectData; @@ -78,7 +78,7 @@ struct GeneratableProjectData { Id uniqueName() const; }; -struct GeneratableProject : public GeneratableProjectData { +struct QBS_EXPORT GeneratableProject : public GeneratableProjectData { GeneratableProjectMap projects; QMap<QString, QVariantMap> buildConfigurations; QMap<QString, QStringList> commandLines; diff --git a/src/lib/corelib/generators/generators.pri b/src/lib/corelib/generators/generators.pri index 935419c1f..d90ad4274 100644 --- a/src/lib/corelib/generators/generators.pri +++ b/src/lib/corelib/generators/generators.pri @@ -8,6 +8,3 @@ HEADERS += \ $$PWD/generator.h \ $$PWD/generatordata.h \ $$PWD/igeneratableprojectvisitor.h - -include(clangcompilationdb/clangcompilationdb.pri) -include(visualstudio/visualstudio.pri) diff --git a/src/lib/corelib/generators/generators.qbs b/src/lib/corelib/generators/generators.qbs deleted file mode 100644 index b6f40ec8c..000000000 --- a/src/lib/corelib/generators/generators.qbs +++ /dev/null @@ -1,8 +0,0 @@ -import qbs - -Project { - references: [ - "clangcompilationdb/clangcompilationdb.qbs", - "visualstudio/visualstudio.qbs", - ] -} diff --git a/src/lib/corelib/generators/visualstudio/io/msbuildprojectwriter.cpp b/src/lib/corelib/generators/visualstudio/io/msbuildprojectwriter.cpp deleted file mode 100644 index f912f3a19..000000000 --- a/src/lib/corelib/generators/visualstudio/io/msbuildprojectwriter.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildprojectwriter.h" - -#include "../msbuild/imsbuildnodevisitor.h" -#include "../msbuild/msbuildimport.h" -#include "../msbuild/msbuildimportgroup.h" -#include "../msbuild/msbuilditem.h" -#include "../msbuild/msbuilditemdefinitiongroup.h" -#include "../msbuild/msbuilditemgroup.h" -#include "../msbuild/msbuilditemmetadata.h" -#include "../msbuild/msbuildproject.h" -#include "../msbuild/msbuildproperty.h" -#include "../msbuild/msbuildpropertygroup.h" - -#include <QtCore/qxmlstream.h> - -namespace qbs { - -static const QString kMSBuildSchemaURI = - QStringLiteral("http://schemas.microsoft.com/developer/msbuild/2003"); - -class MSBuildProjectWriterPrivate : public IMSBuildNodeVisitor -{ -public: - QScopedPointer<QXmlStreamWriter> writer; - - void visitStart(const MSBuildImport *import) override; - void visitEnd(const MSBuildImport *import) override; - - void visitStart(const MSBuildImportGroup *importGroup) override; - void visitEnd(const MSBuildImportGroup *importGroup) override; - - void visitStart(const MSBuildItem *item) override; - void visitEnd(const MSBuildItem *item) override; - - void visitStart(const MSBuildItemDefinitionGroup *itemDefinitionGroup) override; - void visitEnd(const MSBuildItemDefinitionGroup *itemDefinitionGroup) override; - - void visitStart(const MSBuildItemGroup *itemGroup) override; - void visitEnd(const MSBuildItemGroup *itemGroup) override; - - void visitStart(const MSBuildItemMetadata *itemMetadata) override; - void visitEnd(const MSBuildItemMetadata *itemMetadata) override; - - void visitStart(const MSBuildProject *project) override; - void visitEnd(const MSBuildProject *project) override; - - void visitStart(const MSBuildProperty *property) override; - void visitEnd(const MSBuildProperty *property) override; - - void visitStart(const MSBuildPropertyGroup *propertyGroup) override; - void visitEnd(const MSBuildPropertyGroup *propertyGroup) override; -}; - -MSBuildProjectWriter::MSBuildProjectWriter(QIODevice *device) - : d(new MSBuildProjectWriterPrivate) -{ - d->writer.reset(new QXmlStreamWriter(device)); - d->writer->setAutoFormatting(true); -} - -MSBuildProjectWriter::~MSBuildProjectWriter() -{ - delete d; -} - -bool MSBuildProjectWriter::write(const MSBuildProject *project) -{ - d->writer->writeStartDocument(); - project->accept(d); - d->writer->writeEndDocument(); - return !d->writer->hasError(); -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildImport *import) -{ - writer->writeStartElement(QStringLiteral("Import")); - writer->writeAttribute(QStringLiteral("Project"), import->project()); - if (!import->condition().isEmpty()) - writer->writeAttribute(QStringLiteral("Condition"), import->condition()); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildImport *) -{ - writer->writeEndElement(); -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildImportGroup *importGroup) -{ - writer->writeStartElement(QStringLiteral("ImportGroup")); - if (!importGroup->condition().isEmpty()) - writer->writeAttribute(QStringLiteral("Condition"), importGroup->condition()); - if (!importGroup->label().isEmpty()) - writer->writeAttribute(QStringLiteral("Label"), importGroup->label()); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildImportGroup *) -{ - writer->writeEndElement(); -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildItem *item) -{ - writer->writeStartElement(item->name()); - if (!item->include().isEmpty()) - writer->writeAttribute(QStringLiteral("Include"), item->include()); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItem *) -{ - writer->writeEndElement(); -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildItemDefinitionGroup *itemDefinitionGroup) -{ - writer->writeStartElement(QStringLiteral("ItemDefinitionGroup")); - if (!itemDefinitionGroup->condition().isEmpty()) - writer->writeAttribute(QStringLiteral("Condition"), itemDefinitionGroup->condition()); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItemDefinitionGroup *) -{ - writer->writeEndElement(); -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildItemGroup *itemGroup) -{ - writer->writeStartElement(QStringLiteral("ItemGroup")); - if (!itemGroup->condition().isEmpty()) - writer->writeAttribute(QStringLiteral("Condition"), itemGroup->condition()); - if (!itemGroup->label().isEmpty()) - writer->writeAttribute(QStringLiteral("Label"), itemGroup->label()); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItemGroup *) -{ - writer->writeEndElement(); -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildItemMetadata *itemMetadata) -{ - QString stringValue; - if (itemMetadata->value().type() == QVariant::Bool) { - stringValue = itemMetadata->value().toBool() - ? QStringLiteral("True") - : QStringLiteral("False"); - } else { - stringValue = itemMetadata->value().toString(); - } - writer->writeTextElement(itemMetadata->name(), stringValue); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildItemMetadata *) -{ -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildProject *project) -{ - writer->writeStartElement(QStringLiteral("Project")); - if (!project->defaultTargets().isEmpty()) - writer->writeAttribute(QStringLiteral("DefaultTargets"), project->defaultTargets()); - if (!project->toolsVersion().isEmpty()) - writer->writeAttribute(QStringLiteral("ToolsVersion"), project->toolsVersion()); - writer->writeAttribute(QStringLiteral("xmlns"), kMSBuildSchemaURI); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildProject *) -{ - writer->writeEndElement(); -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildProperty *property) -{ - QString stringValue; - if (property->value().type() == QVariant::Bool) - stringValue = property->value().toBool() ? QStringLiteral("True") : QStringLiteral("False"); - else - stringValue = property->value().toString(); - writer->writeTextElement(property->name(), stringValue); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildProperty *) -{ -} - -void MSBuildProjectWriterPrivate::visitStart(const MSBuildPropertyGroup *propertyGroup) -{ - writer->writeStartElement(QStringLiteral("PropertyGroup")); - if (!propertyGroup->condition().isEmpty()) - writer->writeAttribute(QStringLiteral("Condition"), propertyGroup->condition()); - if (!propertyGroup->label().isEmpty()) - writer->writeAttribute(QStringLiteral("Label"), propertyGroup->label()); -} - -void MSBuildProjectWriterPrivate::visitEnd(const MSBuildPropertyGroup *) -{ - writer->writeEndElement(); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/io/msbuildprojectwriter.h b/src/lib/corelib/generators/visualstudio/io/msbuildprojectwriter.h deleted file mode 100644 index c70889971..000000000 --- a/src/lib/corelib/generators/visualstudio/io/msbuildprojectwriter.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDPROJECTWRITER_H -#define MSBUILDPROJECTWRITER_H - -#include <QtCore/qiodevice.h> - -namespace qbs { - -class MSBuildProject; -class MSBuildProjectWriterPrivate; - -class MSBuildProjectWriter -{ - Q_DISABLE_COPY(MSBuildProjectWriter) -public: - explicit MSBuildProjectWriter(QIODevice *device); - ~MSBuildProjectWriter(); - - bool write(const MSBuildProject *project); - -private: - MSBuildProjectWriterPrivate *d; -}; - -} // namespace qbs - -#endif // MSBUILDPROJECTWRITER_H diff --git a/src/lib/corelib/generators/visualstudio/io/visualstudiosolutionwriter.cpp b/src/lib/corelib/generators/visualstudio/io/visualstudiosolutionwriter.cpp deleted file mode 100644 index 99180e2e2..000000000 --- a/src/lib/corelib/generators/visualstudio/io/visualstudiosolutionwriter.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "visualstudiosolutionwriter.h" - -#include "../solution/visualstudiosolutionfileproject.h" -#include "../solution/visualstudiosolutionfolderproject.h" -#include "../solution/visualstudiosolutionglobalsection.h" -#include "../solution/visualstudiosolution.h" - -#include <tools/hostosinfo.h> -#include <tools/pathutils.h> -#include <tools/visualstudioversioninfo.h> - -#include <QtCore/qdir.h> -#include <QtCore/qfile.h> -#include <QtCore/qfileinfo.h> -#include <QtCore/qtextstream.h> -#include <QtCore/quuid.h> - -#include <vector> - -namespace qbs { - -class VisualStudioSolutionWriterPrivate -{ -public: - QIODevice *device; - QString baseDir; -}; - -VisualStudioSolutionWriter::VisualStudioSolutionWriter(QIODevice *device) - : d(new VisualStudioSolutionWriterPrivate) -{ - d->device = device; -} - -VisualStudioSolutionWriter::~VisualStudioSolutionWriter() -{ -} - -QString VisualStudioSolutionWriter::projectBaseDirectory() const -{ - return d->baseDir; -} - -void VisualStudioSolutionWriter::setProjectBaseDirectory(const QString &dir) -{ - d->baseDir = dir; -} - -bool VisualStudioSolutionWriter::write(const VisualStudioSolution *solution) -{ - QTextStream out(d->device); - out << QString(QLatin1String("Microsoft Visual Studio Solution File, " - "Format Version %1\n" - "# Visual Studio %2\n")) - .arg(solution->versionInfo().solutionVersion()) - .arg(solution->versionInfo().version().majorVersion()); - - for (const auto &project : solution->fileProjects()) { - auto projectFilePath = project->filePath(); - - // Try to make the project file path relative to the - // solution file path if we're writing to a file device - if (!d->baseDir.isEmpty()) { - const QDir solutionDir(d->baseDir); - projectFilePath = Internal::PathUtils::toNativeSeparators( - solutionDir.relativeFilePath(projectFilePath), - Internal::HostOsInfo::HostOsWindows); - } - - out << QStringLiteral("Project(\"%1\") = \"%2\", \"%3\", \"%4\"\n") - .arg(project->projectTypeGuid().toString()) - .arg(QFileInfo(projectFilePath).baseName()) - .arg(projectFilePath) - .arg(project->guid().toString()); - - const auto dependencies = solution->dependencies(project); - if (!dependencies.isEmpty()) { - out << "\tProjectSection(ProjectDependencies) = postProject\n"; - - for (const auto &dependency : dependencies) - out << QStringLiteral("\t\t%1 = %1\n").arg(dependency->guid().toString()); - - out << "\tEndProjectSection\n"; - } - - out << "EndProject\n"; - } - - for (const auto &project : solution->folderProjects()) { - out << QStringLiteral("Project(\"%1\") = \"%2\", \"%3\", \"%4\"\n") - .arg(project->projectTypeGuid().toString()) - .arg(project->name()) - .arg(project->name()) - .arg(project->guid().toString()); - out << QStringLiteral("EndProject\n"); - } - - out << "Global\n"; - - for (const auto &globalSection : solution->globalSections()) { - out << QStringLiteral("\tGlobalSection(%1) = %2\n") - .arg(globalSection->name()) - .arg(globalSection->isPost() - ? QStringLiteral("postSolution") - : QStringLiteral("preSolution")); - for (const auto &property : globalSection->properties()) - out << QStringLiteral("\t\t%1 = %2\n").arg(property.first).arg(property.second); - out << "\tEndGlobalSection\n"; - } - - out << "EndGlobal\n"; - - return out.status() == QTextStream::Ok; -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/io/visualstudiosolutionwriter.h b/src/lib/corelib/generators/visualstudio/io/visualstudiosolutionwriter.h deleted file mode 100644 index d5b0107f0..000000000 --- a/src/lib/corelib/generators/visualstudio/io/visualstudiosolutionwriter.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef VISUALSTUDIOSOLUTIONWRITER_H -#define VISUALSTUDIOSOLUTIONWRITER_H - -#include <QtCore/qiodevice.h> -#include <QtCore/qscopedpointer.h> - -namespace qbs { - -namespace Internal { class VisualStudioVersionInfo; } - -class VisualStudioSolution; -class VisualStudioSolutionWriterPrivate; - -class VisualStudioSolutionWriter -{ - Q_DISABLE_COPY(VisualStudioSolutionWriter) -public: - explicit VisualStudioSolutionWriter(QIODevice *device); - ~VisualStudioSolutionWriter(); - - QString projectBaseDirectory() const; - void setProjectBaseDirectory(const QString &dir); - - bool write(const VisualStudioSolution *solution); - -private: - void addDefaultGlobalSections(); - - QScopedPointer<VisualStudioSolutionWriterPrivate> d; -}; - -} // namespace qbs - -#endif // VISUALSTUDIOSOLUTIONWRITER_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildgroup.cpp b/src/lib/corelib/generators/visualstudio/msbuild/imsbuildgroup.cpp deleted file mode 100644 index c51f0e517..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildgroup.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "imsbuildgroup.h" -#include "msbuildproject.h" - -namespace qbs { - -class IMSBuildGroupPrivate -{ -public: - QString condition; -}; - -IMSBuildGroup::IMSBuildGroup(MSBuildProject *parent) - : QObject(parent) - , d(new IMSBuildGroupPrivate) -{ -} - -IMSBuildGroup::~IMSBuildGroup() -{ -} - -QString IMSBuildGroup::condition() const -{ - return d->condition; -} - -void IMSBuildGroup::setCondition(const QString &condition) -{ - d->condition = condition; -} - -IMSBuildItemGroup::IMSBuildItemGroup(MSBuildProject *parent) - : IMSBuildGroup(parent) -{ -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildgroup.h b/src/lib/corelib/generators/visualstudio/msbuild/imsbuildgroup.h deleted file mode 100644 index 4d2436e52..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildgroup.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef IMSBUILDGROUP_H -#define IMSBUILDGROUP_H - -#include <QtCore/qobject.h> -#include <QtCore/qscopedpointer.h> - -namespace qbs { - -class MSBuildProject; -class IMSBuildGroupPrivate; - -class IMSBuildGroup : public QObject -{ - Q_OBJECT -public: - explicit IMSBuildGroup(MSBuildProject *parent = 0); - virtual ~IMSBuildGroup(); - - QString condition() const; - void setCondition(const QString &condition); - -private: - QScopedPointer<IMSBuildGroupPrivate> d; -}; - -class IMSBuildItemGroup : public IMSBuildGroup -{ - Q_OBJECT -public: - explicit IMSBuildItemGroup(MSBuildProject *parent = 0); -}; - -} // namespace qbs - -#endif // IMSBUILDGROUP_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnode.cpp b/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnode.cpp deleted file mode 100644 index 4c70405c2..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnode.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "imsbuildnode.h" - -namespace qbs { - -IMSBuildNode::~IMSBuildNode() -{ -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnode.h b/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnode.h deleted file mode 100644 index 67fb10081..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnode.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef IMSBUILDNODE_H -#define IMSBUILDNODE_H - -namespace qbs { - -class IMSBuildNodeVisitor; - -class IMSBuildNode -{ -public: - virtual ~IMSBuildNode(); - virtual void accept(IMSBuildNodeVisitor *visitor) const = 0; -}; - -} // namespace qbs - -#endif // IMSBUILDNODE_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnodevisitor.h b/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnodevisitor.h deleted file mode 100644 index fe75c23f9..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildnodevisitor.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef IMSBUILDNODEVISITOR_H -#define IMSBUILDNODEVISITOR_H - -namespace qbs { - -class MSBuildImport; -class MSBuildImportGroup; -class MSBuildItem; -class MSBuildItemDefinitionGroup; -class MSBuildItemGroup; -class MSBuildItemMetadata; -class MSBuildProject; -class MSBuildProperty; -class MSBuildPropertyGroup; - -class IMSBuildNodeVisitor -{ -public: - virtual ~IMSBuildNodeVisitor() {} - - virtual void visitStart(const MSBuildImport *import) = 0; - virtual void visitEnd(const MSBuildImport *import) = 0; - - virtual void visitStart(const MSBuildImportGroup *importGroup) = 0; - virtual void visitEnd(const MSBuildImportGroup *importGroup) = 0; - - virtual void visitStart(const MSBuildItem *item) = 0; - virtual void visitEnd(const MSBuildItem *item) = 0; - - virtual void visitStart(const MSBuildItemDefinitionGroup *itemDefinitionGroup) = 0; - virtual void visitEnd(const MSBuildItemDefinitionGroup *itemDefinitionGroup) = 0; - - virtual void visitStart(const MSBuildItemGroup *itemGroup) = 0; - virtual void visitEnd(const MSBuildItemGroup *itemGroup) = 0; - - virtual void visitStart(const MSBuildItemMetadata *itemMetadata) = 0; - virtual void visitEnd(const MSBuildItemMetadata *itemMetadata) = 0; - - virtual void visitStart(const MSBuildProject *project) = 0; - virtual void visitEnd(const MSBuildProject *project) = 0; - - virtual void visitStart(const MSBuildProperty *property) = 0; - virtual void visitEnd(const MSBuildProperty *property) = 0; - - virtual void visitStart(const MSBuildPropertyGroup *propertyGroup) = 0; - virtual void visitEnd(const MSBuildPropertyGroup *propertyGroup) = 0; -}; - -} // namespace qbs - -#endif // IMSBUILDNODEVISITOR_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildproperty.cpp b/src/lib/corelib/generators/visualstudio/msbuild/imsbuildproperty.cpp deleted file mode 100644 index 6e54f1e43..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildproperty.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "imsbuildproperty.h" - -namespace qbs { - -class IMSBuildPropertyPrivate -{ -public: - QString condition; - QString name; - QVariant value; -}; - -IMSBuildProperty::IMSBuildProperty(QObject *parent) - : QObject(parent) - , d(new IMSBuildPropertyPrivate) -{ -} - -IMSBuildProperty::~IMSBuildProperty() -{ -} - -QString IMSBuildProperty::condition() const -{ - return d->condition; -} - -void IMSBuildProperty::setCondition(const QString &condition) -{ - d->condition = condition; -} - -QString IMSBuildProperty::name() const -{ - return d->name; -} - -void IMSBuildProperty::setName(const QString &name) -{ - d->name = name; -} - -QVariant IMSBuildProperty::value() const -{ - return d->value; -} - -void IMSBuildProperty::setValue(const QVariant &value) -{ - d->value = value; -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildproperty.h b/src/lib/corelib/generators/visualstudio/msbuild/imsbuildproperty.h deleted file mode 100644 index a1a7676e6..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/imsbuildproperty.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef IMSBUILDPROPERTY_H -#define IMSBUILDPROPERTY_H - -#include <QtCore/qobject.h> -#include <QtCore/qscopedpointer.h> -#include <QtCore/qvariant.h> - -namespace qbs { - -class IMSBuildPropertyPrivate; - -class IMSBuildProperty : public QObject -{ - Q_OBJECT -protected: - explicit IMSBuildProperty(QObject *parent = 0); - -public: - virtual ~IMSBuildProperty(); - - QString condition() const; - void setCondition(const QString &condition); - - QString name() const; - void setName(const QString &name); - - QVariant value() const; - void setValue(const QVariant &value); - -private: - QScopedPointer<IMSBuildPropertyPrivate> d; -}; - -} // namespace qbs - -#endif // IMSBUILDPROPERTY_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclcompile.cpp b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclcompile.cpp deleted file mode 100644 index d8a587454..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclcompile.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildclcompile.h" - -namespace qbs { - -static const QString MSBuildClCompileItemName = QStringLiteral("ClCompile"); - -MSBuildClCompile::MSBuildClCompile(IMSBuildItemGroup *parent) - : MSBuildFileItem(MSBuildClCompileItemName, parent) -{ -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclcompile.h b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclcompile.h deleted file mode 100644 index 745c3ed7f..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclcompile.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDCLCOMPILE_H -#define MSBUILDCLCOMPILE_H - -#include "msbuildfileitem.h" - -namespace qbs { - -class MSBuildClCompile : public MSBuildFileItem -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildClCompile) -public: - explicit MSBuildClCompile(IMSBuildItemGroup *parent = 0); -}; - -} // namespace qbs - -#endif // MSBUILDCLCOMPILE_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclinclude.cpp b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclinclude.cpp deleted file mode 100644 index d9c61bece..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclinclude.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildclinclude.h" - -namespace qbs { - -static const QString MSBuildClIncludeItemName = QStringLiteral("ClInclude"); - -MSBuildClInclude::MSBuildClInclude(IMSBuildItemGroup *parent) - : MSBuildFileItem(MSBuildClIncludeItemName, parent) -{ -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclinclude.h b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclinclude.h deleted file mode 100644 index cfe31022f..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildclinclude.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDCLINCLUDE_H -#define MSBUILDCLINCLUDE_H - -#include "msbuildfileitem.h" - -namespace qbs { - -class MSBuildClInclude : public MSBuildFileItem -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildClInclude) -public: - explicit MSBuildClInclude(IMSBuildItemGroup *parent = 0); -}; - -} // namespace qbs - -#endif // MSBUILDCLINCLUDE_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfileitem.cpp b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfileitem.cpp deleted file mode 100644 index bce7488b4..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfileitem.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildfileitem.h" -#include "../msbuilditemmetadata.h" - -namespace qbs { - -class MSBuildFileItemPrivate -{ -public: - QScopedPointer<MSBuildItemMetadata> filter; -}; - -MSBuildFileItem::MSBuildFileItem(const QString &name, IMSBuildItemGroup *parent) - : MSBuildItem(name, parent) - , d(new MSBuildFileItemPrivate) -{ - d->filter.reset(new MSBuildItemMetadata(QStringLiteral("Filter"), QVariant())); -} - -MSBuildFileItem::~MSBuildFileItem() -{ -} - -QString MSBuildFileItem::filePath() const -{ - return include(); -} - -void MSBuildFileItem::setFilePath(const QString &filePath) -{ - setInclude(filePath); -} - -QString MSBuildFileItem::filterName() const -{ - return d->filter->value().toString(); -} - -void MSBuildFileItem::setFilterName(const QString &filterName) -{ - d->filter->setValue(filterName); - d->filter->setParent(!filterName.isEmpty() ? this : nullptr); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfileitem.h b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfileitem.h deleted file mode 100644 index d6e4d485b..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfileitem.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDFILEITEM_H -#define MSBUILDFILEITEM_H - -#include "../msbuilditem.h" - -namespace qbs { - -class MSBuildFileItemPrivate; - -class MSBuildFileItem : public MSBuildItem -{ -public: - virtual ~MSBuildFileItem(); - - QString filePath() const; - void setFilePath(const QString &filePath); - - QString filterName() const; - void setFilterName(const QString &filterName); - -protected: - explicit MSBuildFileItem(const QString &name, IMSBuildItemGroup *parent = 0); - -private: - QScopedPointer<MSBuildFileItemPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDFILEITEM_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfilter.cpp b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfilter.cpp deleted file mode 100644 index 3a5d98a98..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfilter.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildfilter.h" -#include "../msbuilditemmetadata.h" -#include <tools/hostosinfo.h> -#include <QtCore/quuid.h> - -namespace qbs { - -static const QString MSBuildFilterItemName = QStringLiteral("Filter"); - -class MSBuildFilterPrivate -{ -public: - QUuid identifier; - QList<QString> extensions; - bool parseFiles = true; - bool sourceControlFiles = true; - MSBuildItemMetadata *identifierMetadata; - MSBuildItemMetadata *extensionsMetadata; -}; - -MSBuildFilter::MSBuildFilter(IMSBuildItemGroup *parent) - : MSBuildItem(MSBuildFilterItemName, parent) - , d(new MSBuildFilterPrivate) -{ - d->identifierMetadata = new MSBuildItemMetadata(QStringLiteral("UniqueIdentifier"), - QVariant(), this); - d->extensionsMetadata = new MSBuildItemMetadata(QStringLiteral("Extensions"), - QVariant(), this); - setIdentifier(QUuid::createUuid()); -} - -MSBuildFilter::MSBuildFilter(const QString &name, - const QList<QString> &extensions, - IMSBuildItemGroup *parent) - : MSBuildFilter(parent) -{ - setInclude(name); - setExtensions(extensions); -} - -MSBuildFilter::~MSBuildFilter() -{ -} - -QUuid MSBuildFilter::identifier() const -{ - return d->identifier; -} - -void MSBuildFilter::setIdentifier(const QUuid &identifier) -{ - d->identifier = identifier; - d->identifierMetadata->setValue(identifier.toString()); -} - -QList<QString> MSBuildFilter::extensions() const -{ - return d->extensions; -} - -void MSBuildFilter::setExtensions(const QList<QString> &extensions) -{ - d->extensions = extensions; - d->extensionsMetadata->setValue(QStringList(extensions).join( - Internal::HostOsInfo::pathListSeparator( - Internal::HostOsInfo::HostOsWindows))); -} - -bool MSBuildFilter::parseFiles() const -{ - return d->parseFiles; -} - -void MSBuildFilter::setParseFiles(bool parseFiles) -{ - d->parseFiles = parseFiles; -} - -bool MSBuildFilter::sourceControlFiles() const -{ - return d->sourceControlFiles; -} - -void MSBuildFilter::setSourceControlFiles(bool sourceControlFiles) -{ - d->sourceControlFiles = sourceControlFiles; -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfilter.h b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfilter.h deleted file mode 100644 index 344783a1e..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildfilter.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDFILTER_H -#define MSBUILDFILTER_H - -#include "../msbuilditem.h" - -namespace qbs { - -class IMSBuildItemGroup; -class MSBuildFilterPrivate; - -class MSBuildFilter : public MSBuildItem -{ - Q_OBJECT -public: - explicit MSBuildFilter(IMSBuildItemGroup *parent = 0); - MSBuildFilter(const QString &name, const QList<QString> &extensions, - IMSBuildItemGroup *parent = 0); - ~MSBuildFilter(); - - QUuid identifier() const; - void setIdentifier(const QUuid &identifier); - - QList<QString> extensions() const; - void setExtensions(const QList<QString> &extensions); - - bool parseFiles() const; - void setParseFiles(bool parseFiles); - - bool sourceControlFiles() const; - void setSourceControlFiles(bool sourceControlFiles); - -private: - QScopedPointer<MSBuildFilterPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDFILTER_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildlink.cpp b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildlink.cpp deleted file mode 100644 index cae1a63a3..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildlink.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildlink.h" - -#include "../imsbuildgroup.h" - -namespace qbs { - -static const QString MSBuildLinkItemName = QStringLiteral("Link"); - -MSBuildLink::MSBuildLink(IMSBuildItemGroup *parent) - : MSBuildItem(MSBuildLinkItemName, parent) -{ -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildlink.h b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildlink.h deleted file mode 100644 index caf125440..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildlink.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDLINK_H -#define MSBUILDLINK_H - -#include "../msbuilditem.h" - -namespace qbs { - -class IMSBuildItemGroup; - -class MSBuildLink : public MSBuildItem -{ - Q_OBJECT -public: - explicit MSBuildLink(IMSBuildItemGroup *parent = 0); -}; - -} // namespace qbs - -#endif // MSBUILDLINK_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildnone.cpp b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildnone.cpp deleted file mode 100644 index a590c6e9f..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildnone.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildnone.h" - -namespace qbs { - -MSBuildNone::MSBuildNone(IMSBuildItemGroup *parent) - : MSBuildFileItem(QStringLiteral("None"), parent) -{ -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildnone.h b/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildnone.h deleted file mode 100644 index 98dac7a76..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/items/msbuildnone.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDNONE_H -#define MSBUILDNONE_H - -#include "msbuildfileitem.h" - -namespace qbs { - -class MSBuildNone : public MSBuildFileItem -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildNone) -public: - explicit MSBuildNone(IMSBuildItemGroup *parent = 0); -}; - -} // namespace qbs - -#endif // MSBUILDNONE_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimport.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuildimport.cpp deleted file mode 100644 index a0c693aff..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimport.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildimport.h" - -#include "imsbuildnodevisitor.h" -#include "msbuildimportgroup.h" -#include "msbuildproject.h" - -namespace qbs { - -class MSBuildImportPrivate -{ -public: - QString project; - QString condition; -}; - -MSBuildImport::MSBuildImport(MSBuildProject *parent) - : QObject(parent) - , d(new MSBuildImportPrivate) -{ -} - -MSBuildImport::MSBuildImport(MSBuildImportGroup *parent) - : QObject(parent) - , d(new MSBuildImportPrivate) -{ -} - -MSBuildImport::~MSBuildImport() -{ -} - -QString MSBuildImport::project() const -{ - return d->project; -} - -void MSBuildImport::setProject(const QString &project) -{ - d->project = project; -} - -QString MSBuildImport::condition() const -{ - return d->condition; -} - -void MSBuildImport::setCondition(const QString &condition) -{ - d->condition = condition; -} - -void MSBuildImport::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimport.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuildimport.h deleted file mode 100644 index 352616e1b..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimport.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ -#ifndef MSBUILDIMPORT_H -#define MSBUILDIMPORT_H - -#include <QtCore/qobject.h> -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildImportGroup; -class MSBuildImportPrivate; -class MSBuildProject; - -/*! - * \brief The MSBuildImport class represents an MSBuild Import element. - * - * https://msdn.microsoft.com/en-us/library/92x05xfs.aspx - */ -class MSBuildImport : public QObject, public IMSBuildNode -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildImport) -public: - explicit MSBuildImport(MSBuildProject *parent); - explicit MSBuildImport(MSBuildImportGroup *parent); - virtual ~MSBuildImport(); - - QString project() const; - void setProject(const QString &project); - - QString condition() const; - void setCondition(const QString &condition); - - void accept(IMSBuildNodeVisitor *visitor) const; - -private: - QScopedPointer<MSBuildImportPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDIMPORT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimportgroup.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuildimportgroup.cpp deleted file mode 100644 index 56c48049e..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimportgroup.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildimportgroup.h" - -#include "imsbuildnodevisitor.h" -#include "msbuildimport.h" - -namespace qbs { - -class MSBuildImportGroupPrivate -{ -public: - QString label; -}; - -MSBuildImportGroup::MSBuildImportGroup(MSBuildProject *parent) - : IMSBuildGroup(parent) - , d(new MSBuildImportGroupPrivate) -{ -} - -MSBuildImportGroup::~MSBuildImportGroup() -{ -} - -QString MSBuildImportGroup::label() const -{ - return d->label; -} - -void MSBuildImportGroup::setLabel(const QString &label) -{ - d->label = label; -} - -void MSBuildImportGroup::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - - for (const auto &child : children()) { - if (const MSBuildImport *import = qobject_cast<const MSBuildImport *>(child)) - import->accept(visitor); - } - - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimportgroup.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuildimportgroup.h deleted file mode 100644 index c2f0b8fc7..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildimportgroup.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDIMPORTGROUP_H -#define MSBUILDIMPORTGROUP_H - -#include "imsbuildgroup.h" -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildProject; -class MSBuildImportGroupPrivate; - -/*! - * \brief The MSBuildImportGroup class represents an MSBuild ImportGroup element. - * - * https://msdn.microsoft.com/en-us/library/ff606262.aspx - */ -class MSBuildImportGroup : public IMSBuildGroup, public IMSBuildNode -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildImportGroup) -public: - explicit MSBuildImportGroup(MSBuildProject *parent = 0); - virtual ~MSBuildImportGroup(); - - QString label() const; - void setLabel(const QString &label); - - void accept(IMSBuildNodeVisitor *visitor) const; - -private: - QScopedPointer<MSBuildImportGroupPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDIMPORTGROUP_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditem.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditem.cpp deleted file mode 100644 index 9a2ffb734..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditem.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuilditem.h" - -#include "imsbuildnodevisitor.h" -#include "msbuilditemdefinitiongroup.h" -#include "msbuilditemgroup.h" -#include "msbuilditemmetadata.h" - -namespace qbs { - -class MSBuildItemPrivate -{ -public: - QString name = QStringLiteral("Item"); - QString include; -}; - -MSBuildItem::MSBuildItem(const QString &name, IMSBuildItemGroup *parent) - : QObject(parent) - , d(new MSBuildItemPrivate) -{ - setName(name); -} - -MSBuildItem::~MSBuildItem() -{ -} - -QString MSBuildItem::name() const -{ - return d->name; -} - -void MSBuildItem::setName(const QString &name) -{ - d->name = name; -} - -QString MSBuildItem::include() const -{ - return d->include; -} - -void MSBuildItem::setInclude(const QString &include) -{ - d->include = include; -} - -void MSBuildItem::appendProperty(const QString &name, const QVariant &value) -{ - new MSBuildItemMetadata(name, value, this); -} - -void MSBuildItem::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - - for (const auto &child : children()) { - if (MSBuildItemMetadata *itemMetadata = qobject_cast<MSBuildItemMetadata *>(child)) - itemMetadata->accept(visitor); - } - - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditem.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditem.h deleted file mode 100644 index ca411c715..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditem.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDITEM_H -#define MSBUILDITEM_H - -#include <QtCore/qobject.h> -#include "imsbuildnode.h" - -namespace qbs { - -class IMSBuildItemGroup; -class MSBuildItemDefinitionGroup; -class MSBuildItemGroup; -class MSBuildItemPrivate; - -/*! - * \brief The MSBuildItem class represents an MSBuild Item element. - * - * https://msdn.microsoft.com/en-us/library/ms164283.aspx - */ -class MSBuildItem : public QObject, public IMSBuildNode -{ - Q_OBJECT -public: - explicit MSBuildItem(const QString &name, IMSBuildItemGroup *parent = 0); - virtual ~MSBuildItem(); - - QString name() const; - void setName(const QString &name); - - QString include() const; - void setInclude(const QString &include); - - void appendProperty(const QString &name, const QVariant &value); - - void accept(IMSBuildNodeVisitor *visitor) const; - -private: - QScopedPointer<MSBuildItemPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDITEM_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemdefinitiongroup.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemdefinitiongroup.cpp deleted file mode 100644 index 5228e850e..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemdefinitiongroup.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuilditemdefinitiongroup.h" - -#include "imsbuildnodevisitor.h" -#include "msbuilditem.h" - -namespace qbs { - -MSBuildItemDefinitionGroup::MSBuildItemDefinitionGroup(MSBuildProject *parent) - : IMSBuildItemGroup(parent) -{ -} - -MSBuildItemDefinitionGroup::~MSBuildItemDefinitionGroup() -{ -} - -void MSBuildItemDefinitionGroup::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - - for (const auto &child : children()) { - if (const auto item = qobject_cast<MSBuildItem *>(child)) - item->accept(visitor); - } - - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemdefinitiongroup.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemdefinitiongroup.h deleted file mode 100644 index a96f0fff8..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemdefinitiongroup.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDITEMDEFINITIONGROUP_H -#define MSBUILDITEMDEFINITIONGROUP_H - -#include "imsbuildgroup.h" -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildProject; -class MSBuildItemDefinitionGroupPrivate; - -/*! - * \brief The MSBuildItemDefinitionGroup class represents an MSBuild ItemDefinitionGroup element. - * - * https://msdn.microsoft.com/en-us/library/bb629392.aspx - */ -class MSBuildItemDefinitionGroup : public IMSBuildItemGroup, public IMSBuildNode -{ - Q_OBJECT -public: - explicit MSBuildItemDefinitionGroup(MSBuildProject *parent = 0); - ~MSBuildItemDefinitionGroup(); - - void accept(IMSBuildNodeVisitor *visitor) const; -}; - -} // namespace qbs - -#endif // MSBUILDITEMDEFINITIONGROUP_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemgroup.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemgroup.cpp deleted file mode 100644 index 7a9bd122b..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemgroup.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuilditemgroup.h" - -#include "imsbuildnodevisitor.h" -#include "msbuilditem.h" - -namespace qbs { - -class MSBuildItemGroupPrivate -{ -public: - QString label; -}; - -MSBuildItemGroup::MSBuildItemGroup(MSBuildProject *parent) - : IMSBuildItemGroup(parent) - , d(new MSBuildItemGroupPrivate) -{ -} - -MSBuildItemGroup::~MSBuildItemGroup() -{ -} - -QString MSBuildItemGroup::label() const -{ - return d->label; -} - -void MSBuildItemGroup::setLabel(const QString &label) -{ - d->label = label; -} - -void MSBuildItemGroup::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - - for (const auto &child : children()) { - if (const MSBuildItem *item = qobject_cast<MSBuildItem *>(child)) - item->accept(visitor); - } - - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemgroup.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemgroup.h deleted file mode 100644 index 02ac6b082..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemgroup.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDITEMGROUP_H -#define MSBUILDITEMGROUP_H - -#include "imsbuildgroup.h" -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildProject; -class MSBuildItemGroupPrivate; - -/*! - * \brief The MSBuildItemGroup class represents an MSBuild ItemGroup element. - * - * https://msdn.microsoft.com/en-us/library/646dk05y.aspx - */ -class MSBuildItemGroup : public IMSBuildItemGroup, public IMSBuildNode -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildItemGroup) -public: - explicit MSBuildItemGroup(MSBuildProject *parent = 0); - ~MSBuildItemGroup(); - - QString label() const; - void setLabel(const QString &label); - - void accept(IMSBuildNodeVisitor *visitor) const; - -private: - QScopedPointer<MSBuildItemGroupPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDITEMGROUP_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemmetadata.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemmetadata.cpp deleted file mode 100644 index daaa4c6b3..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemmetadata.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuilditemmetadata.h" - -#include "imsbuildnodevisitor.h" -#include "msbuilditem.h" - -namespace qbs { - -MSBuildItemMetadata::MSBuildItemMetadata(MSBuildItem *parent) - : IMSBuildProperty(parent) -{ -} - -MSBuildItemMetadata::MSBuildItemMetadata(const QString &name, const QVariant &value, - MSBuildItem *parent) - : MSBuildItemMetadata(parent) -{ - setName(name); - setValue(value); -} - -void MSBuildItemMetadata::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemmetadata.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemmetadata.h deleted file mode 100644 index 7a42f1736..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuilditemmetadata.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDITEMMETADATA_H -#define MSBUILDITEMMETADATA_H - -#include "imsbuildproperty.h" -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildItem; - -/*! - * \brief The MSBuildItemMetadata class represents an MSBuild ItemMetadata element. - * - * https://msdn.microsoft.com/en-us/library/ms164284.aspx - */ -class MSBuildItemMetadata : public IMSBuildProperty, public IMSBuildNode -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildItemMetadata) -public: - explicit MSBuildItemMetadata(MSBuildItem *parent = 0); - MSBuildItemMetadata(const QString &name, const QVariant &value = QVariant(), - MSBuildItem *parent = 0); - - void accept(IMSBuildNodeVisitor *visitor) const; -}; - -} // namespace qbs - -#endif // MSBUILDITEMMETADATA_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproject.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuildproject.cpp deleted file mode 100644 index c872622b9..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproject.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildproject.h" - -#include "imsbuildnodevisitor.h" -#include "msbuildimport.h" -#include "msbuildimportgroup.h" -#include "msbuilditemdefinitiongroup.h" -#include "msbuilditemgroup.h" -#include "msbuildpropertygroup.h" - -namespace qbs { - -class MSBuildProjectPrivate -{ -public: - QString defaultTargets; - QString toolsVersion; -}; - -MSBuildProject::MSBuildProject(QObject *parent) - : QObject(parent) - , d(new MSBuildProjectPrivate) -{ -} - -MSBuildProject::~MSBuildProject() -{ -} - -QString MSBuildProject::defaultTargets() const -{ - return d->defaultTargets; -} - -void MSBuildProject::setDefaultTargets(const QString &defaultTargets) -{ - d->defaultTargets = defaultTargets; -} - -QString MSBuildProject::toolsVersion() const -{ - return d->toolsVersion; -} - -void MSBuildProject::setToolsVersion(const QString &toolsVersion) -{ - d->toolsVersion = toolsVersion; -} - -void MSBuildProject::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - - for (const auto &child : children()) { - if (const auto node = qobject_cast<MSBuildImport *>(child)) - node->accept(visitor); - else if (const auto node = qobject_cast<MSBuildImportGroup *>(child)) - node->accept(visitor); - else if (const auto node = qobject_cast<MSBuildItemDefinitionGroup *>(child)) - node->accept(visitor); - else if (const auto node = qobject_cast<MSBuildItemGroup *>(child)) - node->accept(visitor); - else if (const auto node = qobject_cast<MSBuildPropertyGroup *>(child)) - node->accept(visitor); - } - - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproject.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuildproject.h deleted file mode 100644 index fc1a0f1f4..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproject.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDPROJECT_H -#define MSBUILDPROJECT_H - -#include <QtCore/qobject.h> -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildProjectPrivate; - -/*! - * \brief The MSBuildProject class represents an MSBuild Project element. - * - * https://msdn.microsoft.com/en-us/library/bcxfsh87.aspx - */ -class MSBuildProject : public QObject, public IMSBuildNode -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildProject) -public: - explicit MSBuildProject(QObject *parent = 0); - ~MSBuildProject(); - - QString defaultTargets() const; - void setDefaultTargets(const QString &defaultTargets); - - QString toolsVersion() const; - void setToolsVersion(const QString &toolsVersion); - - void accept(IMSBuildNodeVisitor *visitor) const; - -private: - QScopedPointer<MSBuildProjectPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproperty.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuildproperty.cpp deleted file mode 100644 index 410e2a694..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproperty.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildproperty.h" - -#include "imsbuildnodevisitor.h" -#include "msbuildpropertygroup.h" - -namespace qbs { - -MSBuildProperty::MSBuildProperty(MSBuildPropertyGroup *parent) - : IMSBuildProperty(parent) -{ -} - -MSBuildProperty::MSBuildProperty(const QString &name, const QVariant &value, - MSBuildPropertyGroup *parent) - : MSBuildProperty(parent) -{ - setName(name); - setValue(value); -} - -void MSBuildProperty::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproperty.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuildproperty.h deleted file mode 100644 index 310fcc044..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildproperty.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDPROPERTY_H -#define MSBUILDPROPERTY_H - -#include "imsbuildproperty.h" -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildPropertyGroup; - -/*! - * \brief The MSBuildProperty class represents an MSBuild Property element. - * - * https://msdn.microsoft.com/en-us/library/ms164288.aspx - */ -class MSBuildProperty : public IMSBuildProperty, public IMSBuildNode -{ - Q_OBJECT -public: - explicit MSBuildProperty(MSBuildPropertyGroup *parent = 0); - MSBuildProperty(const QString &name, const QVariant &value = QVariant(), - MSBuildPropertyGroup *parent = 0); - - void accept(IMSBuildNodeVisitor *visitor) const; -}; - -} // namespace qbs - -#endif // MSBUILDPROPERTY_H diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildpropertygroup.cpp b/src/lib/corelib/generators/visualstudio/msbuild/msbuildpropertygroup.cpp deleted file mode 100644 index 4f9c72939..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildpropertygroup.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildpropertygroup.h" - -#include "imsbuildnodevisitor.h" -#include "msbuildproperty.h" - -namespace qbs { - -class MSBuildPropertyGroupPrivate -{ -public: - QString condition; - QString label; -}; - -MSBuildPropertyGroup::MSBuildPropertyGroup(MSBuildProject *parent) - : IMSBuildGroup(parent) - , d(new MSBuildPropertyGroupPrivate) -{ -} - -MSBuildPropertyGroup::~MSBuildPropertyGroup() -{ -} - -QString MSBuildPropertyGroup::label() const -{ - return d->label; -} - -void MSBuildPropertyGroup::setLabel(const QString &label) -{ - d->label = label; -} - -void MSBuildPropertyGroup::appendProperty(const QString &name, const QVariant &value) -{ - new MSBuildProperty(name, value, this); -} - -void MSBuildPropertyGroup::accept(IMSBuildNodeVisitor *visitor) const -{ - visitor->visitStart(this); - - for (const auto &child : children()) { - if (const MSBuildProperty *property = qobject_cast<MSBuildProperty *>(child)) - property->accept(visitor); - } - - visitor->visitEnd(this); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuild/msbuildpropertygroup.h b/src/lib/corelib/generators/visualstudio/msbuild/msbuildpropertygroup.h deleted file mode 100644 index 33fa07b3e..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuild/msbuildpropertygroup.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDPROPERTYGROUP_H -#define MSBUILDPROPERTYGROUP_H - -#include "imsbuildgroup.h" -#include "imsbuildnode.h" - -namespace qbs { - -class MSBuildProject; -class MSBuildPropertyGroupPrivate; - -/*! - * \brief The MSBuildPropertyGroup class represents an MSBuild PropertyGroup element. - * - * https://msdn.microsoft.com/en-us/library/t4w159bs.aspx - */ -class MSBuildPropertyGroup : public IMSBuildGroup, public IMSBuildNode -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildPropertyGroup) -public: - explicit MSBuildPropertyGroup(MSBuildProject *parent = 0); - ~MSBuildPropertyGroup(); - - QString label() const; - void setLabel(const QString &label); - - void appendProperty(const QString &name, const QVariant &value); - - void accept(IMSBuildNodeVisitor *visitor) const; - -private: - QScopedPointer<MSBuildPropertyGroupPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDPROPERTYGROUP_H diff --git a/src/lib/corelib/generators/visualstudio/msbuildfiltersproject.cpp b/src/lib/corelib/generators/visualstudio/msbuildfiltersproject.cpp deleted file mode 100644 index 45a09236a..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildfiltersproject.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildfiltersproject.h" - -#include "msbuild/msbuilditemgroup.h" - -#include "msbuild/items/msbuildclcompile.h" -#include "msbuild/items/msbuildclinclude.h" -#include "msbuild/items/msbuildfilter.h" -#include "msbuild/items/msbuildnone.h" - -#include <tools/set.h> - -#include <QtCore/qfileinfo.h> - -#include <vector> - -namespace qbs { - -namespace { - -static QStringList sourceFileExtensions() -{ - return QStringList() - << QStringLiteral("c") - << QStringLiteral("C") - << QStringLiteral("cpp") - << QStringLiteral("cxx") - << QStringLiteral("c++") - << QStringLiteral("cc") - << QStringLiteral("cs") - << QStringLiteral("def") - << QStringLiteral("java") - << QStringLiteral("m") - << QStringLiteral("mm"); -} - -static QStringList headerFileExtensions() -{ - return QStringList() - << QStringLiteral("h") - << QStringLiteral("H") - << QStringLiteral("hpp") - << QStringLiteral("hxx") - << QStringLiteral("h++"); -} - -static std::vector<MSBuildFilter *> defaultItemGroupFilters(IMSBuildItemGroup *parent = 0) -{ - const auto sourceFilter = new MSBuildFilter(QStringLiteral("Source Files"), sourceFileExtensions(), parent); - const auto headerFilter = new MSBuildFilter(QStringLiteral("Header Files"), headerFileExtensions(), parent); - - const auto formFilter = new MSBuildFilter(QStringLiteral("Form Files"), - QStringList() << QStringLiteral("ui"), parent); - const auto resourceFilter = new MSBuildFilter(QStringLiteral("Resource Files"), - QStringList() - << QStringLiteral("qrc") - << QStringLiteral("rc") - << QStringLiteral("*"), parent); - resourceFilter->setParseFiles(false); - const auto generatedFilter = new MSBuildFilter(QStringLiteral("Generated Files"), - QStringList() << QStringLiteral("moc"), parent); - generatedFilter->setSourceControlFiles(false); - const auto translationFilter = new MSBuildFilter(QStringLiteral("Translation Files"), - QStringList() << QStringLiteral("ts"), parent); - translationFilter->setParseFiles(false); - - return std::vector<MSBuildFilter *> { - sourceFilter, headerFilter, formFilter, resourceFilter, generatedFilter, translationFilter - }; -} - -static bool matchesFilter(const MSBuildFilter *filter, const QString &filePath) -{ - return filter->extensions().contains(QFileInfo(filePath).completeSuffix()); -} - -} - -MSBuildFiltersProject::MSBuildFiltersProject(const GeneratableProductData &product, - QObject *parent) - : MSBuildProject(parent) -{ - // Normally this would be versionInfo.toolsVersion() but for some reason it seems - // filters projects are always v4.0 - setToolsVersion(QStringLiteral("4.0")); - - auto itemGroup = new MSBuildItemGroup(this); - const auto filterOptions = defaultItemGroupFilters(); - for (const auto options : filterOptions) { - auto filter = new MSBuildFilter(options->include(), options->extensions(), itemGroup); - filter->appendProperty(QStringLiteral("ParseFiles"), options->parseFiles()); - filter->appendProperty(QStringLiteral("SourceControlFiles"), options->sourceControlFiles()); - } - - Internal::Set<QString> allFiles; - for (const auto &productData : product.data.values()) { - for (const auto &groupData : productData.groups()) - if (groupData.isEnabled()) - allFiles.unite(Internal::Set<QString>::fromList(groupData.allFilePaths())); - } - - MSBuildItemGroup *headerFilesGroup = nullptr; - MSBuildItemGroup *sourceFilesGroup = nullptr; - MSBuildItemGroup *filesGroup = nullptr; - - for (const auto &filePath : allFiles) { - MSBuildFileItem *fileItem = nullptr; - - for (const MSBuildFilter *options : filterOptions) { - if (matchesFilter(options, filePath)) { - if (options->include() == QStringLiteral("Header Files")) { - if (!headerFilesGroup) - headerFilesGroup = new MSBuildItemGroup(this); - fileItem = new MSBuildClInclude(headerFilesGroup); - } else if (options->include() == QStringLiteral("Source Files")) { - if (!sourceFilesGroup) - sourceFilesGroup = new MSBuildItemGroup(this); - fileItem = new MSBuildClCompile(sourceFilesGroup); - } - - if (fileItem) { - fileItem->setFilterName(options->include()); - break; - } - } - } - - if (!fileItem) { - if (!filesGroup) - filesGroup = new MSBuildItemGroup(this); - fileItem = new MSBuildNone(filesGroup); - } - fileItem->setFilePath(filePath); - } - - qDeleteAll(filterOptions); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuildfiltersproject.h b/src/lib/corelib/generators/visualstudio/msbuildfiltersproject.h deleted file mode 100644 index 521a6e610..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildfiltersproject.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDFILTERSPROJECT_H -#define MSBUILDFILTERSPROJECT_H - -#include "msbuild/msbuildproject.h" - -#include <generators/generatordata.h> -#include <tools/visualstudioversioninfo.h> - -namespace qbs { - -class MSBuildFilter; - -class MSBuildFiltersProject : public MSBuildProject -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildFiltersProject) -public: - explicit MSBuildFiltersProject(const GeneratableProductData &product, - QObject *parent = 0); -}; - -} // namespace qbs - -#endif // MSBUILDFILTERSPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuildqbsgenerateproject.cpp b/src/lib/corelib/generators/visualstudio/msbuildqbsgenerateproject.cpp deleted file mode 100644 index 51c72ecd3..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildqbsgenerateproject.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildqbsgenerateproject.h" - -#include "msbuild/msbuildimport.h" -#include "msbuild/msbuildproperty.h" -#include "msbuild/msbuildpropertygroup.h" - -#include <tools/hostosinfo.h> -#include <tools/shellutils.h> -#include <QtCore/quuid.h> - -namespace qbs { - -MSBuildQbsGenerateProject::MSBuildQbsGenerateProject( - const GeneratableProject &project, - const Internal::VisualStudioVersionInfo &versionInfo, - VisualStudioGenerator *parent) - : MSBuildTargetProject(project, versionInfo, parent) -{ - auto cppDefaultProps = new MSBuildImport(this); - cppDefaultProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.Default.props")); - - auto group = new MSBuildPropertyGroup(this); - group->setLabel(QStringLiteral("Configuration")); - group->appendProperty(QStringLiteral("PlatformToolset"), - versionInfo.platformToolsetVersion()); - group->appendProperty(QStringLiteral("ConfigurationType"), - QStringLiteral("Makefile")); - const auto params = Internal::shellQuote(project.commandLine(), - Internal::HostOsInfo::HostOsWindows); - group->appendProperty(QStringLiteral("NMakeBuildCommandLine"), - QStringLiteral("$(QbsGenerateCommandLine) ") + params); - - auto cppProps = new MSBuildImport(this); - cppProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.props")); - - auto import = new MSBuildImport(this); - import->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.targets")); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuildqbsgenerateproject.h b/src/lib/corelib/generators/visualstudio/msbuildqbsgenerateproject.h deleted file mode 100644 index 433bd31a1..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildqbsgenerateproject.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDQBSGENERATEPROJECT_H -#define MSBUILDQBSGENERATEPROJECT_H - -#include "msbuildtargetproject.h" - -#include <generators/generatordata.h> -#include <tools/visualstudioversioninfo.h> - -namespace qbs { - -class MSBuildQbsGenerateProject : public MSBuildTargetProject -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildQbsGenerateProject) -public: - MSBuildQbsGenerateProject(const GeneratableProject &project, - const Internal::VisualStudioVersionInfo &versionInfo, - VisualStudioGenerator *parent = 0); -}; - -} // namespace qbs - -#endif // MSBUILDQBSGENERATEPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuildqbsproductproject.cpp b/src/lib/corelib/generators/visualstudio/msbuildqbsproductproject.cpp deleted file mode 100644 index fc9187ae2..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildqbsproductproject.cpp +++ /dev/null @@ -1,425 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildqbsproductproject.h" - -#include "msbuild/msbuildimport.h" -#include "msbuild/msbuildimportgroup.h" -#include "msbuild/msbuilditemdefinitiongroup.h" -#include "msbuild/msbuilditemgroup.h" -#include "msbuild/msbuilditemmetadata.h" -#include "msbuild/msbuildproperty.h" -#include "msbuild/msbuildpropertygroup.h" - -#include "msbuild/items/msbuildclcompile.h" -#include "msbuild/items/msbuildclinclude.h" -#include "msbuild/items/msbuildlink.h" -#include "msbuild/items/msbuildnone.h" - -#include "msbuildutils.h" -#include "visualstudiogenerator.h" - -#include <api/runenvironment.h> -#include <tools/pathutils.h> -#include <tools/shellutils.h> -#include <tools/version.h> - -#include <QtCore/qdir.h> -#include <QtCore/quuid.h> - -namespace qbs { - -MSBuildQbsProductProject::MSBuildQbsProductProject( - const GeneratableProject &project, - const GeneratableProductData &product, - const Internal::VisualStudioVersionInfo &versionInfo, - VisualStudioGenerator *parent) - : MSBuildTargetProject(project, versionInfo, parent) -{ - Q_ASSERT(project.projects.size() == project.commandLines.size()); - Q_ASSERT(project.projects.size() == product.data.size()); - - const int count = std::max(project.projects.size(), product.data.size()); - - globalsPropertyGroup()->appendProperty(QStringLiteral("QbsProductName"), product.name()); - - MSBuildImport *cppDefaultProps = new MSBuildImport(this); - cppDefaultProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.Default.props")); - - for (int i = 0; i < count; ++i) { - addConfiguration( - project, - project.projects.values().at(i), - product.data.values().at(i), - project.commandLines.values().at(i)); - } - - MSBuildImport *cppProps = new MSBuildImport(this); - cppProps->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.props")); - - for (int i = 0; i < count; ++i) - addItemDefGroup(project.projects.values().at(i), product.data.values().at(i)); - - addFiles(project, product); -} - -static QString productTargetPath(const qbs::ProductData &productData) -{ - const QString fullPath = productData.targetExecutable(); - if (!fullPath.isEmpty()) - return QFileInfo(fullPath).absolutePath(); - return productData.properties().value(QStringLiteral("buildDirectory")).toString(); -} - -static bool listEnvironmentVariableContainsValue(const QString &environmentVariable, - const QString &value) -{ - return environmentVariable.contains(QLatin1Char(';') + value + QLatin1Char(';')) - || environmentVariable.startsWith(value + QLatin1Char(';')) - || environmentVariable.endsWith(QLatin1Char(';') + value); -} - -void MSBuildQbsProductProject::addConfiguration(const GeneratableProject &project, - const Project &buildTask, - const ProductData &productData, - const QStringList &buildConfigurationCommandLine) -{ - const auto targetDir = Internal::PathUtils::toNativeSeparators( - productTargetPath(productData), Internal::HostOsInfo::HostOsWindows); - - auto configurationDir = Internal::PathUtils::toNativeSeparators( - project.baseBuildDirectory().absolutePath() - + QLatin1Char('\\') - + MSBuildUtils::configurationName(buildTask), - Internal::HostOsInfo::HostOsWindows); - auto relativeTargetDir = targetDir; - if (targetDir.startsWith(configurationDir)) - relativeTargetDir = QStringLiteral("$(SolutionDir)$(Configuration)") - + relativeTargetDir.mid(configurationDir.size()); - - const auto properties = productData.moduleProperties(); - - const bool debugBuild = properties.getModuleProperty(QStringLiteral("qbs"), - QStringLiteral("debugInformation")) - .toBool(); - - const auto includePaths = QStringList() - << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), - QStringLiteral("includePaths")) - << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), - QStringLiteral("systemIncludePaths")); - const auto cppDefines = properties - .getModulePropertiesAsStringList(QStringLiteral("cpp"), QStringLiteral("defines")); - - const auto sep = Internal::HostOsInfo::pathListSeparator(Internal::HostOsInfo::HostOsWindows); - - auto propertyGroup1 = new MSBuildPropertyGroup(this); - propertyGroup1->setCondition(MSBuildUtils::buildTaskCondition(buildTask)); - propertyGroup1->setLabel(QStringLiteral("Configuration")); - propertyGroup1->appendProperty(QStringLiteral("UseDebugLibraries"), - debugBuild ? QStringLiteral("true") : QStringLiteral("false")); - - // General - General - // We need a trailing backslash for $(OutDir); See also the VS documentation: - // https://docs.microsoft.com/en-us/cpp/ide/common-macros-for-build-commands-and-properties - propertyGroup1->appendProperty(QStringLiteral("OutDir"), relativeTargetDir + QLatin1Char('\\')); - propertyGroup1->appendProperty(QStringLiteral("TargetName"), productData.targetName()); - propertyGroup1->appendProperty(QStringLiteral("PlatformToolset"), - versionInfo().platformToolsetVersion()); - propertyGroup1->appendProperty(QStringLiteral("ConfigurationType"), QStringLiteral("Makefile")); - - // VS possible values: Unicode|MultiByte|NotSet - propertyGroup1->appendProperty(QStringLiteral("CharacterSet"), - properties.getModuleProperty(QStringLiteral("cpp"), - QStringLiteral("windowsApiCharacterSet")) == QStringLiteral("unicode") - ? QStringLiteral("MultiByte") : QStringLiteral("NotSet")); - - // Debugging - propertyGroup1->appendProperty(QStringLiteral("DebuggerFlavor"), - QStringLiteral("WindowsLocalDebugger")); - propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerCommand"), - QStringLiteral("$(OutDir)$(TargetName)$(TargetExt)")); - propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerWorkingDirectory"), - QStringLiteral("$(OutDir)")); - - auto env = buildTask.getRunEnvironment(productData, project.installOptions, - QProcessEnvironment(), nullptr).runEnvironment(); - if (!env.isEmpty()) { - const auto systemEnv = QProcessEnvironment::systemEnvironment(); - for (const auto &key : systemEnv.keys()) { - if (!env.contains(key)) - continue; - - // Don't duplicate keys from the system environment - if (env.value(key) == systemEnv.value(key)) { - env.remove(key); - continue; - } - - // Cleverly concatenate list variables to avoid duplicating system environment - const QString systemValue = systemEnv.value(key); - QString overriddenValue = env.value(key); - if (listEnvironmentVariableContainsValue(overriddenValue, systemValue)) { - env.insert(key, overriddenValue.replace(systemValue, - QLatin1Char('%') + key + QLatin1Char('%'))); - } - - QString installRoot = project.installOptions.installRoot(); - if (!installRoot.isEmpty()) { - if (listEnvironmentVariableContainsValue(overriddenValue, installRoot)) { - env.insert(key, overriddenValue.replace(installRoot, - QStringLiteral("$(QbsInstallRoot)"))); - } - } else { - installRoot = Internal::PathUtils::toNativeSeparators( - QDir(buildTask.projectData().buildDirectory()).absoluteFilePath( - project.installOptions.defaultInstallRoot()), - Internal::HostOsInfo::HostOsWindows); - if (listEnvironmentVariableContainsValue(overriddenValue, installRoot)) { - env.insert(key, overriddenValue.replace(installRoot, - QStringLiteral("$(SolutionDir)$(Configuration)\\install-root"))); - } - } - } - - propertyGroup1->appendProperty(QStringLiteral("LocalDebuggerEnvironment"), - env.toStringList().join(QStringLiteral("\n"))); - } - - // NMake - General - // Skip configuration name, that's handled in qbs-shared.props - const auto params = Internal::shellQuote(buildConfigurationCommandLine.mid(1), - Internal::HostOsInfo::HostOsWindows); - propertyGroup1->appendProperty(QStringLiteral("NMakeBuildCommandLine"), - QStringLiteral("$(QbsBuildCommandLine) ") + params); - propertyGroup1->appendProperty(QStringLiteral("NMakeReBuildCommandLine"), - QStringLiteral("$(QbsReBuildCommandLine) ") + params); - propertyGroup1->appendProperty(QStringLiteral("NMakeCleanCommandLine"), - QStringLiteral("$(QbsCleanCommandLine) ") + params); - propertyGroup1->appendProperty(QStringLiteral("NMakeOutput"), - QStringLiteral("$(OutDir)$(TargetName)$(TargetExt)")); - - // NMake - IntelliSense - propertyGroup1->appendProperty(QStringLiteral("NMakePreprocessorDefinitions"), - cppDefines.join(sep)); - propertyGroup1->appendProperty(QStringLiteral("NMakeIncludeSearchPath"), - includePaths.join(sep)); -} - -static QString subsystemVersion(const QString &version) -{ - const auto v = Internal::Version::fromString(version); - return QStringLiteral("%1.%2").arg( - QString::number(v.majorVersion()), - QString::number(v.minorVersion()).rightJustified(2, QLatin1Char('0'))); -} - -void MSBuildQbsProductProject::addItemDefGroup(const Project &project, - const ProductData &productData) -{ - const auto properties = productData.moduleProperties(); - - const bool consoleApp = productData.properties().value(QStringLiteral("consoleApplication")) - .toBool(); - const bool debugBuild = properties.getModuleProperty(QStringLiteral("qbs"), - QStringLiteral("debugInformation")) - .toBool(); - const auto optimizationLevel = properties.getModuleProperty(QStringLiteral("qbs"), - QStringLiteral("optimization")) - .toString(); - const auto warningLevel = properties.getModuleProperty(QStringLiteral("qbs"), - QStringLiteral("warningLevel")) - .toString(); - - const auto includePaths = QStringList() - << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), - QStringLiteral("includePaths")) - << properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), - QStringLiteral("systemIncludePaths")); - const auto cppDefines = properties.getModulePropertiesAsStringList( - QStringLiteral("cpp"), QStringLiteral("defines")); - - const auto sep = Internal::HostOsInfo::pathListSeparator(Internal::HostOsInfo::HostOsWindows); - - auto itemDefGroup = new MSBuildItemDefinitionGroup(this); - itemDefGroup->setCondition(MSBuildUtils::buildTaskCondition(project)); - - auto compile = new MSBuildClCompile(itemDefGroup); - - // C++ - General - compile->appendProperty(QStringLiteral("AdditionalIncludeDirectories"), - includePaths.join(sep) - + sep - + QStringLiteral("%(AdditionalIncludeDirectories)")); - if (warningLevel == QStringLiteral("none")) - compile->appendProperty(QStringLiteral("WarningLevel"), - QStringLiteral("TurnOffAllWarnings")); - else if (warningLevel == QStringLiteral("all")) - compile->appendProperty(QStringLiteral("WarningLevel"), - QStringLiteral("EnableAllWarnings")); - else - compile->appendProperty(QStringLiteral("WarningLevel"), - QStringLiteral("Level3")); // this is VS default. - - // C++ - Optimization - compile->appendProperty(QStringLiteral("Optimization"), - optimizationLevel == QStringLiteral("none") - ? QStringLiteral("Disabled") - : QStringLiteral("MaxSpeed")); - - // C++ - Preprocessor - compile->appendProperty(QStringLiteral("PreprocessorDefinitions"), - cppDefines.join(sep) - + sep - + QStringLiteral("%(PreprocessorDefinitions)")); - - // C++ - Code Generation - compile->appendProperty(QStringLiteral("RuntimeLibrary"), debugBuild - ? QStringLiteral("MultiThreadedDebugDLL") - : QStringLiteral("MultiThreadedDLL")); - - auto link = new MSBuildLink(itemDefGroup); - - // Linker - General - link->appendProperty(QStringLiteral("AdditionalLibraryDirectories"), - properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), - QStringLiteral("libraryPaths")).join(sep)); - - // Linker - Input - link->appendProperty(QStringLiteral("AdditionalDependencies"), - properties.getModulePropertiesAsStringList(QStringLiteral("cpp"), - QStringLiteral("staticLibraries")).join(sep) - + sep + QStringLiteral("%(AdditionalDependencies)")); - - // Linker - Debugging - link->appendProperty(QStringLiteral("GenerateDebugInformation"), - debugBuild ? QStringLiteral("true") : QStringLiteral("false")); - - // Linker - System - link->appendProperty(QStringLiteral("SubSystem"), - consoleApp ? QStringLiteral("Console") : QStringLiteral("Windows")); - const auto subsysVersion = properties.getModuleProperty( - QStringLiteral("cpp"), QStringLiteral("minimumWindowsVersion")).toString(); - if (!subsysVersion.isEmpty()) - link->appendProperty(QStringLiteral("MinimumRequiredVersion"), - subsystemVersion(subsysVersion)); - - // Linker - Optimization - link->appendProperty(QStringLiteral("OptimizeReferences"), - debugBuild ? QStringLiteral("false") : QStringLiteral("true")); -} - -static MSBuildFileItem *fileItemForFileTags(const QList<QString> &fileTags, - IMSBuildItemGroup *parent = 0) -{ - const auto fileTagsSet = Internal::Set<QString>::fromList(fileTags); - if (fileTagsSet.intersects( - Internal::Set<QString> { QStringLiteral("hpp") })) - return new MSBuildClInclude(parent); - if (fileTagsSet.intersects( - Internal::Set<QString> { QStringLiteral("c"), QStringLiteral("cpp") })) - return new MSBuildClCompile(parent); - return new MSBuildNone(parent); -} - -void MSBuildQbsProductProject::addFiles(const GeneratableProject &project, - const GeneratableProductData &product) -{ - auto itemGroup = new MSBuildItemGroup(this); - - addQbsFile(project, product, itemGroup); - - std::map<QString, MSBuildFileItem *> sourceFileNodes; - std::map<QString, QStringList> sourceFileEnabledConfigurations; - - // Create a ClCompile item for each source file, keeping track of which configurations that - // file's containing group is enabled in - QMapIterator<QString, qbs::ProductData> productDataIt(product.data); - while (productDataIt.hasNext()) { - productDataIt.next(); - for (const auto &group : productDataIt.value().groups()) { - for (const auto &sourceArtifact : group.allSourceArtifacts()) { - const auto filePath = sourceArtifact.filePath(); - if (sourceFileNodes.find(filePath) == sourceFileNodes.end()) { - sourceFileNodes.insert({ - filePath, - fileItemForFileTags(sourceArtifact.fileTags(), itemGroup) - }); - } - auto fileItem = sourceFileNodes[filePath]; - QString path = project.baseBuildDirectory().relativeFilePath(filePath); - // The path still might not be relative (for example if the file item is - // located on a different drive) - if (QFileInfo(path).isRelative()) - path = QStringLiteral("$(ProjectDir)") + path; - fileItem->setFilePath(path); - if (group.isEnabled()) - sourceFileEnabledConfigurations[filePath] << productDataIt.key(); - } - } - } - - // Add ExcludedFromBuild item metadata to each file for each configuration - // where that file's containing group is disabled - for (const auto &sourceFileNode : sourceFileNodes) { - QMapIterator<QString, qbs::Project> projIt(project.projects); - while (projIt.hasNext()) { - projIt.next(); - if (!sourceFileEnabledConfigurations[sourceFileNode.first].contains(projIt.key())) { - auto metadata = new MSBuildItemMetadata( - QStringLiteral("ExcludedFromBuild"), - QStringLiteral("true"), - sourceFileNode.second); - metadata->setCondition(QStringLiteral("'$(Configuration)|$(Platform)'=='") - + MSBuildUtils::fullName(projIt.value()) - + QStringLiteral("'")); - } - } - } - - auto import = new MSBuildImport(this); - import->setProject(QStringLiteral("$(VCTargetsPath)\\Microsoft.Cpp.targets")); -} - -void MSBuildQbsProductProject::addQbsFile(const GeneratableProject &project, - const GeneratableProductData &product, - MSBuildItemGroup *itemGroup) -{ - auto fileItem = new MSBuildNone(itemGroup); - QString path = project.baseBuildDirectory().relativeFilePath(product.location().filePath()); - // The path still might not be relative (for example if the file item is - // located on a different drive) - if (QFileInfo(path).isRelative()) - path = QStringLiteral("$(ProjectDir)") + path; - fileItem->setFilePath(path); -} - - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuildqbsproductproject.h b/src/lib/corelib/generators/visualstudio/msbuildqbsproductproject.h deleted file mode 100644 index 7fb9e2a39..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildqbsproductproject.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDQBSPRODUCTPROJECT_H -#define MSBUILDQBSPRODUCTPROJECT_H - -#include "msbuildtargetproject.h" - -#include <generators/generatordata.h> -#include <tools/set.h> -#include <tools/visualstudioversioninfo.h> - -namespace qbs { - -class MSBuildImportGroup; -class MSBuildItemGroup; -class MSBuildProperty; - -class VisualStudioGenerator; - -class MSBuildQbsProductProject : public MSBuildTargetProject -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildQbsProductProject) -public: - MSBuildQbsProductProject(const GeneratableProject &project, - const GeneratableProductData &product, - const Internal::VisualStudioVersionInfo &versionInfo, - VisualStudioGenerator *parent = 0); - -private: - typedef QHash<QString, Internal::Set<Project>> ProjectConfigurations; - - void addConfiguration(const GeneratableProject &project, const Project &buildTask, - const ProductData &productData, - const QStringList &buildConfigurationCommandLine); - void addItemDefGroup(const Project &project, - const ProductData &productData); - void addFiles(const GeneratableProject &project, const GeneratableProductData &product); - void addQbsFile(const GeneratableProject &project, const GeneratableProductData &product, - MSBuildItemGroup *itemGroup); -}; - -} // namespace qbs - -#endif // MSBUILDQBSPRODUCTPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuildsharedsolutionpropertiesproject.cpp b/src/lib/corelib/generators/visualstudio/msbuildsharedsolutionpropertiesproject.cpp deleted file mode 100644 index d8389817f..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildsharedsolutionpropertiesproject.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildsharedsolutionpropertiesproject.h" - -#include "msbuild/msbuildpropertygroup.h" - -#include <tools/pathutils.h> -#include <tools/shellutils.h> - -#include <QtCore/qfileinfo.h> - -namespace qbs { - -static QString qbsCommandLine(const GeneratableProject &project, - const QString &subCommand, - const QString &qbsSettingsDir, - const Internal::VisualStudioVersionInfo &versionInfo) -{ - auto addEnvironmentVariableArgument = [&](Internal::CommandLine &cl, const QString &var) { - cl.appendRawArgument(QStringLiteral("\"$(%1)\"").arg(var)); - }; - - auto realSubCommand = subCommand; - if (subCommand == QStringLiteral("rebuild")) - realSubCommand = QStringLiteral("build"); - - // "path/to/qbs.exe" {build|clean} - // --settings-dir "path/to/settings/directory/" - // -f "path/to/project.qbs" -d "/build/directory/" - // -p product_name [[configuration key:value]...] - Internal::CommandLine commandLine; - commandLine.setProgram(QStringLiteral("\"$(QbsExecutablePath)\""), true); - commandLine.appendArgument(realSubCommand); - - if (!qbsSettingsDir.isEmpty()) { - commandLine.appendArgument(QStringLiteral("--settings-dir")); - addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsSettingsDir")); - } - - commandLine.appendArgument(QStringLiteral("-f")); - addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsProjectFile")); - commandLine.appendArgument(QStringLiteral("-d")); - addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsBuildDir")); - - if (subCommand == QStringLiteral("generate")) { - commandLine.appendArgument(QStringLiteral("-g")); - commandLine.appendArgument( - QString(QStringLiteral("visualstudio%1")).arg(versionInfo.marketingVersion())); - } else { - commandLine.appendArgument(QStringLiteral("-p")); - addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsProductName")); - - commandLine.appendArgument(QStringLiteral("--wait-lock")); - } - - if (realSubCommand == QStringLiteral("build") - && !project.installOptions.installRoot().isEmpty()) { - commandLine.appendArgument(QStringLiteral("--install-root")); - addEnvironmentVariableArgument(commandLine, QStringLiteral("QbsInstallRoot")); - } - - if (realSubCommand == QStringLiteral("build") && subCommand == QStringLiteral("rebuild")) { - commandLine.appendArgument(QStringLiteral("--check-timestamps")); - commandLine.appendArgument(QStringLiteral("--force-probe-execution")); - } - - addEnvironmentVariableArgument(commandLine, QStringLiteral("Configuration")); - - return commandLine.toCommandLine(Internal::HostOsInfo::HostOsWindows); -} - -MSBuildSharedSolutionPropertiesProject::MSBuildSharedSolutionPropertiesProject( - const Internal::VisualStudioVersionInfo &versionInfo, - const GeneratableProject &project, - const QFileInfo &qbsExecutable, - const QString &qbsSettingsDir) -{ - setDefaultTargets(QStringLiteral("Build")); - setToolsVersion(versionInfo.toolsVersion()); - - MSBuildPropertyGroup *group = new MSBuildPropertyGroup(this); - group->setLabel(QStringLiteral("UserMacros")); - - // Order's important here... a variable must be listed before one that uses it - group->appendProperty(QStringLiteral("QbsExecutablePath"), - QStringLiteral("$(QbsExecutableDir)") + qbsExecutable.fileName()); - if (!project.installOptions.installRoot().isEmpty()) { - group->appendProperty(QStringLiteral("QbsInstallRoot"), - Internal::PathUtils::toNativeSeparators( - project.installOptions.installRoot(), - Internal::HostOsInfo::HostOsWindows)); - } - - group->appendProperty(QStringLiteral("QbsProjectFile"), - QStringLiteral("$(QbsProjectDir)") - + project.filePath().fileName()); - - // Trailing '.' is not a typo. It prevents the trailing slash from combining with the closing - // quote to form an escape sequence. Unfortunately, Visual Studio expands variables *before* - // passing them to the underlying command shell, so there's not much we can do with regard to - // doing it "properly". Setting environment variables through MSBuild and using them in place - // of actual arguments does not work either, as Visual Studio apparently expands the environment - // variables as well, before passing them to the underlying shell. - group->appendProperty(QStringLiteral("QbsBuildDir"), - QStringLiteral("$(SolutionDir).")); - - group->appendProperty(QStringLiteral("QbsBuildCommandLine"), - qbsCommandLine(project, QStringLiteral("build"), - qbsSettingsDir, versionInfo)); - group->appendProperty(QStringLiteral("QbsReBuildCommandLine"), - qbsCommandLine(project, QStringLiteral("rebuild"), - qbsSettingsDir, versionInfo)); - group->appendProperty(QStringLiteral("QbsCleanCommandLine"), - qbsCommandLine(project, QStringLiteral("clean"), - qbsSettingsDir, versionInfo)); - group->appendProperty(QStringLiteral("QbsGenerateCommandLine"), - qbsCommandLine(project, QStringLiteral("generate"), - qbsSettingsDir, versionInfo)); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuildsharedsolutionpropertiesproject.h b/src/lib/corelib/generators/visualstudio/msbuildsharedsolutionpropertiesproject.h deleted file mode 100644 index f3848ce24..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildsharedsolutionpropertiesproject.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDSHAREDSOLUTIONPROPERTIESPROJECT_H -#define MSBUILDSHAREDSOLUTIONPROPERTIESPROJECT_H - -#include "msbuild/msbuildproject.h" - -#include <generators/generatordata.h> -#include <tools/visualstudioversioninfo.h> - -namespace qbs { - -class MSBuildSharedSolutionPropertiesProject : public MSBuildProject -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildSharedSolutionPropertiesProject) -public: - MSBuildSharedSolutionPropertiesProject(const Internal::VisualStudioVersionInfo &versionInfo, - const GeneratableProject &project, - const QFileInfo &qbsExecutable, const QString &qbsSettingsDir); -}; - -} // namespace qbs - -#endif // MSBUILDSHAREDSOLUTIONPROPERTIESPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuildsolutionpropertiesproject.cpp b/src/lib/corelib/generators/visualstudio/msbuildsolutionpropertiesproject.cpp deleted file mode 100644 index b0572e2e0..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildsolutionpropertiesproject.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildsolutionpropertiesproject.h" - -#include "msbuild/msbuildpropertygroup.h" - -#include <tools/pathutils.h> - -#include <QtCore/qfileinfo.h> - -namespace qbs { - -MSBuildSolutionPropertiesProject::MSBuildSolutionPropertiesProject( - const Internal::VisualStudioVersionInfo &versionInfo, - const GeneratableProject &project, - const QFileInfo &qbsExecutable, - const QString &qbsSettingsDir) -{ - setDefaultTargets(QStringLiteral("Build")); - setToolsVersion(versionInfo.toolsVersion()); - - auto group = new MSBuildPropertyGroup(this); - group->setLabel(QStringLiteral("UserMacros")); - - static const auto win = Internal::HostOsInfo::HostOsWindows; - - group->appendProperty(QStringLiteral("QbsExecutableDir"), - Internal::PathUtils::toNativeSeparators(qbsExecutable.path(), win) - + Internal::HostOsInfo::pathSeparator(win)); - group->appendProperty(QStringLiteral("QbsProjectDir"), - Internal::PathUtils::toNativeSeparators(project.filePath().path(), win) - + Internal::HostOsInfo::pathSeparator(win)); - - if (!qbsSettingsDir.isEmpty()) { - group->appendProperty(QStringLiteral("QbsSettingsDir"), - Internal::PathUtils::toNativeSeparators(qbsSettingsDir, win) - + Internal::HostOsInfo::pathSeparator(win) + QLatin1Char('.')); - } -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuildsolutionpropertiesproject.h b/src/lib/corelib/generators/visualstudio/msbuildsolutionpropertiesproject.h deleted file mode 100644 index 1c49f7901..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildsolutionpropertiesproject.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDSOLUTIONPROPERTIESPROJECT_H -#define MSBUILDSOLUTIONPROPERTIESPROJECT_H - -#include "msbuild/msbuildproject.h" - -#include <generators/generatordata.h> -#include <tools/visualstudioversioninfo.h> - -#include <QtCore/qfileinfo.h> - -namespace qbs { - -class MSBuildSolutionPropertiesProject : public MSBuildProject -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildSolutionPropertiesProject) -public: - MSBuildSolutionPropertiesProject(const Internal::VisualStudioVersionInfo &versionInfo, - const GeneratableProject &project, - const QFileInfo &qbsExecutable, - const QString &qbsSettingsDir); -}; - -} // namespace qbs - -#endif // MSBUILDSOLUTIONPROPERTIESPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuildtargetproject.cpp b/src/lib/corelib/generators/visualstudio/msbuildtargetproject.cpp deleted file mode 100644 index 9a1d00476..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildtargetproject.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildtargetproject.h" -#include "msbuildutils.h" -#include "visualstudiogenerator.h" - -#include "msbuild/msbuildimport.h" -#include "msbuild/msbuildimportgroup.h" -#include "msbuild/msbuilditem.h" -#include "msbuild/msbuilditemgroup.h" -#include "msbuild/msbuildproperty.h" -#include "msbuild/msbuildpropertygroup.h" - -namespace qbs { - -class MSBuildTargetProjectPrivate -{ -public: - MSBuildTargetProjectPrivate(const Internal::VisualStudioVersionInfo &versionInfo) - : versionInfo(versionInfo) {} - MSBuildPropertyGroup *globalsPropertyGroup; - MSBuildProperty *projectGuidProperty; - const Internal::VisualStudioVersionInfo &versionInfo; -}; - -MSBuildTargetProject::MSBuildTargetProject(const GeneratableProject &project, - const Internal::VisualStudioVersionInfo &versionInfo, - VisualStudioGenerator *parent) - : MSBuildProject(parent) - , d(new MSBuildTargetProjectPrivate(versionInfo)) -{ - setDefaultTargets(QStringLiteral("Build")); - setToolsVersion(versionInfo.toolsVersion()); - - auto projectConfigurationsGroup = new MSBuildItemGroup(this); - projectConfigurationsGroup->setLabel(QStringLiteral("ProjectConfigurations")); - - QMapIterator<QString, qbs::Project> it(project.projects); - while (it.hasNext()) { - it.next(); - auto item = new MSBuildItem(QStringLiteral("ProjectConfiguration"), - projectConfigurationsGroup); - item->setInclude(MSBuildUtils::fullName(it.value())); - item->appendProperty(QStringLiteral("Configuration"), it.key()); - item->appendProperty(QStringLiteral("Platform"), MSBuildUtils::platform(it.value())); - } - - d->globalsPropertyGroup = new MSBuildPropertyGroup(this); - d->globalsPropertyGroup->setLabel(QStringLiteral("Globals")); - d->projectGuidProperty = new MSBuildProperty(QStringLiteral("ProjectGuid"), - QUuid::createUuid().toString(), - d->globalsPropertyGroup); - - // Trigger creation of the property sheets ImportGroup - propertySheetsImportGroup(); -} - -MSBuildTargetProject::~MSBuildTargetProject() -{ -} - -const Internal::VisualStudioVersionInfo &MSBuildTargetProject::versionInfo() const -{ - return d->versionInfo; -} - -QUuid MSBuildTargetProject::guid() const -{ - return QUuid(d->projectGuidProperty->value().toString()); -} - -void MSBuildTargetProject::setGuid(const QUuid &guid) -{ - d->projectGuidProperty->setValue(guid.toString()); -} - -MSBuildPropertyGroup *MSBuildTargetProject::globalsPropertyGroup() -{ - return d->globalsPropertyGroup; -} - -MSBuildImportGroup *MSBuildTargetProject::propertySheetsImportGroup() -{ - MSBuildImportGroup *importGroup = nullptr; - for (const auto &child : children()) { - if (auto group = qobject_cast<MSBuildImportGroup *>(child)) { - if (group->label() == QStringLiteral("PropertySheets")) { - importGroup = group; - break; - } - } - } - - if (!importGroup) { - importGroup = new MSBuildImportGroup(this); - importGroup->setLabel(QStringLiteral("PropertySheets")); - } - - return importGroup; -} - -void MSBuildTargetProject::appendPropertySheet(const QString &path, bool optional) -{ - auto import = new MSBuildImport(propertySheetsImportGroup()); - import->setProject(path); - if (optional) - import->setCondition(QStringLiteral("Exists('%1')").arg(path)); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/msbuildtargetproject.h b/src/lib/corelib/generators/visualstudio/msbuildtargetproject.h deleted file mode 100644 index 13d890d72..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildtargetproject.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDTARGETPROJECT_H -#define MSBUILDTARGETPROJECT_H - -#include "msbuild/msbuildproject.h" - -#include <generators/generatordata.h> -#include <tools/visualstudioversioninfo.h> - -namespace qbs { - -class MSBuildImportGroup; -class MSBuildPropertyGroup; -class MSBuildTargetProjectPrivate; -class VisualStudioGenerator; - -class MSBuildTargetProject : public MSBuildProject -{ - Q_OBJECT - Q_DISABLE_COPY(MSBuildTargetProject) -protected: - MSBuildTargetProject(const GeneratableProject &project, - const Internal::VisualStudioVersionInfo &versionInfo, - VisualStudioGenerator *parent = 0); - -public: - ~MSBuildTargetProject(); - - const Internal::VisualStudioVersionInfo &versionInfo() const; - - QUuid guid() const; - void setGuid(const QUuid &guid); - - MSBuildPropertyGroup *globalsPropertyGroup(); - MSBuildImportGroup *propertySheetsImportGroup(); - void appendPropertySheet(const QString &path, bool optional = false); - -private: - QScopedPointer<MSBuildTargetProjectPrivate> d; -}; - -} // namespace qbs - -#endif // MSBUILDTARGETPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/msbuildutils.h b/src/lib/corelib/generators/visualstudio/msbuildutils.h deleted file mode 100644 index 3eceeba2e..000000000 --- a/src/lib/corelib/generators/visualstudio/msbuildutils.h +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef MSBUILDUTILS_H -#define MSBUILDUTILS_H - -#include <qbs.h> - -namespace qbs { - -class MSBuildUtils -{ -public: - static QString _qbsArchitecture(const qbs::Project &project) - { - return project.projectConfiguration() - .value(QStringLiteral("qbs")).toMap() - .value(QStringLiteral("architecture")).toString(); - } - - static const QString visualStudioArchitectureName(const QString &qbsArch, bool useDisplayName) - { - if (qbsArch == QStringLiteral("x86") && useDisplayName) - return qbsArch; - - // map of qbs architecture names to MSBuild architecture names - static const QMap<QString, QString> map { - {QStringLiteral("x86"), QStringLiteral("Win32")}, - {QStringLiteral("x86_64"), QStringLiteral("x64")}, - {QStringLiteral("ia64"), QStringLiteral("Itanium")}, - {QStringLiteral("arm"), QStringLiteral("ARM")}, - {QStringLiteral("arm64"), QStringLiteral("ARM64")} - }; - return map[qbsArch]; - } - - static QString configurationName(const qbs::Project &project) - { - return project.projectConfiguration() - .value(QStringLiteral("qbs")).toMap() - .value(QStringLiteral("configurationName")).toString(); - } - - static QString displayPlatform(const qbs::Project &project) - { - const auto architecture = _qbsArchitecture(project); - auto displayPlatform = visualStudioArchitectureName(architecture, true); - if (displayPlatform.isEmpty()) - displayPlatform = architecture; - return displayPlatform; - } - - static QString platform(const qbs::Project &project) - { - const auto architecture = _qbsArchitecture(project); - auto platform = visualStudioArchitectureName(architecture, false); - if (platform.isEmpty()) { - qWarning() << "WARNING: Unsupported architecture \"" - << architecture << "\"; using \"Win32\" platform."; - platform = QStringLiteral("Win32"); - } - - return platform; - } - - static QString fullDisplayName(const qbs::Project &project) - { - return QStringLiteral("%1|%2") - .arg(configurationName(project)) - .arg(displayPlatform(project)); - } - - static QString fullName(const qbs::Project &project) - { - return QStringLiteral("%1|%2").arg(configurationName(project)).arg(platform(project)); - } - - static QString buildTaskCondition(const Project &buildTask) - { - return QStringLiteral("'$(Configuration)|$(Platform)'=='") - + MSBuildUtils::fullName(buildTask) - + QStringLiteral("'"); - } -}; - -} // namespace qbs - -#endif // MSBUILDUTILS_H diff --git a/src/lib/corelib/generators/visualstudio/solution/ivisualstudiosolutionproject.cpp b/src/lib/corelib/generators/visualstudio/solution/ivisualstudiosolutionproject.cpp deleted file mode 100644 index f3a6a0cbd..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/ivisualstudiosolutionproject.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "ivisualstudiosolutionproject.h" - -namespace qbs { - -class IVisualStudioSolutionProjectPrivate -{ -public: - QUuid guid = QUuid::createUuid(); - QString name; - QString filePath; -}; - -IVisualStudioSolutionProject::IVisualStudioSolutionProject(QObject *parent) - : QObject(parent) - , d(new IVisualStudioSolutionProjectPrivate) -{ -} - -IVisualStudioSolutionProject::~IVisualStudioSolutionProject() -{ -} - -QUuid IVisualStudioSolutionProject::guid() const -{ - return d->guid; -} - -void IVisualStudioSolutionProject::setGuid(const QUuid &guid) -{ - d->guid = guid; -} - -QString IVisualStudioSolutionProject::name() const -{ - return d->name; -} - -void IVisualStudioSolutionProject::setName(const QString &name) -{ - d->name = name; -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/solution/ivisualstudiosolutionproject.h b/src/lib/corelib/generators/visualstudio/solution/ivisualstudiosolutionproject.h deleted file mode 100644 index 17de66e73..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/ivisualstudiosolutionproject.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef IVISUALSTUDIOSOLUTIONPROJECT_H -#define IVISUALSTUDIOSOLUTIONPROJECT_H - -#include <QtCore/qobject.h> -#include <QtCore/qscopedpointer.h> -#include <QtCore/qstring.h> -#include <QtCore/quuid.h> - -namespace qbs { - -class IVisualStudioSolutionProjectPrivate; - -class IVisualStudioSolutionProject : public QObject -{ - Q_OBJECT -protected: - explicit IVisualStudioSolutionProject(QObject *parent = 0); - -public: - virtual ~IVisualStudioSolutionProject(); - - virtual QUuid projectTypeGuid() const = 0; - - QUuid guid() const; - void setGuid(const QUuid &guid); - - virtual QString name() const; - void setName(const QString &name); - -private: - QScopedPointer<IVisualStudioSolutionProjectPrivate> d; -}; - -} // namespace qbs - -#endif // IVISUALSTUDIOSOLUTIONPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolution.cpp b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolution.cpp deleted file mode 100644 index a6d572425..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolution.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "visualstudiosolution.h" - -#include "visualstudiosolutionfileproject.h" -#include "visualstudiosolutionfolderproject.h" - -#include <tools/visualstudioversioninfo.h> - -#include <QtCore/qmap.h> - -namespace qbs { - -class VisualStudioSolutionPrivate -{ -public: - VisualStudioSolutionPrivate(const Internal::VisualStudioVersionInfo &versionInfo) - : versionInfo(versionInfo) { } - const Internal::VisualStudioVersionInfo versionInfo; - QList<IVisualStudioSolutionProject *> projects; - QMap<VisualStudioSolutionFileProject *, QList<VisualStudioSolutionFileProject *>> dependencies; - QList<VisualStudioSolutionGlobalSection *> globalSections; -}; - -VisualStudioSolution::VisualStudioSolution(const Internal::VisualStudioVersionInfo &versionInfo, - QObject *parent) - : QObject(parent) - , d(new VisualStudioSolutionPrivate(versionInfo)) -{ -} - -VisualStudioSolution::~VisualStudioSolution() -{ -} - -Internal::VisualStudioVersionInfo VisualStudioSolution::versionInfo() const -{ - return d->versionInfo; -} - -QList<IVisualStudioSolutionProject *> VisualStudioSolution::projects() const -{ - return d->projects; -} - -QList<VisualStudioSolutionFileProject *> VisualStudioSolution::fileProjects() const -{ - QList<VisualStudioSolutionFileProject *> list; - for (const auto &project : d->projects) - if (auto fileProject = qobject_cast<VisualStudioSolutionFileProject *>(project)) - list.append(fileProject); - return list; -} - -QList<VisualStudioSolutionFolderProject *> VisualStudioSolution::folderProjects() const -{ - QList<VisualStudioSolutionFolderProject *> list; - for (const auto &project : d->projects) - if (auto folderProject = qobject_cast<VisualStudioSolutionFolderProject *>(project)) - list.append(folderProject); - return list; -} - -void VisualStudioSolution::appendProject(IVisualStudioSolutionProject *project) -{ - d->projects.append(project); -} - -QList<VisualStudioSolutionFileProject *> VisualStudioSolution::dependencies( - VisualStudioSolutionFileProject *project) const -{ - return d->dependencies.value(project); -} - -void VisualStudioSolution::addDependency(VisualStudioSolutionFileProject *project, - VisualStudioSolutionFileProject *dependency) -{ - d->dependencies[project].append(dependency); -} - -QList<VisualStudioSolutionGlobalSection *> VisualStudioSolution::globalSections() const -{ - return d->globalSections; -} - -void VisualStudioSolution::appendGlobalSection(VisualStudioSolutionGlobalSection *globalSection) -{ - d->globalSections.append(globalSection); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolution.h b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolution.h deleted file mode 100644 index 16f06f9e9..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolution.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef VISUALSTUDIOSOLUTION_H -#define VISUALSTUDIOSOLUTION_H - -#include <QtCore/qobject.h> -#include <QtCore/qscopedpointer.h> - -namespace qbs { - -namespace Internal { class VisualStudioVersionInfo; } - -class MSBuildProject; - -class IVisualStudioSolutionProject; -class VisualStudioSolutionFileProject; -class VisualStudioSolutionFolderProject; -class VisualStudioSolutionGlobalSection; - -class VisualStudioSolutionPrivate; - -class VisualStudioSolution : public QObject -{ - Q_OBJECT - Q_DISABLE_COPY(VisualStudioSolution) -public: - explicit VisualStudioSolution(const Internal::VisualStudioVersionInfo &versionInfo, - QObject *parent = 0); - ~VisualStudioSolution(); - - Internal::VisualStudioVersionInfo versionInfo() const; - - QList<IVisualStudioSolutionProject *> projects() const; - QList<VisualStudioSolutionFileProject *> fileProjects() const; - QList<VisualStudioSolutionFolderProject *> folderProjects() const; - void appendProject(IVisualStudioSolutionProject *project); - void removeProject(const IVisualStudioSolutionProject *project); - void clearProjects(); - - QList<VisualStudioSolutionFileProject *> dependencies( - VisualStudioSolutionFileProject *project) const; - void addDependency(VisualStudioSolutionFileProject *project, - VisualStudioSolutionFileProject *dependency); - - QList<VisualStudioSolutionGlobalSection *> globalSections() const; - void appendGlobalSection(VisualStudioSolutionGlobalSection *globalSection); - -private: - void addDefaultGlobalSections(); - - QScopedPointer<VisualStudioSolutionPrivate> d; -}; - -} // namespace qbs - -#endif // VISUALSTUDIOSOLUTION_H diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfileproject.cpp b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfileproject.cpp deleted file mode 100644 index d66f47cf7..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfileproject.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "visualstudiosolutionfileproject.h" - -#include <QtCore/qfileinfo.h> - -namespace qbs { - -class VisualStudioSolutionFileProjectPrivate -{ -public: - QString filePath; -}; - -VisualStudioSolutionFileProject::VisualStudioSolutionFileProject(const QString &filePath, - QObject *parent) - : IVisualStudioSolutionProject(parent) - , d(new VisualStudioSolutionFileProjectPrivate) -{ - setFilePath(filePath); -} - -VisualStudioSolutionFileProject::~VisualStudioSolutionFileProject() -{ -} - -QString VisualStudioSolutionFileProject::name() const -{ - const auto projectName = IVisualStudioSolutionProject::name(); - if (projectName.isEmpty()) - return QFileInfo(filePath()).baseName(); - return projectName; -} - -QUuid VisualStudioSolutionFileProject::projectTypeGuid() const -{ - return QStringLiteral("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"); // C++ -} - -QString VisualStudioSolutionFileProject::filePath() const -{ - return d->filePath; -} - -void VisualStudioSolutionFileProject::setFilePath(const QString &filePath) -{ - d->filePath = filePath; -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfileproject.h b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfileproject.h deleted file mode 100644 index fafafa494..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfileproject.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef VISUALSTUDIOSOLUTIONFILEPROJECT_H -#define VISUALSTUDIOSOLUTIONFILEPROJECT_H - -#include <QtCore/qobject.h> -#include "ivisualstudiosolutionproject.h" - -namespace qbs { - -class VisualStudioSolutionFileProjectPrivate; - -class VisualStudioSolutionFileProject : public IVisualStudioSolutionProject -{ - Q_OBJECT -public: - explicit VisualStudioSolutionFileProject(const QString &filePath, QObject *parent = 0); - ~VisualStudioSolutionFileProject(); - - QString name() const override; - - QString filePath() const; - void setFilePath(const QString &filePath); - - QUuid projectTypeGuid() const override; - -private: - QScopedPointer<VisualStudioSolutionFileProjectPrivate> d; -}; - -} // namespace qbs - -#endif // VISUALSTUDIOSOLUTIONFILEPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfolderproject.cpp b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfolderproject.cpp deleted file mode 100644 index d59d1e1ed..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfolderproject.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "visualstudiosolutionfolderproject.h" - -#include <QtCore/qfileinfo.h> - -namespace qbs { - -VisualStudioSolutionFolderProject::VisualStudioSolutionFolderProject(QObject *parent) - : IVisualStudioSolutionProject(parent) -{ -} - -QUuid VisualStudioSolutionFolderProject::projectTypeGuid() const -{ - return QStringLiteral("{2150E333-8FDC-42A3-9474-1A3956D46DE8}"); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfolderproject.h b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfolderproject.h deleted file mode 100644 index a7fd180cc..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionfolderproject.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef VISUALSTUDIOSOLUTIONFOLDERPROJECT_H -#define VISUALSTUDIOSOLUTIONFOLDERPROJECT_H - -#include <QtCore/qobject.h> -#include "ivisualstudiosolutionproject.h" - -namespace qbs { - -class VisualStudioSolutionFolderProject : public IVisualStudioSolutionProject -{ - Q_OBJECT -public: - explicit VisualStudioSolutionFolderProject(QObject *parent); - - QUuid projectTypeGuid() const override; -}; - -} // namespace qbs - -#endif // VISUALSTUDIOSOLUTIONFOLDERPROJECT_H diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionglobalsection.cpp b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionglobalsection.cpp deleted file mode 100644 index 1e4f5fd01..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionglobalsection.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "visualstudiosolutionglobalsection.h" - -#include <utility> -#include <vector> - -namespace qbs { - -class VisualStudioSolutionGlobalSectionPrivate -{ -public: - QString name; - std::vector<std::pair<QString, QString>> properties; - bool post = false; -}; - -VisualStudioSolutionGlobalSection::VisualStudioSolutionGlobalSection(const QString &name, - QObject *parent) - : QObject(parent) - , d(new VisualStudioSolutionGlobalSectionPrivate) -{ - setName(name); -} - -VisualStudioSolutionGlobalSection::~VisualStudioSolutionGlobalSection() -{ -} - -QString VisualStudioSolutionGlobalSection::name() const -{ - return d->name; -} - -void VisualStudioSolutionGlobalSection::setName(const QString &name) -{ - d->name = name; -} - -bool VisualStudioSolutionGlobalSection::isPost() const -{ - return d->post; -} - -void VisualStudioSolutionGlobalSection::setPost(bool post) -{ - d->post = post; -} - -std::vector<std::pair<QString, QString> > VisualStudioSolutionGlobalSection::properties() const -{ - return d->properties; -} - -void VisualStudioSolutionGlobalSection::appendProperty(const QString &key, const QString &value) -{ - d->properties.push_back({ key, value }); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionglobalsection.h b/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionglobalsection.h deleted file mode 100644 index dd821fce0..000000000 --- a/src/lib/corelib/generators/visualstudio/solution/visualstudiosolutionglobalsection.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef VISUALSTUDIOSOLUTIONGLOBALSECTION_H -#define VISUALSTUDIOSOLUTIONGLOBALSECTION_H - -#include <QtCore/qobject.h> -#include <QtCore/qscopedpointer.h> - -namespace qbs { - -class VisualStudioSolutionGlobalSectionPrivate; - -class VisualStudioSolutionGlobalSection : public QObject -{ - Q_OBJECT - Q_DISABLE_COPY(VisualStudioSolutionGlobalSection) -public: - explicit VisualStudioSolutionGlobalSection(const QString &name, QObject *parent = 0); - ~VisualStudioSolutionGlobalSection(); - - QString name() const; - void setName(const QString &name); - - bool isPost() const; - void setPost(bool post); - - std::vector<std::pair<QString, QString> > properties() const; - void appendProperty(const QString &key, const QString &value); - -private: - QScopedPointer<VisualStudioSolutionGlobalSectionPrivate> d; -}; - -} // namespace qbs - -#endif // VISUALSTUDIOSOLUTIONGLOBALSECTION_H diff --git a/src/lib/corelib/generators/visualstudio/visualstudio.pri b/src/lib/corelib/generators/visualstudio/visualstudio.pri deleted file mode 100644 index e7615d8cd..000000000 --- a/src/lib/corelib/generators/visualstudio/visualstudio.pri +++ /dev/null @@ -1,87 +0,0 @@ -HEADERS += \ - $$PWD/msbuildfiltersproject.h \ - $$PWD/msbuildqbsgenerateproject.h \ - $$PWD/msbuildqbsproductproject.h \ - $$PWD/msbuildsharedsolutionpropertiesproject.h \ - $$PWD/msbuildsolutionpropertiesproject.h \ - $$PWD/msbuildtargetproject.h \ - $$PWD/msbuildutils.h \ - $$PWD/visualstudiogenerator.h \ - $$PWD/visualstudioguidpool.h - -SOURCES += \ - $$PWD/msbuildfiltersproject.cpp \ - $$PWD/msbuildqbsgenerateproject.cpp \ - $$PWD/msbuildqbsproductproject.cpp \ - $$PWD/msbuildsharedsolutionpropertiesproject.cpp \ - $$PWD/msbuildsolutionpropertiesproject.cpp \ - $$PWD/msbuildtargetproject.cpp \ - $$PWD/visualstudiogenerator.cpp \ - $$PWD/visualstudioguidpool.cpp - -HEADERS += \ - $$PWD/solution/ivisualstudiosolutionproject.h \ - $$PWD/solution/visualstudiosolutionfileproject.h \ - $$PWD/solution/visualstudiosolutionfolderproject.h \ - $$PWD/solution/visualstudiosolution.h \ - $$PWD/solution/visualstudiosolutionglobalsection.h \ - -SOURCES += \ - $$PWD/solution/ivisualstudiosolutionproject.cpp \ - $$PWD/solution/visualstudiosolutionfileproject.cpp \ - $$PWD/solution/visualstudiosolutionfolderproject.cpp \ - $$PWD/solution/visualstudiosolution.cpp \ - $$PWD/solution/visualstudiosolutionglobalsection.cpp - -HEADERS += \ - $$PWD/msbuild/imsbuildgroup.h \ - $$PWD/msbuild/imsbuildnode.h \ - $$PWD/msbuild/imsbuildnodevisitor.h \ - $$PWD/msbuild/imsbuildproperty.h \ - $$PWD/msbuild/msbuildimport.h \ - $$PWD/msbuild/msbuildimportgroup.h \ - $$PWD/msbuild/msbuilditem.h \ - $$PWD/msbuild/msbuilditemdefinitiongroup.h \ - $$PWD/msbuild/msbuilditemgroup.h \ - $$PWD/msbuild/msbuilditemmetadata.h \ - $$PWD/msbuild/msbuildproject.h \ - $$PWD/msbuild/msbuildproperty.h \ - $$PWD/msbuild/msbuildpropertygroup.h - -SOURCES += \ - $$PWD/msbuild/imsbuildgroup.cpp \ - $$PWD/msbuild/imsbuildnode.cpp \ - $$PWD/msbuild/imsbuildproperty.cpp \ - $$PWD/msbuild/msbuildimport.cpp \ - $$PWD/msbuild/msbuildimportgroup.cpp \ - $$PWD/msbuild/msbuilditem.cpp \ - $$PWD/msbuild/msbuilditemdefinitiongroup.cpp \ - $$PWD/msbuild/msbuilditemgroup.cpp \ - $$PWD/msbuild/msbuilditemmetadata.cpp \ - $$PWD/msbuild/msbuildproject.cpp \ - $$PWD/msbuild/msbuildproperty.cpp \ - $$PWD/msbuild/msbuildpropertygroup.cpp - -HEADERS += \ - $$PWD/msbuild/items/msbuildclcompile.h \ - $$PWD/msbuild/items/msbuildclinclude.h \ - $$PWD/msbuild/items/msbuildfileitem.h \ - $$PWD/msbuild/items/msbuildfilter.h \ - $$PWD/msbuild/items/msbuildlink.h \ - $$PWD/msbuild/items/msbuildnone.h - -SOURCES += \ - $$PWD/msbuild/items/msbuildclcompile.cpp \ - $$PWD/msbuild/items/msbuildclinclude.cpp \ - $$PWD/msbuild/items/msbuildfileitem.cpp \ - $$PWD/msbuild/items/msbuildfilter.cpp \ - $$PWD/msbuild/items/msbuildlink.cpp \ - $$PWD/msbuild/items/msbuildnone.cpp - -HEADERS += \ - $$PWD/io/msbuildprojectwriter.h \ - $$PWD/io/visualstudiosolutionwriter.h - -SOURCES += \ - $$PWD/io/msbuildprojectwriter.cpp \ - $$PWD/io/visualstudiosolutionwriter.cpp diff --git a/src/lib/corelib/generators/visualstudio/visualstudio.qbs b/src/lib/corelib/generators/visualstudio/visualstudio.qbs deleted file mode 100644 index 44694d8d2..000000000 --- a/src/lib/corelib/generators/visualstudio/visualstudio.qbs +++ /dev/null @@ -1,112 +0,0 @@ -import qbs - -QbsLibrary { - type: ["staticlibrary"] - name: "visualstudiogenerator" - install: false - - cpp.includePaths: base.concat([ - "../..", - ]) - - Depends { name: "cpp" } - Depends { name: "Qt.core" } - - Group { - name: "Visual Studio generator" - files: [ - "msbuildfiltersproject.cpp", - "msbuildfiltersproject.h", - "msbuildqbsgenerateproject.cpp", - "msbuildqbsgenerateproject.h", - "msbuildqbsproductproject.cpp", - "msbuildqbsproductproject.h", - "msbuildsharedsolutionpropertiesproject.cpp", - "msbuildsharedsolutionpropertiesproject.h", - "msbuildsolutionpropertiesproject.cpp", - "msbuildsolutionpropertiesproject.h", - "msbuildtargetproject.cpp", - "msbuildtargetproject.h", - "msbuildutils.h", - "visualstudiogenerator.cpp", - "visualstudiogenerator.h", - "visualstudioguidpool.cpp", - "visualstudioguidpool.h", - ] - } - Group { - name: "Solution Object Model" - prefix: "solution/" - files: [ - "ivisualstudiosolutionproject.cpp", - "ivisualstudiosolutionproject.h", - "visualstudiosolutionfileproject.cpp", - "visualstudiosolutionfileproject.h", - "visualstudiosolutionfolderproject.cpp", - "visualstudiosolutionfolderproject.h", - "visualstudiosolution.cpp", - "visualstudiosolution.h", - "visualstudiosolutionglobalsection.cpp", - "visualstudiosolutionglobalsection.h", - ] - } - Group { - name: "MSBuild Object Model" - prefix: "msbuild/" - files: [ - "imsbuildgroup.cpp", - "imsbuildgroup.h", - "imsbuildnode.cpp", - "imsbuildnode.h", - "imsbuildnodevisitor.h", - "imsbuildproperty.cpp", - "imsbuildproperty.h", - "msbuildimport.cpp", - "msbuildimport.h", - "msbuildimportgroup.cpp", - "msbuildimportgroup.h", - "msbuilditem.cpp", - "msbuilditem.h", - "msbuilditemdefinitiongroup.cpp", - "msbuilditemdefinitiongroup.h", - "msbuilditemgroup.cpp", - "msbuilditemgroup.h", - "msbuilditemmetadata.cpp", - "msbuilditemmetadata.h", - "msbuildproject.cpp", - "msbuildproject.h", - "msbuildproperty.cpp", - "msbuildproperty.h", - "msbuildpropertygroup.cpp", - "msbuildpropertygroup.h", - ] - } - Group { - name: "MSBuild Object Model Items" - prefix: "msbuild/items/" - files: [ - "msbuildclcompile.cpp", - "msbuildclcompile.h", - "msbuildclinclude.cpp", - "msbuildclinclude.h", - "msbuildfileitem.cpp", - "msbuildfileitem.h", - "msbuildfilter.cpp", - "msbuildfilter.h", - "msbuildlink.cpp", - "msbuildlink.h", - "msbuildnone.cpp", - "msbuildnone.h", - ] - } - Group { - name: "Visual Studio Object Model I/O" - prefix: "io/" - files: [ - "msbuildprojectwriter.cpp", - "msbuildprojectwriter.h", - "visualstudiosolutionwriter.cpp", - "visualstudiosolutionwriter.h", - ] - } -} diff --git a/src/lib/corelib/generators/visualstudio/visualstudiogenerator.cpp b/src/lib/corelib/generators/visualstudio/visualstudiogenerator.cpp deleted file mode 100644 index e2f2c2ddc..000000000 --- a/src/lib/corelib/generators/visualstudio/visualstudiogenerator.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "msbuildfiltersproject.h" -#include "msbuildqbsgenerateproject.h" -#include "msbuildsharedsolutionpropertiesproject.h" -#include "msbuildsolutionpropertiesproject.h" -#include "msbuildqbsproductproject.h" -#include "msbuildutils.h" -#include "visualstudiogenerator.h" -#include "visualstudioguidpool.h" - -#include "msbuild/msbuildpropertygroup.h" -#include "msbuild/msbuildproject.h" - -#include "solution/visualstudiosolution.h" -#include "solution/visualstudiosolutionfileproject.h" -#include "solution/visualstudiosolutionglobalsection.h" -#include "solution/visualstudiosolutionfolderproject.h" - -#include "io/msbuildprojectwriter.h" -#include "io/visualstudiosolutionwriter.h" - -#include <generators/generatableprojectiterator.h> -#include <logging/translator.h> -#include <tools/filesaver.h> -#include <tools/qbsassert.h> -#include <tools/shellutils.h> -#include <tools/visualstudioversioninfo.h> - -#include <QtCore/qcoreapplication.h> -#include <QtCore/qdebug.h> -#include <QtCore/qdir.h> -#include <QtCore/qfile.h> -#include <QtCore/qfileinfo.h> - -namespace qbs { - -using namespace Internal; - -class VisualStudioGeneratorPrivate -{ - friend class SolutionDependenciesVisitor; -public: - VisualStudioGeneratorPrivate(const Internal::VisualStudioVersionInfo &versionInfo) - : versionInfo(versionInfo) {} - - Internal::VisualStudioVersionInfo versionInfo; - - std::shared_ptr<VisualStudioGuidPool> guidPool; - std::shared_ptr<VisualStudioSolution> solution; - QString solutionFilePath; - QMap<QString, std::shared_ptr<MSBuildProject>> msbuildProjects; - QMap<QString, VisualStudioSolutionFileProject *> solutionProjects; - QMap<GeneratableProjectData::Id, VisualStudioSolutionFolderProject *> solutionFolders; - QList<std::pair<QString, bool>> propertySheetNames; - - void reset(); -}; - -void VisualStudioGeneratorPrivate::reset() -{ - guidPool.reset(); - solution.reset(); - solutionFilePath.clear(); - msbuildProjects.clear(); - solutionProjects.clear(); - solutionFolders.clear(); - propertySheetNames.clear(); -} - -class SolutionDependenciesVisitor : public IGeneratableProjectVisitor -{ -public: - SolutionDependenciesVisitor(VisualStudioGenerator *generator) - : generator(generator) { - } - - void visitProject(const GeneratableProject &project) override { - Q_UNUSED(project); - nestedProjects = new VisualStudioSolutionGlobalSection( - QStringLiteral("NestedProjects"), generator->d->solution.get()); - generator->d->solution->appendGlobalSection(nestedProjects); - } - - void visitProjectData(const GeneratableProject &project, - const GeneratableProjectData &parentProjectData, - const GeneratableProjectData &projectData) override { - Q_UNUSED(project); - // The root project will have a null GeneratableProjectData - // as its parent object (so skip giving it a parent folder) - if (!parentProjectData.name().isEmpty()) { - nestedProjects->appendProperty( - generator->d->solutionFolders.value(projectData.uniqueName())->guid() - .toString(), - generator->d->solutionFolders.value(parentProjectData.uniqueName())->guid() - .toString()); - } - } - - void visitProduct(const GeneratableProject &project, - const GeneratableProjectData &projectData, - const GeneratableProductData &productData) override { - Q_UNUSED(project); - Q_UNUSED(projectData); - for (const auto &dep : productData.dependencies()) { - generator->d->solution->addDependency( - generator->d->solutionProjects.value(productData.name()), - generator->d->solutionProjects.value(dep)); - } - - nestedProjects->appendProperty( - generator->d->solutionProjects.value(productData.name())->guid().toString(), - generator->d->solutionFolders.value(projectData.uniqueName())->guid() - .toString()); - } - -private: - VisualStudioGenerator *generator; - VisualStudioSolutionGlobalSection *nestedProjects; -}; - -VisualStudioGenerator::VisualStudioGenerator(const VisualStudioVersionInfo &versionInfo) - : d(new VisualStudioGeneratorPrivate(versionInfo)) -{ - if (d->versionInfo.usesVcBuild()) - throw ErrorInfo(Tr::tr("VCBuild (Visual Studio 2008 and below) is not supported")); - else if (!d->versionInfo.usesMsBuild()) - throw ErrorInfo(Tr::tr("Unknown/unsupported build engine")); - Q_ASSERT(d->versionInfo.usesSolutions()); -} - -VisualStudioGenerator::~VisualStudioGenerator() -{ -} - -QString VisualStudioGenerator::generatorName() const -{ - return QStringLiteral("visualstudio%1").arg(d->versionInfo.marketingVersion()); -} - -void VisualStudioGenerator::addPropertySheets(const GeneratableProject &project) -{ - { - const auto fileName = QStringLiteral("qbs.props"); - d->propertySheetNames.append({ fileName, true }); - d->msbuildProjects.insert(project.baseBuildDirectory().absoluteFilePath(fileName), - std::make_shared<MSBuildSolutionPropertiesProject>( - d->versionInfo, project, - qbsExecutableFilePath(), qbsSettingsDir())); - } - - { - const auto fileName = QStringLiteral("qbs-shared.props"); - d->propertySheetNames.append({ fileName, false }); - d->msbuildProjects.insert(project.baseBuildDirectory().absoluteFilePath(fileName), - std::make_shared<MSBuildSharedSolutionPropertiesProject>( - d->versionInfo, project, - qbsExecutableFilePath(), qbsSettingsDir())); - } -} - -void VisualStudioGenerator::addPropertySheets( - const std::shared_ptr<MSBuildTargetProject> &targetProject) -{ - for (const auto &pair : d->propertySheetNames) { - targetProject->appendPropertySheet( - QStringLiteral("$(SolutionDir)\\") + pair.first, pair.second); - } -} - -static QString targetFilePath(const QString &baseName, const QString &baseBuildDirectory) -{ - return QDir(baseBuildDirectory).absoluteFilePath(baseName + QStringLiteral(".vcxproj")); -} - -static QString targetFilePath(const GeneratableProductData &product, - const QString &baseBuildDirectory) -{ - return targetFilePath(product.name(), baseBuildDirectory); -} - -static void addDefaultGlobalSections(const GeneratableProject &topLevelProject, - VisualStudioSolution *solution) -{ - auto configurationPlatformsSection = new VisualStudioSolutionGlobalSection( - QStringLiteral("SolutionConfigurationPlatforms"), solution); - solution->appendGlobalSection(configurationPlatformsSection); - for (const auto &qbsProject : topLevelProject.projects) - configurationPlatformsSection->appendProperty(MSBuildUtils::fullName(qbsProject), - MSBuildUtils::fullName(qbsProject)); - - auto projectConfigurationPlatformsSection = new VisualStudioSolutionGlobalSection( - QStringLiteral("ProjectConfigurationPlatforms"), solution); - solution->appendGlobalSection(projectConfigurationPlatformsSection); - projectConfigurationPlatformsSection->setPost(true); - for (const auto project : solution->projects()) { - for (const auto &qbsProject : topLevelProject.projects) { - projectConfigurationPlatformsSection->appendProperty( - QStringLiteral("%1.%2.ActiveCfg") - .arg(project->guid().toString()) - .arg(MSBuildUtils::fullDisplayName(qbsProject)), - MSBuildUtils::fullName(qbsProject)); - projectConfigurationPlatformsSection->appendProperty( - QStringLiteral("%1.%2.Build.0") - .arg(project->guid().toString()) - .arg(MSBuildUtils::fullDisplayName(qbsProject)), - MSBuildUtils::fullName(qbsProject)); - } - } - - auto solutionPropsSection = new VisualStudioSolutionGlobalSection( - QStringLiteral("SolutionProperties"), solution); - solution->appendGlobalSection(solutionPropsSection); - solutionPropsSection->appendProperty(QStringLiteral("HideSolutionNode"), - QStringLiteral("FALSE")); -} - -static void writeProjectFiles(const QMap<QString, std::shared_ptr<MSBuildProject>> &projects) -{ - // Write out all the MSBuild project files to disk - QMapIterator<QString, std::shared_ptr<MSBuildProject>> it(projects); - while (it.hasNext()) { - it.next(); - const auto projectFilePath = it.key(); - Internal::FileSaver file(projectFilePath); - if (!file.open()) - throw ErrorInfo(Tr::tr("Cannot open %s for writing").arg(projectFilePath)); - - std::shared_ptr<MSBuildProject> project = it.value(); - MSBuildProjectWriter writer(file.device()); - if (!(writer.write(project.get()) && file.commit())) - throw ErrorInfo(Tr::tr("Failed to generate %1").arg(projectFilePath)); - } -} - -static void writeSolution(const std::shared_ptr<VisualStudioSolution> &solution, - const QString &solutionFilePath) -{ - Internal::FileSaver file(solutionFilePath); - if (!file.open()) - throw ErrorInfo(Tr::tr("Cannot open %s for writing").arg(solutionFilePath)); - - VisualStudioSolutionWriter writer(file.device()); - writer.setProjectBaseDirectory(QFileInfo(solutionFilePath).path()); - if (!(writer.write(solution.get()) && file.commit())) - throw ErrorInfo(Tr::tr("Failed to generate %1").arg(solutionFilePath)); - - qDebug() << "Generated" << qPrintable(QFileInfo(solutionFilePath).fileName()); -} - -void VisualStudioGenerator::generate() -{ - GeneratableProjectIterator it(project()); - it.accept(this); - - addDefaultGlobalSections(project(), d->solution.get()); - - // Second pass: connection solution project interdependencies and project nesting hierarchy - SolutionDependenciesVisitor solutionDependenciesVisitor(this); - it.accept(&solutionDependenciesVisitor); - - writeProjectFiles(d->msbuildProjects); - writeSolution(d->solution, d->solutionFilePath); - - d->reset(); -} - -std::vector<std::shared_ptr<ProjectGenerator> > VisualStudioGenerator::createGeneratorList() -{ - std::vector<std::shared_ptr<ProjectGenerator> > result; - for (const auto &info : VisualStudioVersionInfo::knownVersions()) { - if (info.usesMsBuild()) - result.push_back(std::make_shared<VisualStudioGenerator>(info)); - } - return result; -} - -void VisualStudioGenerator::visitProject(const GeneratableProject &project) -{ - addPropertySheets(project); - - const auto buildDir = project.baseBuildDirectory(); - - d->guidPool = std::make_shared<VisualStudioGuidPool>( - buildDir.absoluteFilePath(project.name() + QStringLiteral(".guid.txt"))); - - d->solutionFilePath = buildDir.absoluteFilePath(project.name() + QStringLiteral(".sln")); - d->solution = std::make_shared<VisualStudioSolution>(d->versionInfo); - - // Create a helper project to re-run qbs generate - const auto qbsGenerate = QStringLiteral("qbs-generate"); - const auto projectFilePath = targetFilePath(qbsGenerate, buildDir.absolutePath()); - const auto relativeProjectFilePath = QFileInfo(d->solutionFilePath).dir() - .relativeFilePath(projectFilePath); - auto targetProject = std::make_shared<MSBuildQbsGenerateProject>(project, d->versionInfo); - targetProject->setGuid(d->guidPool->drawProductGuid(relativeProjectFilePath)); - d->msbuildProjects.insert(projectFilePath, targetProject); - - addPropertySheets(targetProject); - - auto solutionProject = new VisualStudioSolutionFileProject( - targetFilePath(qbsGenerate, project.baseBuildDirectory().absolutePath()), - d->solution.get()); - solutionProject->setGuid(targetProject->guid()); - d->solution->appendProject(solutionProject); - d->solutionProjects.insert(qbsGenerate, solutionProject); -} - -void VisualStudioGenerator::visitProjectData(const GeneratableProject &project, - const GeneratableProjectData &projectData) -{ - Q_UNUSED(project); - auto solutionFolder = new VisualStudioSolutionFolderProject(d->solution.get()); - solutionFolder->setName(projectData.name()); - d->solution->appendProject(solutionFolder); - QBS_CHECK(!d->solutionFolders.contains(projectData.uniqueName())); - d->solutionFolders.insert(projectData.uniqueName(), solutionFolder); -} - -void VisualStudioGenerator::visitProduct(const GeneratableProject &project, - const GeneratableProjectData &projectData, - const GeneratableProductData &productData) -{ - Q_UNUSED(projectData); - const auto projectFilePath = targetFilePath(productData, - project.baseBuildDirectory().absolutePath()); - const auto relativeProjectFilePath = QFileInfo(d->solutionFilePath) - .dir().relativeFilePath(projectFilePath); - auto targetProject = std::make_shared<MSBuildQbsProductProject>(project, productData, - d->versionInfo); - targetProject->setGuid(d->guidPool->drawProductGuid(relativeProjectFilePath)); - - addPropertySheets(targetProject); - - d->msbuildProjects.insert(projectFilePath, targetProject); - d->msbuildProjects.insert(projectFilePath + QStringLiteral(".filters"), - std::make_shared<MSBuildFiltersProject>(productData)); - - auto solutionProject = new VisualStudioSolutionFileProject( - targetFilePath(productData, project.baseBuildDirectory().absolutePath()), - d->solution.get()); - solutionProject->setGuid(targetProject->guid()); - d->solution->appendProject(solutionProject); - d->solutionProjects.insert(productData.name(), solutionProject); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/visualstudiogenerator.h b/src/lib/corelib/generators/visualstudio/visualstudiogenerator.h deleted file mode 100644 index 5c1d37695..000000000 --- a/src/lib/corelib/generators/visualstudio/visualstudiogenerator.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QBS_VISUALSTUDIOGENERATOR_H -#define QBS_VISUALSTUDIOGENERATOR_H - -#include <generators/generator.h> -#include <generators/igeneratableprojectvisitor.h> -#include <tools/visualstudioversioninfo.h> -#include "visualstudioguidpool.h" - -#include <QtCore/qfileinfo.h> -#include <QtCore/qdir.h> -#include <QtCore/qmap.h> - -namespace qbs { - -namespace Internal { class VisualStudioVersionInfo; } - -class MSBuildProject; -class MSBuildTargetProject; - -class VisualStudioGeneratorPrivate; -class VisualStudioSolution; -class VisualStudioSolutionFileProject; -class VisualStudioSolutionFolderProject; - -class VisualStudioGenerator : public ProjectGenerator, private IGeneratableProjectVisitor -{ - friend class SolutionDependenciesVisitor; -public: - explicit VisualStudioGenerator(const Internal::VisualStudioVersionInfo &versionInfo); - ~VisualStudioGenerator(); - QString generatorName() const override; - void generate() override; - - static std::vector<std::shared_ptr<ProjectGenerator> > createGeneratorList(); - -private: - virtual void visitProject(const GeneratableProject &project) override; - virtual void visitProjectData(const GeneratableProject &project, - const GeneratableProjectData &projectData) override; - virtual void visitProduct(const GeneratableProject &project, - const GeneratableProjectData &projectData, - const GeneratableProductData &productData) override; - - void addPropertySheets(const GeneratableProject &project); - void addPropertySheets(const std::shared_ptr<MSBuildTargetProject> &targetProject); - - QScopedPointer<VisualStudioGeneratorPrivate> d; -}; - -} // namespace qbs - -#endif // QBS_VISUALSTUDIOGENERATOR_H diff --git a/src/lib/corelib/generators/visualstudio/visualstudioguidpool.cpp b/src/lib/corelib/generators/visualstudio/visualstudioguidpool.cpp deleted file mode 100644 index 543d64063..000000000 --- a/src/lib/corelib/generators/visualstudio/visualstudioguidpool.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "visualstudioguidpool.h" -#include <tools/filesaver.h> -#include <QtCore/qfile.h> -#include <QtCore/qjsondocument.h> -#include <QtCore/qmap.h> -#include <QtCore/qvariant.h> - -namespace qbs { - -class VisualStudioGuidPoolPrivate -{ -public: - QString storeFilePath; - QMap<QString, QUuid> productGuids; -}; - -VisualStudioGuidPool::VisualStudioGuidPool(const QString &storeFilePath) - : d(new VisualStudioGuidPoolPrivate) -{ - // Read any existing GUIDs from the on-disk store - QFile file(d->storeFilePath = storeFilePath); - if (file.exists() && file.open(QIODevice::ReadOnly)) { - const auto data = QJsonDocument::fromJson(file.readAll()).toVariant().toMap(); - - QMapIterator<QString, QVariant> it = data; - while (it.hasNext()) { - it.next(); - d->productGuids.insert(it.key(), QUuid(it.value().toString())); - } - } -} - -VisualStudioGuidPool::~VisualStudioGuidPool() -{ - Internal::FileSaver file(d->storeFilePath); - if (file.open()) { - QVariantMap productData; - QMapIterator<QString, QUuid> it(d->productGuids); - while (it.hasNext()) { - it.next(); - productData.insert(it.key(), it.value().toString()); - } - - file.write(QJsonDocument::fromVariant(productData).toJson()); - file.commit(); - } -} - -QUuid VisualStudioGuidPool::drawProductGuid(const QString &productName) -{ - if (!d->productGuids.contains(productName)) - d->productGuids.insert(productName, QUuid::createUuid()); - return d->productGuids.value(productName); -} - -} // namespace qbs diff --git a/src/lib/corelib/generators/visualstudio/visualstudioguidpool.h b/src/lib/corelib/generators/visualstudio/visualstudioguidpool.h deleted file mode 100644 index a21bb1f94..000000000 --- a/src/lib/corelib/generators/visualstudio/visualstudioguidpool.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qbs. -** -** 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 http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef VISUALSTUDIOGUIDPOOL_H -#define VISUALSTUDIOGUIDPOOL_H - -#include <QtCore/qobject.h> -#include <QtCore/qscopedpointer.h> -#include <QtCore/quuid.h> - -namespace qbs { - -class VisualStudioGuidPoolPrivate; - -/*! - * Provides persistent storage for GUIDs related to Visual Studio project file nodes. - * These are stored on disk separately from project files and so allow projects to be - * regenerated while retaining the same GUIDs. This helps avoid unnecessary project - * reloads in Visual Studio, and helps ease source control usage. - */ -class VisualStudioGuidPool -{ -public: - explicit VisualStudioGuidPool(const QString &storeFilePath); - ~VisualStudioGuidPool(); - - QUuid drawProductGuid(const QString &productName); - -private: - QScopedPointer<VisualStudioGuidPoolPrivate> d; -}; - -} // namespace qbs - -#endif // VISUALSTUDIOGUIDPOOL_H diff --git a/src/lib/corelib/tools/filesaver.h b/src/lib/corelib/tools/filesaver.h index 38228ed0c..07ba5ac25 100644 --- a/src/lib/corelib/tools/filesaver.h +++ b/src/lib/corelib/tools/filesaver.h @@ -40,6 +40,8 @@ #ifndef FILESAVER_H #define FILESAVER_H +#include "qbs_export.h" + #include <QtCore/qbuffer.h> #include <QtCore/qbytearray.h> #include <QtCore/qscopedpointer.h> @@ -51,7 +53,7 @@ namespace Internal { /*! * QSaveFile wrapper which doesn't update the target file if the contents are unchanged. */ -class FileSaver { +class QBS_EXPORT FileSaver { public: FileSaver(const QString &filePath, bool overwriteIfUnchanged = false); diff --git a/src/lib/corelib/tools/projectgeneratormanager.cpp b/src/lib/corelib/tools/projectgeneratormanager.cpp index 9d2e1ae7c..3991adfb9 100644 --- a/src/lib/corelib/tools/projectgeneratormanager.cpp +++ b/src/lib/corelib/tools/projectgeneratormanager.cpp @@ -47,10 +47,6 @@ #include <QtCore/qcoreapplication.h> #include <QtCore/qdiriterator.h> -#include <QtCore/qlibrary.h> - -#include "generators/clangcompilationdb/clangcompilationdbgenerator.h" -#include "generators/visualstudio/visualstudiogenerator.h" namespace qbs { @@ -58,10 +54,6 @@ using namespace Internal; ProjectGeneratorManager::~ProjectGeneratorManager() { - for (QLibrary * const lib : qAsConst(m_libs)) { - lib->unload(); - delete lib; - } } ProjectGeneratorManager *ProjectGeneratorManager::instance() @@ -72,12 +64,6 @@ ProjectGeneratorManager *ProjectGeneratorManager::instance() ProjectGeneratorManager::ProjectGeneratorManager() { - std::vector<std::shared_ptr<ProjectGenerator> > generators; - generators.push_back(std::make_shared<ClangCompilationDatabaseGenerator>()); - const auto vsGenerators = qbs::VisualStudioGenerator::createGeneratorList(); - std::copy(vsGenerators.cbegin(), vsGenerators.cend(), std::back_inserter(generators)); - for (const auto &generator : qAsConst(generators)) - m_generators[generator->generatorName()] = generator; } QStringList ProjectGeneratorManager::loadedGeneratorNames() @@ -90,4 +76,10 @@ std::shared_ptr<ProjectGenerator> ProjectGeneratorManager::findGenerator(const Q return instance()->m_generators.value(generatorName); } +void ProjectGeneratorManager::registerGenerator(const std::shared_ptr<ProjectGenerator> &generator) +{ + if (!findGenerator(generator->generatorName())) + instance()->m_generators.insert(generator->generatorName(), generator); +} + } // namespace qbs diff --git a/src/lib/corelib/tools/projectgeneratormanager.h b/src/lib/corelib/tools/projectgeneratormanager.h index d1796ccc6..d9f997fa7 100644 --- a/src/lib/corelib/tools/projectgeneratormanager.h +++ b/src/lib/corelib/tools/projectgeneratormanager.h @@ -48,10 +48,6 @@ #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> -QT_BEGIN_NAMESPACE -class QLibrary; -QT_END_NAMESPACE - namespace qbs { class ProjectGenerator; namespace Internal { @@ -65,12 +61,12 @@ public: static ProjectGeneratorManager *instance(); static QStringList loadedGeneratorNames(); static std::shared_ptr<ProjectGenerator> findGenerator(const QString &generatorName); + static void registerGenerator(const std::shared_ptr<ProjectGenerator> &generator); private: ProjectGeneratorManager(); private: - QList<QLibrary *> m_libs; QMap<QString, std::shared_ptr<ProjectGenerator> > m_generators; }; diff --git a/src/lib/corelib/tools/qbspluginmanager.cpp b/src/lib/corelib/tools/qbspluginmanager.cpp new file mode 100644 index 000000000..9635f2bac --- /dev/null +++ b/src/lib/corelib/tools/qbspluginmanager.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** 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-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qbspluginmanager.h" + +#include <logging/logger.h> +#include <logging/translator.h> +#include <tools/hostosinfo.h> +#include <tools/qbsassert.h> +#include <tools/qttools.h> + +#include <QtCore/qdiriterator.h> +#include <QtCore/qlibrary.h> + +#include <mutex> + +namespace qbs { +namespace Internal { + +QbsPluginManager::QbsPluginManager() +{ +} + +QbsPluginManager::~QbsPluginManager() +{ + unloadStaticPlugins(); + + for (QLibrary * const lib : qAsConst(m_libs)) { + QbsPluginUnloadFunction unload = reinterpret_cast<QbsPluginUnloadFunction>( + lib->resolve("QbsPluginUnload")); + if (unload) + unload(); + lib->unload(); + delete lib; + } +} + +QbsPluginManager *QbsPluginManager::instance() +{ + static QbsPluginManager instance; + return &instance; +} + +void QbsPluginManager::registerStaticPlugin(QbsPluginLoadFunction load, + QbsPluginUnloadFunction unload) +{ + auto begin = m_staticPlugins.cbegin(), end = m_staticPlugins.cend(); + if (std::find_if(begin, end, [&load](const QbsPlugin &p) { return p.load == load; }) == end) + m_staticPlugins.push_back(QbsPlugin { load, unload, false }); +} + +void QbsPluginManager::loadStaticPlugins() +{ + for (const auto &plugin : m_staticPlugins) { + if (!plugin.loaded && plugin.load) + plugin.load(); + } +} + +void QbsPluginManager::unloadStaticPlugins() +{ + for (auto &plugin : m_staticPlugins) { + if (plugin.loaded && plugin.unload) + plugin.unload(); + } + + m_staticPlugins.clear(); +} + +void QbsPluginManager::loadPlugins(const QStringList &pluginPaths, const Logger &logger) +{ + QStringList filters; + + if (HostOsInfo::isWindowsHost()) + filters << QLatin1String("*.dll"); + else if (HostOsInfo::isMacosHost()) + filters << QLatin1String("*.dylib"); + else + filters << QLatin1String("*.so"); + + for (const QString &pluginPath : pluginPaths) { + logger.qbsTrace() << QString::fromLatin1("plugin manager: loading plugins from '%1'.") + .arg(QDir::toNativeSeparators(pluginPath)); + QDirIterator it(pluginPath, filters, QDir::Files); + while (it.hasNext()) { + const QString fileName = it.next(); + QScopedPointer<QLibrary> lib(new QLibrary(fileName)); + if (!lib->load()) { + logger.qbsWarning() << Tr::tr("plugin manager: Cannot load plugin '%1': %2") + .arg(QDir::toNativeSeparators(fileName), lib->errorString()); + continue; + } + + QbsPluginLoadFunction load = reinterpret_cast<QbsPluginLoadFunction>( + lib->resolve("QbsPluginLoad")); + if (load) { + load(); + logger.qbsTrace() << QString::fromLatin1("pluginmanager: plugin '%1' loaded.") + .arg(QDir::toNativeSeparators(fileName)); + m_libs.push_back(lib.take()); + } else { + logger.qbsWarning() << Tr::tr("plugin manager: not a qbs plugin"); + } + } + } +} + +} // namespace Internal +} // namespace qbs diff --git a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdbgenerator.h b/src/lib/corelib/tools/qbspluginmanager.h index 5a8505073..96d5082e3 100644 --- a/src/lib/corelib/generators/clangcompilationdb/clangcompilationdbgenerator.h +++ b/src/lib/corelib/tools/qbspluginmanager.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qbs. @@ -37,31 +37,60 @@ ** ****************************************************************************/ -#ifndef QBS_CLANGCOMPILATIONDATABASEGENERATOR_H -#define QBS_CLANGCOMPILATIONDATABASEGENERATOR_H +#ifndef QBS_PLUGINS_H +#define QBS_PLUGINS_H -#include <generators/generator.h> +#include <language/filetags.h> + +#include <QtCore/qstring.h> + +QT_BEGIN_NAMESPACE +class QLibrary; +QT_END_NAMESPACE namespace qbs { +namespace Internal { +class Logger; -class SourceArtifact; -class ProjectData; +typedef void (*QbsPluginLoadFunction)(); +typedef void (*QbsPluginUnloadFunction)(); -class ClangCompilationDatabaseGenerator : public ProjectGenerator +class QBS_EXPORT QbsPluginManager { public: - ClangCompilationDatabaseGenerator(); + ~QbsPluginManager(); + static QbsPluginManager *instance(); + void registerStaticPlugin(QbsPluginLoadFunction, QbsPluginUnloadFunction); + void loadStaticPlugins(); + void unloadStaticPlugins(); + void loadPlugins(const QStringList &paths, const Logger &logger); + +protected: + QbsPluginManager(); private: - QString generatorName() const override; - void generate() override; - static const QString DefaultDatabaseFileName; - QJsonObject createEntry(const QString &filePath, const QString &buildDir, - const RuleCommand &ruleCommand); - void writeProjectDatabase(const QString &filePath, const QJsonArray &entries); - bool hasValidInputFileTag(const QStringList &fileTags) const; + struct QbsPlugin { + QbsPluginLoadFunction load; + QbsPluginUnloadFunction unload; + bool loaded; + }; + std::vector<QbsPlugin> m_staticPlugins; + std::vector<QLibrary *> m_libs; }; +} // namespace Internal } // namespace qbs -#endif // QBS_VISUALSTUDIOGENERATOR_H +#ifdef QBS_STATIC_LIB +#define QBS_REGISTER_STATIC_PLUGIN(exportmacro, name, load, unload) \ + static auto qbs_static_plugin_register##name = [] { \ + qbs::Internal::QbsPluginManager::instance()->registerStaticPlugin(load, unload); \ + return true; \ + }(); +#else +#define QBS_REGISTER_STATIC_PLUGIN(exportmacro, name, load, unload) \ + exportmacro void QbsPluginLoad() { load(); } \ + exportmacro void QbsPluginUnload() { unload(); } +#endif + +#endif diff --git a/src/lib/corelib/tools/scannerpluginmanager.cpp b/src/lib/corelib/tools/scannerpluginmanager.cpp index c6ce3327b..cc929cad4 100644 --- a/src/lib/corelib/tools/scannerpluginmanager.cpp +++ b/src/lib/corelib/tools/scannerpluginmanager.cpp @@ -39,26 +39,11 @@ #include "scannerpluginmanager.h" -#include <logging/logger.h> -#include <logging/translator.h> -#include <tools/hostosinfo.h> -#include <tools/qttools.h> - -#include <QtCore/qcoreapplication.h> -#include <QtCore/qdiriterator.h> -#include <QtCore/qlibrary.h> +#include <plugins/scanner/scanner.h> namespace qbs { namespace Internal { -ScannerPluginManager::~ScannerPluginManager() -{ - for (QLibrary * const lib : qAsConst(m_libs)) { - lib->unload(); - delete lib; - } -} - ScannerPluginManager *ScannerPluginManager::instance() { static ScannerPluginManager scannerPlugin; @@ -74,7 +59,7 @@ QList<ScannerPlugin *> ScannerPluginManager::scannersForFileTag(const FileTag &f return instance()->m_scannerPlugins.value(fileTag); } -void ScannerPluginManager::loadPlugins(ScannerPlugin **plugins) +void ScannerPluginManager::registerPlugins(ScannerPlugin **plugins) { for (int i = 0; plugins[i] != 0; ++i) { const FileTags &fileTags = FileTags::fromStringList( @@ -84,52 +69,5 @@ void ScannerPluginManager::loadPlugins(ScannerPlugin **plugins) } } -void ScannerPluginManager::loadPlugins(const QStringList &pluginPaths, const Logger &logger) -{ - QStringList filters; - - if (HostOsInfo::isWindowsHost()) - filters << QLatin1String("*.dll"); - else if (HostOsInfo::isMacosHost()) - filters << QLatin1String("*.dylib"); - else - filters << QLatin1String("*.so"); - - for (const QString &pluginPath : pluginPaths) { - logger.qbsTrace() << QString::fromLatin1("pluginmanager: loading plugins from '%1'.") - .arg(QDir::toNativeSeparators(pluginPath)); - QDirIterator it(pluginPath, filters, QDir::Files); - while (it.hasNext()) { - const QString fileName = it.next(); - QScopedPointer<QLibrary> lib(new QLibrary(fileName)); - if (!lib->load()) { - logger.qbsWarning() << Tr::tr("Pluginmanager: Cannot load plugin '%1': %2") - .arg(QDir::toNativeSeparators(fileName), lib->errorString()); - continue; - } - - getScanners_f getScanners = reinterpret_cast<getScanners_f>(lib->resolve("getScanners")); - if (!getScanners) { - logger.qbsWarning() << Tr::tr("Pluginmanager: Cannot resolve " - "symbol in '%1'.").arg(QDir::toNativeSeparators(fileName)); - continue; - } - - ScannerPlugin **plugins = getScanners(); - if (plugins == 0) { - logger.qbsWarning() << Tr::tr("pluginmanager: no scanners " - "returned from '%1'.").arg(QDir::toNativeSeparators(fileName)); - continue; - } - - logger.qbsTrace() << QString::fromLatin1("pluginmanager: scanner plugin '%1' loaded.") - .arg(QDir::toNativeSeparators(fileName)); - - loadPlugins(plugins); - m_libs.append(lib.take()); - } - } -} - } // namespace Internal } // namespace qbs diff --git a/src/lib/corelib/tools/scannerpluginmanager.h b/src/lib/corelib/tools/scannerpluginmanager.h index a5e1ef88c..380d38a76 100644 --- a/src/lib/corelib/tools/scannerpluginmanager.h +++ b/src/lib/corelib/tools/scannerpluginmanager.h @@ -37,41 +37,33 @@ ** ****************************************************************************/ -#ifndef QBS_PLUGINS_H -#define QBS_PLUGINS_H +#ifndef QBS_PLUGINS_SCANNER_H +#define QBS_PLUGINS_SCANNER_H + +#include "qbs_export.h" #include <language/filetags.h> -#include <plugins/scanner/scanner.h> #include <QtCore/qhash.h> -#include <QtCore/qstring.h> -QT_BEGIN_NAMESPACE -class QLibrary; -QT_END_NAMESPACE +class ScannerPlugin; namespace qbs { namespace Internal { -class Logger; -class ScannerPluginManager +class QBS_EXPORT ScannerPluginManager { public: - ~ScannerPluginManager(); static ScannerPluginManager *instance(); static QList<ScannerPlugin *> scannersForFileTag(const FileTag &fileTag); - void loadPlugins(ScannerPlugin **plugins); - void loadPlugins(const QStringList &paths, const Logger &logger); + void registerPlugins(ScannerPlugin **plugins); private: ScannerPluginManager(); - -private: - QList<QLibrary *> m_libs; QHash<FileTag, QList<ScannerPlugin*> > m_scannerPlugins; }; } // namespace Internal } // namespace qbs -#endif +#endif // QBS_PLUGINS_SCANNER_H diff --git a/src/lib/corelib/tools/tools.pri b/src/lib/corelib/tools/tools.pri index 0fa91147b..ed0942294 100644 --- a/src/lib/corelib/tools/tools.pri +++ b/src/lib/corelib/tools/tools.pri @@ -34,6 +34,7 @@ HEADERS += \ $$PWD/processutils.h \ $$PWD/progressobserver.h \ $$PWD/projectgeneratormanager.h \ + $$PWD/qbspluginmanager.h \ $$PWD/qbsprocess.h \ $$PWD/shellutils.h \ $$PWD/stlutils.h \ @@ -82,6 +83,7 @@ SOURCES += \ $$PWD/profiling.cpp \ $$PWD/progressobserver.cpp \ $$PWD/projectgeneratormanager.cpp \ + $$PWD/qbspluginmanager.cpp \ $$PWD/qbsprocess.cpp \ $$PWD/shellutils.cpp \ $$PWD/buildoptions.cpp \ @@ -124,6 +126,7 @@ qbs_enable_unit_tests { $$PWD/generateoptions.h \ $$PWD/generatorpluginmanager.h \ $$PWD/installoptions.h \ + $$PWD/qbspluginmanager.h \ $$PWD/setupprojectparameters.h \ $$PWD/toolchains.h tools_headers.path = $${QBS_INSTALL_PREFIX}/include/qbs/tools |