[connections/add-dev-profile: 1/3] build: Add "development" build profile




commit 9a2bdb0456f84c8dff87406f1eb0db5766ae7e74
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Oct 19 12:21:18 2020 +0200

    build: Add "development" build profile

 build-aux/flatpak/org.gnome.Connections.json |  5 ++++-
 data/meson.build                             |  6 +++---
 meson.build                                  | 10 ++++++++++
 meson_options.txt                            |  7 +++++++
 src/application.vala                         |  2 +-
 src/config.vapi                              |  1 +
 src/window.vala                              |  4 ++++
 7 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Connections.json b/build-aux/flatpak/org.gnome.Connections.json
index 9be3800..ecf7d3c 100644
--- a/build-aux/flatpak/org.gnome.Connections.json
+++ b/build-aux/flatpak/org.gnome.Connections.json
@@ -1,5 +1,5 @@
 {
-    "app-id": "org.gnome.Connections",
+    "app-id": "org.gnome.Connections.Devel",
     "runtime": "org.gnome.Platform",
     "runtime-version": "master",
     "sdk": "org.gnome.Sdk",
@@ -82,6 +82,9 @@
             "name": "connections",
             "builddir": true,
             "buildsystem": "meson",
+            "config-opts": [
+                "-Dprofile=development"
+            ],
             "sources": [
                 {
                     "type": "git",
diff --git a/data/meson.build b/data/meson.build
index f1ffb45..cf4a6f6 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,6 +1,6 @@
 desktop_file = i18n.merge_file(
   input: 'org.gnome.Connections.desktop.in',
-  output: 'org.gnome.Connections.desktop',
+  output: '@0@.desktop'.format(application_id),
   type: 'desktop',
   po_dir: '../po',
   install: true,
@@ -16,7 +16,7 @@ endif
 
 appstream_file = i18n.merge_file(
   input: 'org.gnome.Connections.appdata.xml.in',
-  output: 'org.gnome.Connections.appdata.xml',
+  output: '@0  appdata xml'.format(application_id),
   po_dir: '../po',
   install: true,
   install_dir: join_paths(get_option('datadir'), 'appdata')
@@ -33,7 +33,7 @@ dbus_conf = configuration_data ()
 dbus_conf.set ('bindir', join_paths (get_option ('prefix'), get_option ('bindir')))
 configure_file (
   input: 'org.gnome.Connections.service.in',
-  output: 'org.gnome.Connections.service',
+  output: '@0@.service'.format(application_id),
   configuration: dbus_conf,
   install: true,
   install_dir: join_paths (get_option('datadir'), 'dbus-1', 'services')
diff --git a/meson.build b/meson.build
index a52779d..cdf0d0c 100644
--- a/meson.build
+++ b/meson.build
@@ -17,6 +17,16 @@ conf.set_quoted ('GETTEXT_PACKAGE', meson.project_name ())
 conf.set_quoted ('LOCALEDIR', locale_dir)
 conf.set_quoted ('VERSION', '@0@-@VCS_TAG@'.format (meson.project_version()))
 
+if get_option ('profile') == 'development'
+  profile = '.Devel'
+else
+  profile = ''
+endif
+
+application_id = 'org.gnome.Connections@0@'.format (profile)
+conf.set_quoted ('PROFILE', profile)
+conf.set_quoted ('APPLICATION_ID', application_id)
+
 config_h = declare_dependency (
   sources: vcs_tag (
     command: ['git', 'rev-parse', '--short', 'HEAD'],
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..a8b495e
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,7 @@
+option ('profile',
+  type: 'combo', choices: [
+    'default',
+    'development'
+  ],
+  value: 'default'
+)
diff --git a/src/application.vala b/src/application.vala
index c614ae2..65ae11b 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -40,7 +40,7 @@ namespace Connections {
         public Application () {
             application = this;
 
-            application_id = "org.gnome.Connections";
+            application_id = Config.APPLICATION_ID;
             flags |= ApplicationFlags.HANDLES_COMMAND_LINE | ApplicationFlags.HANDLES_OPEN;
 
             var action = new GLib.SimpleAction ("help", null);
diff --git a/src/config.vapi b/src/config.vapi
index a4ee9b7..634d251 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -3,4 +3,5 @@ namespace Config {
     public const string GETTEXT_PACKAGE;
     public const string LOCALEDIR;
     public const string VERSION;
+    public const string APPLICATION_ID;
 }
diff --git a/src/window.vala b/src/window.vala
index b47cda4..342deae 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -63,6 +63,10 @@ namespace Connections {
             }
 
             topbar.search_button.bind_property ("active", collection_view.search_bar, "search_mode_enabled", 
BindingFlags.BIDIRECTIONAL);
+
+            if (app.application_id == "org.gnome.Connections.Devel") {
+                get_style_context ().add_class ("devel");
+            }
         }
 
         public void bind_model (ListModel model) {


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