Merged in feature/genie-tests (pull request #56)
Feature/genie tests
Approved-by: Elliott Sales de Andrade
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/reference/genie.xml Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,70 @@
+<?xml version='1.0' encoding="UTF-8"?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ +<chapter id="chapter-genie"> + <title>Genie Plugins</title> + You <emphasis role="strong">MUST</emphasis> have the Vala bindings + installed on your system for this to work. They are built by the + <title>Example Genie Plugin</title> + Like all plugins in GPlugin, Genie plugins must also implement + the <code>gplugin_query</code>, <code>gplugin_load</code>, and + <code>gplugin_unload</code> functions. + Due to the way <code>GPlugin.PluginInfo</code> info works, you must + subclass it and set your values in the new constructor. + The following is a basic Genie plugin. + <informalexample><programlisting> + class BasicPluginInfo : GPlugin.PluginInfo + authors : array of string = {"author1"} + id: "gplugin/genie-basic-plugin", + abi_version: 0x01020304, + description: "description" + def gplugin_query(out error : Error) : GPlugin.PluginInfo + return new BasicPluginInfo() + def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool + def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool + </programlisting></informalexample> --- a/gplugin/reference/gplugin-docs.xml Wed Feb 19 03:51:27 2020 +0000
+++ b/gplugin/reference/gplugin-docs.xml Wed Feb 19 04:11:26 2020 +0000
@@ -23,8 +23,9 @@
<xi:include href="embedding.xml"/>
+ <xi:include href="genie.xml"/> + <xi:include href="lua.xml"/> <xi:include href="native-plugins.xml"/>
- <xi:include href="lua.xml"/>
<xi:include href="python.xml"/>
<xi:include href="vala.xml"/>
--- a/gplugin/reference/meson.build Wed Feb 19 03:51:27 2020 +0000
+++ b/gplugin/reference/meson.build Wed Feb 19 04:11:26 2020 +0000
@@ -26,6 +26,7 @@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vala/tests/genie-plugins/basic.gs Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,49 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library 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 + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +class BasicPluginInfo : GPlugin.PluginInfo + authors : array of string = {"author1"} + id: "gplugin/genie-basic-plugin", + abi_version: 0x01020304, + description: "description" +def gplugin_query(out error : Error) : GPlugin.PluginInfo + return new BasicPluginInfo() +def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool +def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vala/tests/genie-plugins/dependent.gs Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,41 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library 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 + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +class DependentPluginInfo : GPlugin.PluginInfo + dependencies : array of string = {"dependency1", "dependency2"} + id: "gplugin/genie-dependent-plugin", + dependencies: dependencies +def gplugin_query(out error : Error) : GPlugin.PluginInfo + return new DependentPluginInfo() +def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool +def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vala/tests/genie-plugins/load-exception.gs Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,38 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library 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 + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +class LoadExceptionPluginInfo : GPlugin.PluginInfo + id: "gplugin/genie-load-exception" +def gplugin_query(out error : Error) : GPlugin.PluginInfo + return new LoadExceptionPluginInfo() +def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool + error = new Error(Quark.from_string("gplugin"), 0, "explode") +def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vala/tests/genie-plugins/load-failed.gs Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,38 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library 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 + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +class LoadFailedPluginInfo : GPlugin.PluginInfo + id: "gplugin/genie-load-failed" +def gplugin_query(out error : Error) : GPlugin.PluginInfo + return new LoadFailedPluginInfo() +def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool +def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vala/tests/genie-plugins/meson.build Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,17 @@
+ shared_library('genie-basic-plugin', 'basic.gs', + dependencies : [gplugin_dep, gplugin_vapi]) + shared_library('genie-dependent-plugin', 'dependent.gs', + dependencies : [gplugin_dep, gplugin_vapi]) + shared_library('load-exception-plugin', 'load-exception.gs', + dependencies : [gplugin_dep, gplugin_vapi]) + shared_library('load-failed-plugin', 'load-failed.gs', + dependencies : [gplugin_dep, gplugin_vapi]) + shared_library('unload-failed-plugin', 'unload-failed.gs', + dependencies : [gplugin_dep, gplugin_vapi]) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vala/tests/genie-plugins/unload-failed.gs Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,38 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library 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 + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +class UnloadFailedPluginInfo : GPlugin.PluginInfo + id: "gplugin/genie-unload-failed" +def gplugin_query(out error : Error) : GPlugin.PluginInfo + return new UnloadFailedPluginInfo() +def gplugin_load(plugin : GPlugin.Plugin, out error : Error) : bool +def gplugin_unload(plugin : GPlugin.Plugin, out error : Error) : bool --- a/vala/tests/meson.build Wed Feb 19 03:51:27 2020 +0000
+++ b/vala/tests/meson.build Wed Feb 19 04:11:26 2020 +0000
@@ -9,6 +9,16 @@
dependencies : [GLIB, GOBJECT, gplugin_dep])
+e = executable('test-genie-loading', 'test-genie-loading.c', + include_directories : include_directories('.'), + '-DGENIE_PLUGIN_DIR="@0@/genie-plugins"'.format(meson.current_build_dir()), + link_with : gplugin_loader_tests, + dependencies : [GLIB, GOBJECT, gplugin_dep]) +test('Genie loading', e) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vala/tests/test-genie-loading.c Wed Feb 19 04:11:26 2020 +0000
@@ -0,0 +1,33 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library 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 + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#include <gplugin/gplugin-loader-tests.h> +/****************************************************************************** + *****************************************************************************/ +main(gint argc, gchar **argv) { + g_test_init(&argc, &argv, NULL); + gplugin_loader_tests_main(NULL, GENIE_PLUGIN_DIR, "genie");