plugin: Drop version information

Mutter itself is versioned now, so passing the version information
to the plugin is redunant now: The version is already determined by
linking to a particular API version (gnome-shell) or by installing
to a versioned plugin path (external plugins).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1473
This commit is contained in:
Florian Müllner 2020-10-06 14:26:53 +02:00
parent 113446f2e9
commit f481cbfa16
6 changed files with 13 additions and 113 deletions

View File

@ -4,8 +4,6 @@ project('mutter', 'c',
license: 'GPLv2+'
)
mutter_plugin_api_version = '3'
split_version = meson.project_version().split('.')
# Automatically increase API version each development cycle,

View File

@ -26,7 +26,6 @@
#include <gmodule.h>
#include "meta/meta-plugin.h"
#include "meta/meta-version.h"
enum
{
@ -47,7 +46,6 @@ static gboolean
meta_module_load (GTypeModule *gmodule)
{
MetaModulePrivate *priv = META_MODULE (gmodule)->priv;
MetaPluginVersion *info = NULL;
GType (*register_type) (GTypeModule *) = NULL;
if (priv->lib && priv->plugin_type)
@ -63,15 +61,9 @@ meta_module_load (GTypeModule *gmodule)
return FALSE;
}
if (g_module_symbol (priv->lib, "meta_plugin_version",
(gpointer *)(void *)&info) &&
g_module_symbol (priv->lib, "meta_plugin_register_type",
if (g_module_symbol (priv->lib, "meta_plugin_register_type",
(gpointer *)(void *)&register_type) &&
info && register_type)
{
if (info->version_api != META_PLUGIN_API_VERSION)
g_warning ("Plugin API mismatch for [%s]", priv->path);
else
register_type)
{
GType plugin_type;
@ -88,7 +80,6 @@ meta_module_load (GTypeModule *gmodule)
return TRUE;
}
}
else
g_warning ("Broken plugin module [%s]", priv->path);

View File

@ -932,7 +932,6 @@ mutter_built_sources += wayland_protocol_sources
subdir('meta')
mutter_built_sources += mutter_enum_types
mutter_built_sources += mutter_version
libmutter = shared_library(libmutter_name,
mutter_sources,
@ -999,7 +998,6 @@ if have_introspection
libmutter_gir = gnome.generate_gir(libmutter,
sources: [
mutter_version,
mutter_enum_types[1],
mutter_introspected_sources,
mutter_public_header_files

View File

@ -71,26 +71,3 @@ mutter_enum_types = gnome.mkenums('meta-enum-types',
install_dir: mutter_includedir,
install_header: true,
)
mutter_version_array = meson.project_version().split('.')
mutter_version_major = mutter_version_array[0]
mutter_version_minor = mutter_version_array[1]
mutter_version_micro = mutter_version_array[2]
mutter_version_cdata = configuration_data()
mutter_version_cdata.set('MUTTER_MAJOR_VERSION',
'@0@'.format(mutter_version_major))
mutter_version_cdata.set('MUTTER_MINOR_VERSION',
'@0@'.format(mutter_version_minor))
mutter_version_cdata.set('MUTTER_MICRO_VERSION',
'@0@'.format(mutter_version_micro))
mutter_version_cdata.set('MUTTER_PLUGIN_API_VERSION',
'@0@'.format(mutter_plugin_api_version))
mutter_version = configure_file(
input: 'meta-version.h.in',
output: 'meta-version.h',
configuration: mutter_version_cdata,
install_dir: mutter_includedir,
install: true,
)

View File

@ -30,7 +30,6 @@
#include "meta/compositor.h"
#include "meta/meta-close-dialog.h"
#include "meta/meta-inhibit-shortcuts-dialog.h"
#include "meta/meta-version.h"
#include "meta/types.h"
#define META_TYPE_PLUGIN (meta_plugin_get_type ())
@ -38,7 +37,6 @@
META_EXPORT
G_DECLARE_DERIVABLE_TYPE (MetaPlugin, meta_plugin, META, PLUGIN, GObject)
typedef struct _MetaPluginVersion MetaPluginVersion;
typedef struct _MetaPluginInfo MetaPluginInfo;
/**
@ -271,44 +269,10 @@ struct _MetaPluginInfo
META_EXPORT
const MetaPluginInfo * meta_plugin_get_info (MetaPlugin *plugin);
/**
* MetaPluginVersion:
* @version_major: major component of the version number of Meta with which the plugin was compiled
* @version_minor: minor component of the version number of Meta with which the plugin was compiled
* @version_micro: micro component of the version number of Meta with which the plugin was compiled
* @version_api: version of the plugin API
*/
struct _MetaPluginVersion
{
/*
* Version information; the first three numbers match the Meta version
* with which the plugin was compiled (see clutter-plugins/simple.c for sample
* code).
*/
guint version_major;
guint version_minor;
guint version_micro;
/*
* Version of the plugin API; this is unrelated to the matacity version
* per se. The API version is checked by the plugin manager and must match
* the one used by it (see clutter-plugins/default.c for sample code).
*/
guint version_api;
};
/*
* Convenience macro to set up the plugin type. Based on GEdit.
*/
#define META_PLUGIN_DECLARE_WITH_CODE(ObjectName, object_name, CODE) \
G_MODULE_EXPORT MetaPluginVersion meta_plugin_version = \
{ \
META_MAJOR_VERSION, \
META_MINOR_VERSION, \
META_MICRO_VERSION, \
META_PLUGIN_API_VERSION \
}; \
\
/* Prototypes */ \
G_MODULE_EXPORT GType \
object_name##_get_type (void); \

View File

@ -1,28 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2014 Rico Tzschichholz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef META_VERSION_H
#define META_VERSION_H
#define META_MAJOR_VERSION @MUTTER_MAJOR_VERSION@
#define META_MINOR_VERSION @MUTTER_MINOR_VERSION@
#define META_MICRO_VERSION @MUTTER_MICRO_VERSION@
#define META_PLUGIN_API_VERSION @MUTTER_PLUGIN_API_VERSION@
#endif