[gnome-builder] meson-templates: add Empty template



commit bf40fc45758885d324289af997e8c7d2d8caa19e
Author: Christian Hergert <chergert redhat com>
Date:   Sat Sep 16 15:58:01 2017 -0700

    meson-templates: add Empty template
    
    Also adds C++ as an option, since it's just a change to the
    init languages of the meson project directive.

 .../meson-templates/meson_templates/__init__.py    |    9 +++++--
 .../meson_templates/resources/meson.build          |   22 +++++++++++++------
 2 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/plugins/meson-templates/meson_templates/__init__.py 
b/plugins/meson-templates/meson_templates/__init__.py
index 087d0d1..84e9388 100644
--- a/plugins/meson-templates/meson_templates/__init__.py
+++ b/plugins/meson-templates/meson_templates/__init__.py
@@ -45,7 +45,7 @@ def get_module_data_path(name):
 
 class LibraryTemplateProvider(GObject.Object, Ide.TemplateProvider):
     def do_get_project_templates(self):
-        return [GnomeProjectTemplate(), LibraryProjectTemplate()]
+        return [GnomeProjectTemplate(), LibraryProjectTemplate(), EmptyProjectTemplate()]
 
 
 class MesonTemplateLocator(Template.TemplateLocator):
@@ -108,7 +108,7 @@ class MesonTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
         else:
             self.language = 'c'
 
-        if self.language not in ('c', 'javascript', 'python', 'vala'):
+        if self.language not in ('c', 'c++', 'javascript', 'python', 'vala'):
             task.return_error(GLib.Error('Language %s not supported' %
                                          self.language))
             return
@@ -304,5 +304,8 @@ class EmptyProjectTemplate(MesonTemplate):
             _('Empty Project'),
             'pattern-library',
             _('Create a new empty project'),
-            ['C']
+            ['C', 'C++', 'JavaScript', 'Python', 'Vala'],
          )
+
+    def prepare_files(self, files):
+        files['resources/src/meson-empty.build'] = 'src/meson.build'
diff --git a/plugins/meson-templates/meson_templates/resources/meson.build 
b/plugins/meson-templates/meson_templates/resources/meson.build
index 64347cb..3ee0032 100644
--- a/plugins/meson-templates/meson_templates/resources/meson.build
+++ b/plugins/meson-templates/meson_templates/resources/meson.build
@@ -1,13 +1,16 @@
-project('{{name}}',{{if language == "c"}}'c',{{else if language == "vala"}}'c', 'vala',{{end}}
-  version: '{{project_version}}',
+project('{{name}}',{{if language == "c"}} 'c',{{else if language == "c++"}} 'cpp',{{else if language == 
"vala"}} 'c', 'vala',{{end}}
+        version: '{{project_version}}',
   meson_version: '>= 0.40.0',
 )
 {{if enable_i18n}}
 i18n = import('i18n'){{end}}
 
-{{if language == "c"}}config_h = configuration_data()
-{{if enable_i18n}}config_h.set_quoted('GETTEXT_PACKAGE', '{{name}}')
-config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))){{end}}
+{{if language == "c"}}
+config_h = configuration_data()
+{{if enable_i18n}}
+config_h.set_quoted('GETTEXT_PACKAGE', '{{name}}')
+config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
+{{end}}
 configure_file(
   output: '{{prefix}}-config.h',
   configuration: config_h,
@@ -16,9 +19,14 @@ add_project_arguments([
   '-I' + meson.build_root(),
 ], language: 'c')
 {{end}}
+
 {{if enable_gnome}}
-subdir('data'){{end}}
+subdir('data')
+{{end}}
 subdir('src')
-{{if enable_i18n}}subdir('po'){{end}}
+{{if enable_i18n}}
+subdir('po')
+{{end}}
+
 {{if enable_gnome}}
 meson.add_install_script('build-aux/meson/postinstall.py'){{end}}
diff --git a/plugins/meson-templates/meson_templates/resources/src/meson-empty.build 
b/plugins/meson-templates/meson_templates/resources/src/meson-empty.build
new file mode 100644
index 0000000..e69de29


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]