2016-01-15 14:51:16 +01:00
|
|
|
/****************************************************************************
|
2011-11-25 12:03:08 +01:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-11-25 12:03:08 +01:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** This file is part of the Qt Creator documentation.
|
2011-11-25 12:03:08 +01:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** 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.
|
2011-11-25 12:03:08 +01:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
** GNU Free Documentation License Usage
|
2011-11-25 12:03:08 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Free
|
|
|
|
** Documentation License version 1.3 as published by the Free Software
|
2016-01-15 14:51:16 +01:00
|
|
|
** Foundation and appearing in the file included in the packaging of
|
|
|
|
** this file. Please review the following information to ensure
|
|
|
|
** the GNU Free Documentation License version 1.3 requirements
|
|
|
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
2011-11-25 12:03:08 +01:00
|
|
|
**
|
2016-01-15 14:51:16 +01:00
|
|
|
****************************************************************************/
|
2011-11-25 12:03:08 +01:00
|
|
|
|
|
|
|
/*!
|
2014-08-26 17:29:38 +02:00
|
|
|
\page plugin-meta-data.html
|
|
|
|
\title Plugin Meta Data
|
2011-11-25 12:03:08 +01:00
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
The meta data file of a plugin is a JSON file that contains all
|
2011-11-25 12:03:08 +01:00
|
|
|
information that is necessary for loading the plugin's library,
|
|
|
|
determining whether plugins are to be loaded and in which order (depending
|
|
|
|
on e.g. dependencies). In addition, it contains textual descriptions of
|
|
|
|
who created the plugin, what it is for, and where to find more information about it.
|
2014-08-26 17:29:38 +02:00
|
|
|
The file must be located in one of the include search paths when compiling the plugin,
|
|
|
|
and must have the \c .json extension. The JSON file is compiled into the plugin as meta data,
|
|
|
|
which then is read by \QC when loading plugins.
|
2011-11-25 12:03:08 +01:00
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
\section2 Main Keys
|
2011-11-25 12:03:08 +01:00
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
The main keys that are used to identify your your plugin and define default loading behavior,
|
|
|
|
consist of the mandatory keys \c Name and \c Version, and the optional keys \c CompatVersion,
|
|
|
|
\c Experimental, \c DisabledByDefault, \c Required and \c Platform.
|
2011-11-25 12:03:08 +01:00
|
|
|
\table
|
|
|
|
\header
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Key
|
|
|
|
\li Value Type
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Meaning
|
2011-11-25 12:03:08 +01:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Name
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li This is used as an identifier for the plugin and can e.g.
|
2014-08-26 17:29:38 +02:00
|
|
|
be referenced in other plugin's dependencies.
|
2013-09-25 18:19:45 +02:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Version
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Version string in the form \c{x.y.z_n}, used for identifying
|
|
|
|
the plugin. Also see \l{A Note on Plugin Versions}.
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li CompatVersion
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Optional. If not given, it is implicitly
|
2014-08-26 17:29:38 +02:00
|
|
|
set to the same value as \c Version. The compatibility version
|
2013-09-25 18:19:45 +02:00
|
|
|
states which version of this plugin the current version is
|
|
|
|
binary backward compatible with and is used to resolve dependencies
|
2014-08-26 17:29:38 +02:00
|
|
|
on this plugin. I.e. a \c Version of \c{2.1.1} and a
|
|
|
|
\c CompatVersion of \c{2.0.0} means that this version \c{2.1.1} of the plugin
|
2013-09-25 18:19:45 +02:00
|
|
|
is binary backward compatible with all versions of the plugin down to \c{2.0.0}
|
|
|
|
(inclusive).
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Experimental
|
|
|
|
\li Boolean
|
|
|
|
\li Optional. Defaults to \c false.
|
2013-09-25 18:19:45 +02:00
|
|
|
Experimental plugins are not loaded by default but must be explicitly
|
|
|
|
enabled by the user. This attribute should be enabled for new plugins which have the
|
|
|
|
potential to negatively affect the user experience.
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li DisabledByDefault
|
|
|
|
\li Boolean
|
|
|
|
\li Optional. Defaults to \c false.
|
2013-09-25 18:19:45 +02:00
|
|
|
If set, the respective plugin is not loaded by default but must be explicitly
|
|
|
|
enabled by the user. This should be done for plugins which are not expected
|
|
|
|
to be used by so many people as to justify the additional resource consumption.
|
2017-01-04 06:23:32 +01:00
|
|
|
\row
|
|
|
|
\li HiddenByDefault
|
|
|
|
\li Boolean
|
|
|
|
\li Optional. Defaults to \c false.
|
|
|
|
If set, the plugin is not shown in the default view in the
|
|
|
|
\uicontrol {About Plugins...} dialog, but only if the user requests seeing all
|
|
|
|
plugins. It is still shown with the \c{-version} command line option.
|
2014-07-03 17:41:24 +02:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Required
|
|
|
|
\li Boolean
|
|
|
|
\li Optional. Defaults to \c false.
|
2014-12-17 17:15:42 +01:00
|
|
|
Is used as a hint for the \uicontrol{About Plugins...} dialog, that the user may not
|
2014-07-03 17:41:24 +02:00
|
|
|
manually disable this plugin. Only used for the Core plugin.
|
2014-08-26 17:29:38 +02:00
|
|
|
\row
|
|
|
|
\li Platform
|
|
|
|
\li String
|
|
|
|
\li Optional. A regular expression that matches the names of the platforms the plugin
|
|
|
|
works on. Omitting the tag implies that the plugin is loaded on all platforms.
|
2011-11-25 12:03:08 +01:00
|
|
|
\endtable
|
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
\section2 Plugin-describing Keys
|
2011-11-25 12:03:08 +01:00
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
These are solely used for more detailed (user centric) description of the plugin. All of these
|
2011-11-25 12:03:08 +01:00
|
|
|
are optional.
|
|
|
|
\table
|
|
|
|
\header
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Key
|
|
|
|
\li Value Type
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Meaning
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Category
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Defaults to \c Utilities. Is used to put related plugins
|
2014-12-17 17:15:42 +01:00
|
|
|
under the same tree node in the plugin overview \uicontrol{About Plugins...}.
|
2013-09-25 18:19:45 +02:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Vendor
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li String that describes the plugin creator/vendor,
|
|
|
|
like \c{MyCompany}.
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Copyright
|
|
|
|
\li String
|
2016-01-15 14:51:16 +01:00
|
|
|
\li A short copyright notice, like \c{(C) 2016 MyCompany}.
|
2013-09-25 18:19:45 +02:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li License
|
|
|
|
\li String or array of strings
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Possibly multi-line license information about the plugin.
|
|
|
|
Should still be kept relatively short, since the UI is not
|
|
|
|
designed for long texts.
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Description
|
|
|
|
\li String or array of strings
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Possibly multi-line description of what the plugin is supposed
|
|
|
|
to provide.
|
|
|
|
Should still be kept relatively short, since the UI is not
|
|
|
|
designed for long texts.
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Url
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Link to further information about the plugin, like
|
|
|
|
\c{http://www.mycompany-online.com/products/greatplugin}.
|
2011-11-25 12:03:08 +01:00
|
|
|
\endtable
|
|
|
|
|
|
|
|
\section2 Dependencies
|
|
|
|
|
|
|
|
A plugin can have dependencies on other plugins. These are
|
2014-08-26 17:29:38 +02:00
|
|
|
specified in the plugin meta data, to ensure that
|
2011-11-25 12:03:08 +01:00
|
|
|
these other plugins are loaded before this plugin.
|
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
Dependencies are declared with the key \c Dependency, which contains an array of JSON objects
|
|
|
|
with required keys \c Name and \c Version, and optional key \c Type.
|
2011-11-25 12:03:08 +01:00
|
|
|
|
|
|
|
The following formulas illustrate how the dependency information is matched.
|
2014-08-26 17:29:38 +02:00
|
|
|
In the formulas the name of the required plugin (as defined in the \c Name of the dependency
|
|
|
|
object) is denoted as \c DependencyName
|
|
|
|
and the required version of the plugin is denoted as \c DependencyVersion.
|
|
|
|
A plugin with given \c Name, \c Version and \c CompatVersion
|
|
|
|
as defined in the plugin meta data matches
|
2011-11-25 12:03:08 +01:00
|
|
|
the dependency if
|
|
|
|
\list
|
2014-08-26 17:29:38 +02:00
|
|
|
\li its \c Name matches \c DependencyName, and
|
|
|
|
\li \c {CompatVersion <= DependencyVersion <= Version}.
|
2011-11-25 12:03:08 +01:00
|
|
|
\endlist
|
|
|
|
For example a dependency
|
|
|
|
\code
|
2014-08-26 17:29:38 +02:00
|
|
|
{
|
|
|
|
"Name" : "SomeOtherPlugin",
|
|
|
|
"Version" : "2.3.0_2"
|
|
|
|
}
|
2011-11-25 12:03:08 +01:00
|
|
|
\endcode
|
|
|
|
would be matched by a plugin with
|
|
|
|
\code
|
2014-08-26 17:29:38 +02:00
|
|
|
{
|
|
|
|
"Name" : "SomeOtherPlugin",
|
|
|
|
"Version" : "3.1.0",
|
|
|
|
"CompatVersion" : "2.2.0",
|
|
|
|
...
|
|
|
|
}
|
2011-11-25 12:03:08 +01:00
|
|
|
\endcode
|
|
|
|
since the name matches, and the version \c{2.3.0_2} given in the dependency tag
|
|
|
|
lies in the range of \c{2.2.0} and \c{3.1.0}.
|
|
|
|
|
|
|
|
\table
|
|
|
|
\header
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Key
|
|
|
|
\li Value Type
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Meaning
|
2011-11-25 12:03:08 +01:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Dependencies
|
|
|
|
\li Array of dependency objects
|
|
|
|
\li Describes the dependencies on other plugins.
|
2011-11-25 12:03:08 +01:00
|
|
|
\endtable
|
2014-08-26 17:29:38 +02:00
|
|
|
|
|
|
|
A dependency object is a JSON object with the following keys:
|
2011-11-25 12:03:08 +01:00
|
|
|
\table
|
|
|
|
\header
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Key
|
|
|
|
\li Value Type
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Meaning
|
2011-11-25 12:03:08 +01:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Name
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li The name of the plugin, on which this plugin relies.
|
2011-11-25 12:03:08 +01:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Version
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li The version to which the plugin must be compatible to
|
|
|
|
fill the dependency, in the form \c{x.y.z_n}.
|
|
|
|
Can be empty if the version does not matter.
|
2011-11-25 12:03:08 +01:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Type
|
|
|
|
\li String
|
2015-03-04 09:25:08 +02:00
|
|
|
\li Optional. Value \c Required, \c Optional, or \c Test. Defines if the dependency is
|
|
|
|
a hard requirement, optional, or required for running the plugin's tests.
|
|
|
|
Defaults to \c{Required}.
|
2011-11-25 12:03:08 +01:00
|
|
|
\endtable
|
|
|
|
|
2012-02-09 13:34:33 +01:00
|
|
|
\section3 Optional Dependencies
|
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
A plugin can specify that a dependency on another plugin is optional, by adding
|
|
|
|
\c {"Type" : "Optional"} to the dependency object:
|
2012-02-09 13:34:33 +01:00
|
|
|
|
|
|
|
\list
|
2013-09-25 18:19:45 +02:00
|
|
|
\li If the dependency can be resolved, the plugin and
|
2014-08-26 17:29:38 +02:00
|
|
|
its dependency are loaded and initialized as for \c Required dependencies.
|
2013-09-25 18:19:45 +02:00
|
|
|
\li If the dependency cannot be resolved, the plugin is loaded and initialized
|
|
|
|
as if the dependency was not declared at all.
|
2012-02-09 13:34:33 +01:00
|
|
|
\endlist
|
|
|
|
|
|
|
|
The plugin is not informed about the existence of optional dependencies in any way. Since the
|
|
|
|
dependency might be loaded or not, the plugin may also not link against the dependency.
|
|
|
|
A common way to access objects from optional dependencies is to get the object from the
|
|
|
|
\l{The Plugin Manager, the Object Pool, and Registered Objects}{global object pool}
|
2018-03-02 10:05:11 +01:00
|
|
|
via ExtensionSystem::PluginManager::getObjectByName() and use QMetaObject functions to call
|
2013-10-07 13:34:40 +02:00
|
|
|
functions on it.
|
2012-02-09 13:34:33 +01:00
|
|
|
|
2015-03-04 09:25:08 +02:00
|
|
|
\section3 Test Dependencies
|
|
|
|
|
|
|
|
When the user runs the application with the \c{-test} command line argument, only
|
|
|
|
the specified plugins and their dependencies are loaded. This is done in order to
|
|
|
|
speed up the execution of tests by avoiding the loading of unneeded plugins.
|
|
|
|
|
|
|
|
A plugin can specify additional dependencies that are required for running its
|
|
|
|
tests, but not for its normal execution, by declaring dependencies with
|
|
|
|
\c {"Type" : "Test"}. Test dependencies are force loaded, and do not affect load order.
|
|
|
|
|
|
|
|
This type of dependency is not transitive.
|
|
|
|
|
2011-11-25 12:03:08 +01:00
|
|
|
\section2 Command Line Arguments
|
|
|
|
|
|
|
|
Plugins can register command line arguments that the user can give
|
|
|
|
when starting the application. These command line arguments are shown
|
|
|
|
with a one-line description when the user runs the application with
|
|
|
|
the \c{-help} command line argument, and the plugin manager does its command
|
|
|
|
line parsing and sanity checks based on that information.
|
|
|
|
If the plugin manager finds matching command line arguments for a plugin,
|
2011-11-28 08:27:50 +01:00
|
|
|
it passes them on to the plugin's
|
2013-10-07 13:34:40 +02:00
|
|
|
\l{ExtensionSystem::IPlugin::initialize()}{initialize()} function.
|
2011-11-25 12:03:08 +01:00
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
Command line arguments are defined through the key \c Arguments, which contains an array
|
|
|
|
of argument objects. Each individual argument object has the required key \c Name, and
|
|
|
|
optional keys \c Parameter and \c Description.
|
2011-11-25 12:03:08 +01:00
|
|
|
|
|
|
|
\table
|
|
|
|
\header
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Key
|
|
|
|
\li Value Type
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Meaning
|
2011-11-25 12:03:08 +01:00
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Arguments
|
|
|
|
\li Array of argument objects
|
|
|
|
\li Describes the command line arguments that the plugin wants to handle.
|
2011-11-25 12:03:08 +01:00
|
|
|
\endtable
|
2014-08-26 17:29:38 +02:00
|
|
|
|
|
|
|
An argument object is a JSON object with the following keys:
|
2011-11-25 12:03:08 +01:00
|
|
|
\table
|
|
|
|
\header
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Key
|
|
|
|
\li Value Type
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Meaning
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Name
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li The command line argument itself, including the \c - prefix, e.g.
|
|
|
|
\c{-my-parameter}.
|
|
|
|
\row
|
2014-08-26 17:29:38 +02:00
|
|
|
\li Parameter
|
|
|
|
\li String
|
2013-09-25 18:19:45 +02:00
|
|
|
\li Optional. If this is given, the command line argument expects an
|
|
|
|
additional parameter, e.g. \c{-my-parameter somevalue}. The
|
|
|
|
value of this attribute is used as a very short description of the
|
|
|
|
parameter for the user.
|
2014-08-26 17:29:38 +02:00
|
|
|
\row
|
|
|
|
\li Description
|
|
|
|
\li String
|
|
|
|
\li Optional. A (one-line) description of the argument for the command line argument help.
|
2011-11-25 12:03:08 +01:00
|
|
|
\endtable
|
|
|
|
|
2014-08-26 17:29:38 +02:00
|
|
|
\section2 Example \c Test.json
|
2011-11-25 12:03:08 +01:00
|
|
|
|
|
|
|
\code
|
2014-08-26 17:29:38 +02:00
|
|
|
{
|
|
|
|
"Name" : "Test",
|
|
|
|
"Version" : "1.0.1",
|
|
|
|
"CompatVersion" : "1.0.0",
|
|
|
|
"Vendor" : "My Company",
|
2016-01-15 14:51:16 +01:00
|
|
|
"Copyright" : "(C) 2016 MyCompany",
|
2014-08-26 17:29:38 +02:00
|
|
|
"License" : [
|
|
|
|
"This is a default license bla",
|
|
|
|
"blubbblubb",
|
|
|
|
"end of terms"
|
|
|
|
],
|
|
|
|
"Category" : "My Company Additions",
|
|
|
|
"Description" : [
|
|
|
|
"This plugin is just a test.",
|
|
|
|
"It demonstrates the great use of the plugin meta data."
|
|
|
|
],
|
|
|
|
"Url" : "http://www.mycompany-online.com/products/greatplugin",
|
|
|
|
"Arguments" : [
|
|
|
|
{
|
|
|
|
"Name" : "-variant",
|
|
|
|
"Parameter" : "fancy|boring",
|
|
|
|
"Description" : "Brings up the fancy or boring user interface"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"Dependencies" : [
|
|
|
|
{ "Name" : "SomeOtherPlugin", "Version" : "2.3.0_2" },
|
|
|
|
{ "Name" : "EvenOther", "Version" : "1.0.0" }
|
|
|
|
]
|
|
|
|
}
|
2011-11-25 12:03:08 +01:00
|
|
|
\endcode
|
|
|
|
|
|
|
|
\section2 A Note on Plugin Versions
|
|
|
|
|
|
|
|
Plugin versions are in the form \c{x.y.z_n} where, \c x, \c y, \c z and \c n are
|
|
|
|
non-negative integer numbers. You don't have to specify the version
|
|
|
|
in this full form - any left-out part will implicitly be set to zero.
|
|
|
|
So, \c{2.10_2} is equal to \c{2.10.0_2}, and \c 1 is the same as \c{1.0.0_0}.
|
|
|
|
|
|
|
|
*/
|