[gnome-font-viewer/wip/cosimoc/nightly-flatpak] Support building a nightly flatpak



commit 5dd71a67f7d0cc6aa73105e084fe3ac00d9b235e
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Sep 28 16:35:34 2019 -0700

    Support building a nightly flatpak
    
    This allows to build a development version of the flatpak that
    can be installed alongside the default one.
    We also switch the CI job to do that.

 .gitlab-ci.yml                                             | 10 +++++-----
 ...ont-viewer.Devel.svg => org.gnome.font-viewerDevel.svg} |  0
 data/icons/meson.build                                     |  2 +-
 ...me.font-viewer.json => org.gnome.font-viewerDevel.json} |  7 ++++++-
 meson.build                                                |  9 +++++++++
 meson_options.txt                                          |  1 +
 src/font-view.c                                            |  4 ++--
 src/meson.build                                            | 14 +++++++++++---
 ...ewer.desktop.in => org.gnome.font-viewer.desktop.in.in} |  2 +-
 src/org.gnome.font-viewer.service.in                       |  2 +-
 10 files changed, 37 insertions(+), 14 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d1dbb72..2ef96ed 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,23 +2,23 @@ stages:
   - build
 
 variables:
-  BUNDLE: 'org.gnome.font-viewer.Devel.flatpak'
+  BUNDLE: 'org.gnome.font-viewerDevel.flatpak'
 
 flatpak:
   image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
   stage: 'build'
   variables:
-    MANIFEST_PATH: 'flatpak/org.gnome.font-viewer.json'
-    MESON_ARGS: ''
+    MANIFEST_PATH: 'flatpak/org.gnome.font-viewerDevel.json'
+    MESON_ARGS: '-Dprofile=development'
     RUNTIME_REPO: 'https://sdk.gnome.org/gnome-nightly.flatpakrepo'
     FLATPAK_MODULE: 'gnome-font-viewer'
-    DBUS_ID: 'org.gnome.font-viewer'
+    APP_ID: 'org.gnome.font-viewerDevel'
   script:
     - flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
     - flatpak build app meson --prefix=/app ${MESON_ARGS} _build
     - flatpak build app ninja -C _build install
     - flatpak-builder --finish-only --repo=repo app ${MANIFEST_PATH}
-    - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${DBUS_ID}
+    - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID}
 
   artifacts:
     paths:
diff --git a/data/icons/hicolor/scalable/apps/org.gnome.font-viewer.Devel.svg 
b/data/icons/hicolor/scalable/apps/org.gnome.font-viewerDevel.svg
similarity index 100%
rename from data/icons/hicolor/scalable/apps/org.gnome.font-viewer.Devel.svg
rename to data/icons/hicolor/scalable/apps/org.gnome.font-viewerDevel.svg
diff --git a/data/icons/meson.build b/data/icons/meson.build
index 366c94c..13ffa09 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -1,6 +1,6 @@
 scalable_icondir = join_paths('hicolor', 'scalable', 'apps')
 install_data (
-  join_paths(scalable_icondir, 'org.gnome.font-viewer.svg'),
+  join_paths(scalable_icondir, '@0@.svg'.format(application_id)),
   install_dir: join_paths(datadir, 'icons', scalable_icondir)
 )
 
diff --git a/flatpak/org.gnome.font-viewer.json b/flatpak/org.gnome.font-viewerDevel.json
similarity index 80%
rename from flatpak/org.gnome.font-viewer.json
rename to flatpak/org.gnome.font-viewerDevel.json
index 1b50f30..60b44d7 100644
--- a/flatpak/org.gnome.font-viewer.json
+++ b/flatpak/org.gnome.font-viewerDevel.json
@@ -1,8 +1,12 @@
 {
-    "app-id": "org.gnome.font-viewer",
+    "app-id": "org.gnome.font-viewerDevel",
     "runtime": "org.gnome.Platform",
     "sdk": "org.gnome.Sdk",
     "command": "gnome-font-viewer",
+    "rename-appdata-file": "org.gnome.font-viewer.appdata.xml",
+    "rename-desktop-file": "org.gnome.font-viewer.desktop",
+    "tags": ["nightly"],
+    "desktop-file-name-prefix": "(Development) ",
     "finish-args": [
         "--device=dri",
         "--share=ipc",
@@ -36,6 +40,7 @@
         {
             "name": "gnome-font-viewer",
             "buildsystem": "meson",
+            "config-opts": ["-Dprofile=development"],
             "sources": [
                 {
                     "type": "dir",
diff --git a/meson.build b/meson.build
index 0d7f32c..3f3bcea 100644
--- a/meson.build
+++ b/meson.build
@@ -34,10 +34,19 @@ freetype2_dep = dependency('freetype2')
 gnomedesktop_dep = dependency('gnome-desktop-3.0')
 mathlib_dep = cc.find_library('m')
 
+if get_option('profile') == 'development'
+  profile = 'Devel'
+else
+  profile = ''
+endif
+
+application_id = 'org.gnome.font-viewer@0@'.format(profile)
+
 config_h = configuration_data()
 config_h.set_quoted('VERSION', meson.project_version())
 config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
 config_h.set_quoted('GNOMELOCALEDIR', localedir)
+config_h.set_quoted('APPLICATION_ID', application_id)
 configure_file(output: 'config.h', configuration: config_h)
 
 root_inc = include_directories('.')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..a6631f6
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('profile', type: 'combo', choices: ['default', 'development'], value: 'default', description: 'Build 
profiles')
diff --git a/src/font-view.c b/src/font-view.c
index a7568eb..2c7e02d 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -44,7 +44,7 @@
 #include "sushi-font-widget.h"
 
 #define FONT_VIEW_TYPE_APPLICATION (font_view_application_get_type ())
-#define FONT_VIEW_ICON_NAME "org.gnome.font-viewer"
+#define FONT_VIEW_ICON_NAME APPLICATION_ID
 
 G_DECLARE_FINAL_TYPE (FontViewApplication, font_view_application,
                       FONT_VIEW, APPLICATION,
@@ -1546,7 +1546,7 @@ static GApplication *
 font_view_application_new (void)
 {
     return g_object_new (FONT_VIEW_TYPE_APPLICATION,
-                         "application-id", "org.gnome.font-viewer",
+                         "application-id", APPLICATION_ID,
                          "flags", G_APPLICATION_HANDLES_OPEN,
                          NULL);
 }
diff --git a/src/meson.build b/src/meson.build
index 3084688..6abf610 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -37,8 +37,14 @@ executable('gnome-font-viewer', viewer_sources + resources,
   install: true)
 
 desktop_file = 'org.gnome.font-viewer.desktop'
+
+desktop_conf = configuration_data()
+desktop_conf.set('VERSION', meson.project_version())
+desktop_conf.set('APPLICATION_ID', application_id)
 i18n.merge_file(desktop_file,
-  input: desktop_file + '.in',
+  input: configure_file(input: desktop_file + '.in.in',
+    output: desktop_file + '.in',
+    configuration: desktop_conf),
   output: desktop_file,
   po_dir: '../po',
   install: true,
@@ -46,11 +52,13 @@ i18n.merge_file(desktop_file,
   type: 'desktop'
 )
 
+service_file = 'org.gnome.font-viewer.service'
+
 service_conf = configuration_data()
 service_conf.set('bindir', bindir)
-service_file = 'org.gnome.font-viewer.service'
+service_conf.set('application_id', application_id)
 configure_file(input: service_file + '.in',
-  output: service_file,
+  output: '@0@.service'.format(application_id),
   configuration: service_conf,
   install: true,
   install_dir: servicesdir)
diff --git a/src/org.gnome.font-viewer.desktop.in b/src/org.gnome.font-viewer.desktop.in.in
similarity index 96%
rename from src/org.gnome.font-viewer.desktop.in
rename to src/org.gnome.font-viewer.desktop.in.in
index 9aeeab8..a303640 100644
--- a/src/org.gnome.font-viewer.desktop.in
+++ b/src/org.gnome.font-viewer.desktop.in.in
@@ -4,7 +4,7 @@ Comment=View fonts on your system
 # Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list 
MUST also end with a semicolon!
 Keywords=fonts;fontface;
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=org.gnome.font-viewer
+Icon=@APPLICATION_ID@
 Exec=gnome-font-viewer %u
 Terminal=false
 Type=Application
diff --git a/src/org.gnome.font-viewer.service.in b/src/org.gnome.font-viewer.service.in
index d8c89a3..aa74cf9 100644
--- a/src/org.gnome.font-viewer.service.in
+++ b/src/org.gnome.font-viewer.service.in
@@ -1,3 +1,3 @@
 [D-BUS Service]
-Name=org.gnome.font-viewer
+Name=@application_id@
 Exec=@bindir@/gnome-font-viewer --gapplication-service


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