Commit 4e83fb79 authored by Friedemann Kleint's avatar Friedemann Kleint

Port Qt Creator to the new plugin system of Qt 5.

- Add Q_PLUGIN_METADATA for Qt 5, use Q_EXPORT_PLUGIN
  for Qt 4.
- Generate the Json files for Qt 5 from the pluginspec
  files by using a XSLT sheet.

Change-Id: I8653f182ae7d61615971c093df10b84fb06c2172
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@nokia.com>
parent 36effe8c
......@@ -36,6 +36,9 @@
#include "extensionsystem_global.h"
#include <QObject>
#if QT_VERSION >= 0x050000
# include <QtPlugin>
#endif
namespace ExtensionSystem {
......@@ -83,4 +86,16 @@ private:
} // namespace ExtensionSystem
// The macros Q_EXPORT_PLUGIN, Q_EXPORT_PLUGIN2 become obsolete in Qt 5.
#if QT_VERSION >= 0x050000
# if defined(Q_EXPORT_PLUGIN)
# undef Q_EXPORT_PLUGIN
# undef Q_EXPORT_PLUGIN2
# endif
# define Q_EXPORT_PLUGIN(plugin)
# define Q_EXPORT_PLUGIN2(function, plugin)
#else
# define Q_PLUGIN_METADATA(x)
#endif
#endif // IPLUGIN_H
......@@ -95,4 +95,6 @@ void StylePlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
engine->addImageProvider("desktoptheme", new DesktopIconProvider);
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(styleplugin, StylePlugin)
#endif
......@@ -50,6 +50,11 @@
class StylePlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface" FILE "styleitem.json")
Q_INTERFACES(QDeclarativeExtensionInterface)
#endif
public:
void registerTypes(const char *uri);
void initializeEngine(QDeclarativeEngine *engine, const char *uri);
......
<?xml version="1.0"?>
<!-- XSL sheet to transform Qt Creator's pluginspec files into json files required
for the new Qt 5 plugin system. -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="plugin vendor category description url"/>
<xsl:template match="/">
{
<xsl:apply-templates/>
}
</xsl:template>
<xsl:template match="license"/>
<xsl:template match="dependencyList"/>
<xsl:template match="copyright"/>
<xsl:template match="argumentList"/>
<xsl:template match="vendor">
"Vendor" : "<xsl:apply-templates/>",
</xsl:template>
<xsl:template match="category">
"Category" : "<xsl:apply-templates/>",
</xsl:template>
<xsl:template match="description">
"Description" : "<xsl:apply-templates/>",
</xsl:template>
<xsl:template match="url">
"Url" : "<xsl:apply-templates/>"
</xsl:template>
</xsl:stylesheet>
......@@ -43,6 +43,7 @@ namespace Internal {
class AnalyzerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AnalyzerBase.json")
public:
static AnalyzerPlugin *instance();
......
......@@ -70,6 +70,9 @@ namespace Internal {
class AutotoolsProjectPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AutotoolsProjectManager.json")
public:
AutotoolsProjectPlugin();
......
......@@ -81,6 +81,7 @@ class BazaarEditor;
class BazaarPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Bazaar.json")
public:
BazaarPlugin();
......
......@@ -60,6 +60,7 @@ class BinEditorFactory;
class BinEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "BinEditor.json")
public:
BinEditorPlugin();
......
......@@ -59,6 +59,7 @@ class BookmarkManager;
class BookmarksPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Bookmarks.json")
public:
BookmarksPlugin();
......
......@@ -46,6 +46,7 @@ namespace Internal {
class Plugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClassView.json")
public:
//! Constructor
......
......@@ -44,6 +44,7 @@ class CMakeProjectPlugin
: public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CMakeProjectManager.json")
public:
CMakeProjectPlugin();
......
......@@ -45,6 +45,7 @@ class MainWindow;
class CorePlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Core.json")
public:
CorePlugin();
......
......@@ -63,6 +63,7 @@ public slots:
class CodepasterPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CodePaster.json")
public:
CodepasterPlugin();
......
......@@ -55,6 +55,7 @@ class CppQuickFixAssistProvider;
class CppPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CppEditor.json")
public:
CppPlugin();
......
......@@ -63,6 +63,7 @@ struct CppFileSettings;
class CppToolsPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CppTools.json")
public:
CppToolsPlugin();
......
......@@ -74,6 +74,7 @@ struct CvsResponse
class CvsPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CVS.json")
public:
CvsPlugin();
......
......@@ -53,6 +53,7 @@ class DebuggerStartParameters;
class DEBUGGER_EXPORT DebuggerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Debugger.json")
public:
DebuggerPlugin();
......
......@@ -41,6 +41,7 @@ namespace Internal {
class FormEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Designer.json")
public:
FormEditorPlugin();
......
......@@ -44,6 +44,7 @@ class FakeVimPluginPrivate;
class FakeVimPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "FakeVim.json")
public:
FakeVimPlugin();
......
......@@ -54,6 +54,7 @@ class CurrentDocumentFind;
class FIND_EXPORT FindPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Find.json")
public:
FindPlugin();
......
......@@ -51,6 +51,7 @@ class ProjectFilesFactory;
class GenericProjectPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "GenericProjectManager.json")
public:
GenericProjectPlugin();
......
......@@ -86,6 +86,7 @@ typedef QPair<Utils::ParameterAction *, Core::Command* > ParameterActionCommandP
class GitPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Git.json")
public:
GitPlugin();
......
......@@ -73,6 +73,7 @@ class GLSLQuickFixCollector;
class GLSLEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "GLSLEditor.json")
public:
GLSLEditorPlugin();
......
......@@ -42,6 +42,7 @@ class HelloWorldPlugin
: public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "HelloWorld.json")
public:
HelloWorldPlugin();
......
......@@ -70,6 +70,7 @@ class SearchWidget;
class HelpPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Help.json")
public:
HelpPlugin();
......
......@@ -46,6 +46,7 @@ class ImageViewerFactory;
class ImageViewerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ImageViewer.json")
public:
ImageViewerPlugin();
......
......@@ -44,6 +44,10 @@
#include <QTimer>
#include <QFutureWatcher>
#if QT_VERSION >= 0x050000
# include <QtPlugin>
#endif
namespace Locator {
namespace Internal {
......@@ -56,6 +60,7 @@ class LocatorPlugin;
class LocatorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Locator.json")
public:
LocatorPlugin();
......
......@@ -44,6 +44,7 @@ namespace Internal {
class MacrosPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Macros.json")
public:
MacrosPlugin();
......
......@@ -41,6 +41,8 @@ namespace Internal {
class MaddePlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Madde.json")
public:
MaddePlugin();
~MaddePlugin();
......
......@@ -68,6 +68,7 @@ class MercurialSettings;
class MercurialPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Mercurial.json")
public:
MercurialPlugin();
......
......@@ -80,6 +80,7 @@ struct PerforceResponse
class PerforcePlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Perforce.json")
public:
PerforcePlugin();
......
......@@ -72,6 +72,7 @@ class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin
: public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ProjectExplorer.json")
public:
ProjectExplorerPlugin();
......
......@@ -65,6 +65,7 @@ class DesignModeContext;
class BauhausPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlDesigner.json")
public:
BauhausPlugin();
......
......@@ -79,6 +79,7 @@ class QmlTaskManager;
class QmlJSEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlJSEditor.json")
public:
QmlJSEditorPlugin();
......
......@@ -52,6 +52,7 @@ class InspectorUi;
class InspectorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlJSInspector.json")
public:
InspectorPlugin();
......
......@@ -56,6 +56,7 @@ class ModelManager;
class QmlJSToolsPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlJSTools.json")
public:
static QmlJSToolsPlugin *instance() { return m_instance; }
......
......@@ -43,6 +43,7 @@ namespace Internal {
class QmlProfilerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlProfiler.json")
public:
QmlProfilerPlugin() {}
......
......@@ -42,6 +42,7 @@ namespace QmlProjectManager {
class QMLPROJECTMANAGER_EXPORT QmlProjectPlugin: public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlProjectManager.json")
public:
QmlProjectPlugin();
......
......@@ -59,6 +59,7 @@ class ProFileEditorFactory;
class Qt4ProjectManagerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Qt4ProjectManager.json")
public:
Qt4ProjectManagerPlugin();
......
......@@ -45,6 +45,7 @@ class ExamplesWelcomePage;
class QtSupportPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QtSupport.json")
public:
bool initialize(const QStringList &arguments, QString *errorMessage);
......
......@@ -41,6 +41,7 @@ namespace Internal {
class RemoteLinuxPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "RemoteLinux.json")
public:
RemoteLinuxPlugin();
......
......@@ -49,6 +49,7 @@ class ResourceEditorFactory;
class ResourceEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ResourceEditor.json")
public:
ResourceEditorPlugin();
......
......@@ -79,6 +79,7 @@ struct SubversionResponse
class SubversionPlugin : public VcsBase::VcsBasePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Subversion.json")
public:
SubversionPlugin();
......
......@@ -47,6 +47,7 @@ class TaskListPluginPrivate;
class TaskListPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "TaskList.json")
public:
TaskListPlugin();
......
......@@ -55,6 +55,7 @@ class BaseTextMarkRegistry;
class TextEditorPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "TextEditor.json")
public:
TextEditorPlugin();
......
......@@ -49,6 +49,8 @@ class TodoItem;
class TodoPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Todo.json")
public:
TodoPlugin();
~TodoPlugin();
......
......@@ -45,6 +45,8 @@ class UpdateInfoPluginPrivate;
class UpdateInfoPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "UpdateInfo.json")
public:
UpdateInfoPlugin();
virtual ~UpdateInfoPlugin();
......
......@@ -44,6 +44,7 @@ namespace Internal {
class ValgrindPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Valgrind.json")
public:
ValgrindPlugin() {}
......
......@@ -51,6 +51,7 @@ class CoreListener;
class VcsPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "VcsBase.json")
public:
VcsPlugin();
......
......@@ -47,6 +47,8 @@ class WelcomeMode;
class WelcomePlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Welcome.json")
public:
WelcomePlugin();
......
......@@ -57,6 +57,22 @@ copy2build.name = COPY ${QMAKE_FILE_IN}
copy2build.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += copy2build
greaterThan(QT_MAJOR_VERSION, 4) {
# Create a Json file containing the plugin information required by
# Qt 5's plugin system by running a XSLT sheet on the
# pluginspec file before moc runs.
XMLPATTERNS = $$targetPath($$[QT_INSTALL_BINS]/xmlpatterns)
pluginspec2json.name = Create Qt 5 plugin json file
pluginspec2json.input = PLUGINSPEC
pluginspec2json.variable_out = GENERATED_FILES
pluginspec2json.output = $${TARGET}.json
pluginspec2json.commands = $$XMLPATTERNS -no-format -output $$pluginspec2json.output $$PWD/pluginjsonmetadata.xsl $$PLUGINSPEC
pluginspec2json.CONFIG += no_link
moc_header.depends += $$pluginspec2json.output
QMAKE_EXTRA_COMPILERS += pluginspec2json
}
macx {
!isEmpty(TIGER_COMPAT_MODE) {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment