[gnome-builder/wip/gtk4-port: 1394/1774] plugins/make-templates: move make templates into separate plugin
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1394/1774] plugins/make-templates: move make templates into separate plugin
- Date: Mon, 11 Jul 2022 22:31:44 +0000 (UTC)
commit 972dcea69fa5850207d2e2902c4423189ea73d6c
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 7 13:47:57 2022 -0700
plugins/make-templates: move make templates into separate plugin
This is just nice in that it could allow us to build make projects even
if we decide to not have templates for them at some point (or perhaps even
break those out into an extension download).
meson_options.txt | 1 +
.../gbp-make-template-provider.c | 2 +-
.../gbp-make-template-provider.h | 0
.../{make => make-templates}/gbp-make-template.c | 6 ++--
.../{make => make-templates}/gbp-make-template.h | 0
src/plugins/make-templates/make-templates-plugin.c | 38 ++++++++++++++++++++++
.../make-templates/make-templates.gresource.xml | 10 ++++++
src/plugins/make-templates/make-templates.plugin | 10 ++++++
src/plugins/make-templates/meson.build | 17 ++++++++++
.../{make => make-templates}/resources/.gitignore | 0
.../{make => make-templates}/resources/Makefile | 0
.../{make => make-templates}/resources/main.c | 0
.../{make => make-templates}/resources/main.cpp | 0
src/plugins/make/make-plugin.c | 4 ---
src/plugins/make/make.gresource.xml | 4 ---
src/plugins/make/meson.build | 2 --
src/plugins/meson.build | 2 ++
17 files changed, 82 insertions(+), 14 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
index 77e07973e..682e5c8fd 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -58,6 +58,7 @@ option('plugin_jdtls', type: 'boolean')
option('plugin_jedi_language_server', type: 'boolean')
option('plugin_jhbuild', type: 'boolean')
option('plugin_make', type: 'boolean')
+option('plugin_make_templates', type: 'boolean')
option('plugin_markdown_preview', type: 'boolean')
option('plugin_maven', type: 'boolean')
option('plugin_meson', type: 'boolean')
diff --git a/src/plugins/make/gbp-make-template-provider.c
b/src/plugins/make-templates/gbp-make-template-provider.c
similarity index 97%
rename from src/plugins/make/gbp-make-template-provider.c
rename to src/plugins/make-templates/gbp-make-template-provider.c
index e78ed177f..72b16ac6a 100644
--- a/src/plugins/make/gbp-make-template-provider.c
+++ b/src/plugins/make-templates/gbp-make-template-provider.c
@@ -44,7 +44,7 @@ gbp_make_template_provider_get_project_templates (IdeTemplateProvider *provider)
list = g_list_prepend (list,
g_object_new (GBP_TYPE_MAKE_TEMPLATE,
- "id", "empty-makefile",
+ "id", "make-templates:empty",
"name", _("Empty Makefile Project"),
"description", _("Create a new empty project using a simple
Makefile"),
"languages", IDE_STRV_INIT ("C", "C++"),
diff --git a/src/plugins/make/gbp-make-template-provider.h
b/src/plugins/make-templates/gbp-make-template-provider.h
similarity index 100%
rename from src/plugins/make/gbp-make-template-provider.h
rename to src/plugins/make-templates/gbp-make-template-provider.h
diff --git a/src/plugins/make/gbp-make-template.c b/src/plugins/make-templates/gbp-make-template.c
similarity index 95%
rename from src/plugins/make/gbp-make-template.c
rename to src/plugins/make-templates/gbp-make-template.c
index 0547a63bc..58b487a69 100644
--- a/src/plugins/make/gbp-make-template.c
+++ b/src/plugins/make-templates/gbp-make-template.c
@@ -39,9 +39,9 @@ static const struct {
const char *path;
int mode;
} mappings[] = {
- { NULL, "/plugins/make/resources/Makefile", "Makefile", 0640 },
- { "C", "/plugins/make/resources/main.c", "main.c", 0640 },
- { "C++", "/plugins/make/resources/main.cpp", "main.cpp", 0640 },
+ { NULL, "/plugins/make-templates/resources/Makefile", "Makefile", 0640 },
+ { "C", "/plugins/make-templates/resources/main.c", "main.c", 0640 },
+ { "C++", "/plugins/make-templates/resources/main.cpp", "main.cpp", 0640 },
};
static void
diff --git a/src/plugins/make/gbp-make-template.h b/src/plugins/make-templates/gbp-make-template.h
similarity index 100%
rename from src/plugins/make/gbp-make-template.h
rename to src/plugins/make-templates/gbp-make-template.h
diff --git a/src/plugins/make-templates/make-templates-plugin.c
b/src/plugins/make-templates/make-templates-plugin.c
new file mode 100644
index 000000000..8f1e81e66
--- /dev/null
+++ b/src/plugins/make-templates/make-templates-plugin.c
@@ -0,0 +1,38 @@
+/* make-templates-plugin.c
+ *
+ * Copyright 2017 Matthew Leeds <mleeds redhat com>
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * 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 3 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/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "make-templates-plugin"
+
+#include "config.h"
+
+#include <libpeas/peas.h>
+
+#include <libide-projects.h>
+
+#include "gbp-make-template-provider.h"
+
+_IDE_EXTERN void
+_gbp_make_templates_register_types (PeasObjectModule *module)
+{
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_TEMPLATE_PROVIDER,
+ GBP_TYPE_MAKE_TEMPLATE_PROVIDER);
+}
diff --git a/src/plugins/make-templates/make-templates.gresource.xml
b/src/plugins/make-templates/make-templates.gresource.xml
new file mode 100644
index 000000000..eba54403c
--- /dev/null
+++ b/src/plugins/make-templates/make-templates.gresource.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/plugins/make-templates">
+ <file>make-templates.plugin</file>
+ <file compressed="true">resources/Makefile</file>
+ <file compressed="true">resources/main.c</file>
+ <file compressed="true">resources/main.cpp</file>
+ <file compressed="true">resources/.gitignore</file>
+ </gresource>
+</gresources>
diff --git a/src/plugins/make-templates/make-templates.plugin
b/src/plugins/make-templates/make-templates.plugin
new file mode 100644
index 000000000..8d1f300dd
--- /dev/null
+++ b/src/plugins/make-templates/make-templates.plugin
@@ -0,0 +1,10 @@
+[Plugin]
+Authors=Matthew Leeds <mleeds redhat com>, Christian Hergert <chergert redhat com>
+Builtin=true
+Copyright=Copyright © 2017 Matthew Leeds, Copyright © 2022 Christian Hergert
+Depends=create-project;
+Description=Provides templates for creating Makefile-based projects
+Embedded=_gbp_make_templates_register_types
+Module=make-templates
+Name=Makefile Templates
+X-Category=templates
diff --git a/src/plugins/make-templates/meson.build b/src/plugins/make-templates/meson.build
new file mode 100644
index 000000000..1376df82c
--- /dev/null
+++ b/src/plugins/make-templates/meson.build
@@ -0,0 +1,17 @@
+if get_option('plugin_make_templates')
+
+plugins_sources += files([
+ 'make-templates-plugin.c',
+ 'gbp-make-template.c',
+ 'gbp-make-template-provider.c',
+])
+
+plugin_make_templates_resources = gnome.compile_resources(
+ 'make-templates-resources',
+ 'make-templates.gresource.xml',
+ c_name: 'gbp_make_templates',
+)
+
+plugins_sources += plugin_make_templates_resources
+
+endif
diff --git a/src/plugins/make/resources/.gitignore b/src/plugins/make-templates/resources/.gitignore
similarity index 100%
rename from src/plugins/make/resources/.gitignore
rename to src/plugins/make-templates/resources/.gitignore
diff --git a/src/plugins/make/resources/Makefile b/src/plugins/make-templates/resources/Makefile
similarity index 100%
rename from src/plugins/make/resources/Makefile
rename to src/plugins/make-templates/resources/Makefile
diff --git a/src/plugins/make/resources/main.c b/src/plugins/make-templates/resources/main.c
similarity index 100%
rename from src/plugins/make/resources/main.c
rename to src/plugins/make-templates/resources/main.c
diff --git a/src/plugins/make/resources/main.cpp b/src/plugins/make-templates/resources/main.cpp
similarity index 100%
rename from src/plugins/make/resources/main.cpp
rename to src/plugins/make-templates/resources/main.cpp
diff --git a/src/plugins/make/make-plugin.c b/src/plugins/make/make-plugin.c
index 3a73f19da..49982b3c8 100644
--- a/src/plugins/make/make-plugin.c
+++ b/src/plugins/make/make-plugin.c
@@ -34,7 +34,6 @@
#include "gbp-make-build-target-provider.h"
#include "gbp-make-pipeline-addin.h"
#include "gbp-make-run-command-provider.h"
-#include "gbp-make-template-provider.h"
_IDE_EXTERN void
_gbp_make_register_types (PeasObjectModule *module)
@@ -54,7 +53,4 @@ _gbp_make_register_types (PeasObjectModule *module)
peas_object_module_register_extension_type (module,
IDE_TYPE_RUN_COMMAND_PROVIDER,
GBP_TYPE_MAKE_RUN_COMMAND_PROVIDER);
- peas_object_module_register_extension_type (module,
- IDE_TYPE_TEMPLATE_PROVIDER,
- GBP_TYPE_MAKE_TEMPLATE_PROVIDER);
}
diff --git a/src/plugins/make/make.gresource.xml b/src/plugins/make/make.gresource.xml
index ea1d38eb0..79cb2fc06 100644
--- a/src/plugins/make/make.gresource.xml
+++ b/src/plugins/make/make.gresource.xml
@@ -2,9 +2,5 @@
<gresources>
<gresource prefix="/plugins/make">
<file>make.plugin</file>
- <file compressed="true">resources/Makefile</file>
- <file compressed="true">resources/main.c</file>
- <file compressed="true">resources/main.cpp</file>
- <file compressed="true">resources/.gitignore</file>
</gresource>
</gresources>
diff --git a/src/plugins/make/meson.build b/src/plugins/make/meson.build
index d66862117..62f9326df 100644
--- a/src/plugins/make/meson.build
+++ b/src/plugins/make/meson.build
@@ -8,8 +8,6 @@ plugins_sources += files([
'gbp-make-build-target-provider.c',
'gbp-make-pipeline-addin.c',
'gbp-make-run-command-provider.c',
- 'gbp-make-template.c',
- 'gbp-make-template-provider.c',
])
plugin_make_resources = gnome.compile_resources(
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 27f184111..0b17fe07a 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -89,6 +89,7 @@ subdir('jedi-language-server')
subdir('jhbuild')
subdir('ls')
subdir('make')
+subdir('make-templates')
subdir('markdown-preview')
subdir('maven')
subdir('meson')
@@ -179,6 +180,7 @@ status += [
'HTML Preview ......................... : @0@'.format(get_option('plugin_html_preview')),
'JHBuild .............................. : @0@'.format(get_option('plugin_jhbuild')),
'Make ................................. : @0@'.format(get_option('plugin_make')),
+ 'Make Templates ....................... : @0@'.format(get_option('plugin_make_templates')),
'Markdown Preview ..................... : @0@'.format(get_option('plugin_markdown_preview')),
'Maven ................................ : @0@'.format(get_option('plugin_maven')),
'Meson ................................ : @0@'.format(get_option('plugin_meson')),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]