[gnome-builder] meson-templates: define Flatpak SDK from meson_options.txt



commit f6139231f663be821244b57d370ae7931539a44e
Author: Christian Hergert <chergert redhat com>
Date:   Sun Sep 19 12:08:47 2021 -0700

    meson-templates: define Flatpak SDK from meson_options.txt
    
    This will make it easier for us to pick a specific template version from
    the the build options rather than changing it continually on branches.

 meson_options.txt                                                 | 2 ++
 src/plugins/meson-templates/meson-templates.gresource.xml         | 4 +++-
 src/plugins/meson-templates/meson.build                           | 8 ++++++++
 .../meson-templates/resources/{flatpak.json => flatpak.json.in}   | 2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
index 7f3e11119..747e937ca 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,6 +4,8 @@ option('tcmalloc', type: 'boolean', value: false, description: 'Use tcmalloc for
 
 option('with_safe_path', type: 'string', value: '', description: 'PATH variable to run build commands 
(default: platform-specific)')
 
+option('gnome_sdk_version', type: 'string', value: 'master', description: 'The GNOME SDK release to use for 
templates')
+
 option('channel',
           type: 'combo',
        choices: [ 'other', 'flatpak-stable', 'flatpak-beta', 'flatpak-nightly' ],
diff --git a/src/plugins/meson-templates/meson-templates.gresource.xml 
b/src/plugins/meson-templates/meson-templates.gresource.xml
index dbc7d1d2a..3f96c5871 100644
--- a/src/plugins/meson-templates/meson-templates.gresource.xml
+++ b/src/plugins/meson-templates/meson-templates.gresource.xml
@@ -50,7 +50,6 @@
     <file compressed="true">resources/build-aux/meson/postinstall.py</file>
     <file compressed="true">resources/meson.build</file>
     <file compressed="true">resources/src/meson-cli.build</file>
-    <file compressed="true">resources/flatpak.json</file>
     <file compressed="true">resources/flatpak-gtksharp.json.tmpl</file>
     <file compressed="true">resources/data/meson.build</file>
     <file compressed="true">resources/data/hello.gschema.xml</file>
@@ -63,6 +62,9 @@
     <file compressed="true">resources/po/POTFILES</file>
     <file compressed="true">resources/po/LINGUAS</file>
   </gresource>
+  <gresource prefix="/plugins/meson_templates/resources">
+    <file compressed="true">flatpak.json</file>
+  </gresource>
   <gresource prefix="/org/gnome/builder">
     <file compressed="true">icons/scalable/actions/pattern-legacy.svg</file>
     <file compressed="true">icons/scalable/actions/pattern-library.svg</file>
diff --git a/src/plugins/meson-templates/meson.build b/src/plugins/meson-templates/meson.build
index bf60ab160..d2ce17c50 100644
--- a/src/plugins/meson-templates/meson.build
+++ b/src/plugins/meson-templates/meson.build
@@ -1,9 +1,17 @@
+flatpak_json_data = configuration_data()
+flatpak_json_data.set('gnome_sdk_version', get_option('gnome_sdk_version'))
+flatpak_json = configure_file(
+  input: 'resources/flatpak.json.in',
+  output: 'flatpak.json',
+  configuration: flatpak_json_data)
+
 meson_templates_resources = gnome.compile_resources(
   'meson_templates',
   'meson-templates.gresource.xml',
   gresource_bundle: true,
            install: true,
        install_dir: plugindir,
+      dependencies: [flatpak_json],
 )
 
 install_data('meson_templates.py', install_dir: plugindir)
diff --git a/src/plugins/meson-templates/resources/flatpak.json 
b/src/plugins/meson-templates/resources/flatpak.json.in
similarity index 99%
rename from src/plugins/meson-templates/resources/flatpak.json
rename to src/plugins/meson-templates/resources/flatpak.json.in
index fa872b9f6..64c3cac0c 100644
--- a/src/plugins/meson-templates/resources/flatpak.json
+++ b/src/plugins/meson-templates/resources/flatpak.json.in
@@ -1,7 +1,7 @@
 {
     "app-id" : "{{appid}}",
     "runtime" : "org.gnome.Platform",
-    "runtime-version" : "master",
+    "runtime-version" : "@gnome_sdk_version@",
     "sdk" : "org.gnome.Sdk",
 {{if language == "rust"}}
     "sdk-extensions" : [


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