build: Set up dual install for flatpak

Part of https://gitlab.gnome.org/GNOME/Initiatives/issues/1;
Sets up dual installation for flatpaks, allowing us to
build and run geary without affecting our system install.
This will allow testing of nightlies and CI artifacts as well
via the flatpak, so we can iterate on designs and share
bundles to test with.
This commit is contained in:
Christopher Davis 2019-05-03 19:47:57 -04:00
parent c3fc7c4533
commit bfcee9bff7
26 changed files with 127 additions and 121 deletions

View file

@ -81,10 +81,10 @@ ubuntu:
flatpak:
image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
variables:
APP_ID: org.gnome.Geary
APP_ID: org.gnome.GearyDevel
FLATPAK_MODULE: geary
MANIFEST_PATH: org.gnome.Geary.json
MESON_ARGS: "-Dprofile=Devel"
MESON_ARGS: "-Dprofile=development"
RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo"
TEST_RUN_ARGS: $TEST_ARGS
extends: .flatpak

View file

@ -5,7 +5,7 @@ Comment=Send and receive email
# Translators: These are desktop search terms. Do not translate semicolons, end line with a semicolon.
Keywords=Email;E-mail;Mail;
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=org.gnome.Geary
Icon=@appid@
TryExec=geary
Exec=geary --gapplication-service
Type=Application

View file

@ -2,25 +2,44 @@
# Desktop files
#
desktop_src = [
'org.gnome.Geary.desktop',
'geary-autostart.desktop'
]
desktop_output = []
desktop_conf = configuration_data()
desktop_conf.set('appid', geary_id)
foreach desktop_file: desktop_src
desktop_merged = i18n.merge_file(
input: desktop_file + '.in',
output: desktop_file,
desktop_file = i18n.merge_file(
input: configure_file(
input: 'org.gnome.Geary.desktop.in.in',
output: 'org.gnome.Geary.desktop.in',
configuration: desktop_conf
),
output: '@0@.desktop'.format(geary_id),
type: 'desktop',
po_dir: po_dir,
install: true,
install_dir: join_paths(datadir, 'applications')
)
desktop_output += desktop_file
autostart_file = i18n.merge_file(
input: configure_file(
input: 'geary-autostart.desktop.in.in',
output: 'geary-autostart.desktop.in',
configuration: desktop_conf
),
output: 'geary-autostart.desktop',
type: 'desktop',
po_dir: po_dir,
install: true,
install_dir: join_paths(datadir, 'applications')
)
desktop_output += autostart_file
foreach desktop_file: desktop_output
if desktop_file_validate.found()
test(
desktop_file + '-validate',
'desktop-file-validate',
desktop_file_validate,
args: [ desktop_merged.full_path() ]
args: [ desktop_file.full_path() ]
)
endif
endforeach
@ -32,8 +51,12 @@ endforeach
appdata_file = 'org.gnome.Geary.appdata.xml'
appdata_merged = i18n.merge_file(
input: appdata_file + '.in',
output: appdata_file,
input: configure_file(
input: appdata_file + '.in.in',
output: appdata_file + '.in',
configuration: desktop_conf
),
output: '@0@.appdata.xml'.format(geary_id),
type: 'xml',
po_dir: po_dir,
install: true,
@ -94,10 +117,11 @@ install_data('org.gnome.Geary.gschema.xml',
service_conf = configuration_data()
service_conf.set('bindir', bindir)
service_conf.set('appid', geary_id)
configure_file(
input: 'org.gnome.Geary.service.in',
output: 'org.gnome.Geary.service',
output: '@0@.service'.format(geary_id),
configuration: service_conf,
install: true,
install_dir: dbus_services_dir

View file

@ -3,7 +3,7 @@
<!-- Copyright 2016, 2019 Michael Gratton <mike@vee.net> -->
<component type="desktop-application">
<id>org.gnome.Geary.desktop</id>
<id>@appid@.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1+</project_license>
<update_contact>geary-list@gnome.org</update_contact>
@ -81,10 +81,10 @@
and the proper app id is listed here here, instead of the
other way around.
-->
<id>org.gnome.Geary</id>
<id>@appid@</id>
</provides>
<launchable type="desktop-id">org.gnome.Geary.desktop</launchable>
<launchable type="desktop-id">@appid@.desktop</launchable>
<translation type="gettext">geary</translation>

View file

@ -5,7 +5,7 @@ Comment=Send and receive email
# Translators: These are desktop search terms. Do not translate semicolons, end line with a semicolon.
Keywords=Mail;E-mail;IMAP;GMail;Yahoo;Hotmail;Outlook;
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=org.gnome.Geary
Icon=@appid@
TryExec=geary
Exec=geary %U
Type=Application

View file

@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.gnome.Geary
Name=@appid@
Exec=@bindir@/geary --gapplication-service

View file

@ -41,10 +41,19 @@ install_data(icon_files,
install_dir: join_paths(system_icons_dir, 'scalable', 'actions'),
)
install_data(join_paths('hicolor', 'scalable', 'apps', 'org.gnome.Geary.svg'),
install_dir: join_paths(system_icons_dir, 'scalable', 'apps'),
scalable_dir = join_paths('hicolor', 'scalable', 'apps')
install_data(
join_paths(scalable_dir, 'org.gnome.Geary.svg'),
install_dir: join_paths(datadir, 'icons', scalable_dir),
rename: '@0@.svg'.format(geary_id)
)
install_data(join_paths('hicolor', 'symbolic', 'apps', 'org.gnome.Geary-symbolic.svg'),
install_dir: join_paths(system_icons_dir, 'symbolic', 'apps'),
symbolic_dir = join_paths('hicolor', 'symbolic', 'apps')
install_data(
join_paths(symbolic_dir, 'org.gnome.Geary-symbolic.svg'),
install_dir: join_paths(datadir, 'icons', symbolic_dir),
rename: '@0@-symbolic.svg'.format(geary_id)
)

View file

@ -1,7 +1,7 @@
project('geary', [ 'vala', 'c' ],
version: '3.33.1',
license: 'LGPL2.1+',
meson_version: '>= 0.43',
meson_version: '>= 0.50',
)
gnome = import('gnome')
@ -15,6 +15,25 @@ reference_tracking = get_option('ref_tracking')
poodle = get_option('poodle')
enable_valadoc = get_option('valadoc')
# Build type
if get_option('profile') == 'development'
name_suffix = ' (Development)'
profile = 'Devel'
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
if vcs_tag == ''
version_suffix = '-devel'
else
version_suffix = '-@0@'.format(vcs_tag)
endif
else
profile = ''
name_suffix = ''
version_suffix = ''
endif
geary_id = 'org.gnome.Geary@0@'.format(profile)
geary_version = meson.project_version() + version_suffix
# Some variables
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
@ -187,12 +206,10 @@ conf.set_quoted('LANGUAGE_SUPPORT_DIRECTORY', locale_dir)
conf.set_quoted('ISO_CODE_639_XML', iso_639_xml)
conf.set_quoted('ISO_CODE_3166_XML', iso_3166_xml)
conf.set('GCR_API_SUBJECT_TO_CHANGE', true)
conf.set('HAVE_FTS3_TOKENIZE', true)
# geary-version.vala.in gets configured twice (once for the version,
# once for the revision), so make sure the revision template carries
# through to the second time.
conf.set('REVISION', '@REVISION@')
conf.set('VERSION', meson.project_version())
conf.set_quoted('_VERSION', geary_version)
conf.set_quoted('_APP_ID', geary_id)
conf.set_quoted('_PROFILE', profile)
conf.set_quoted('_NAME_SUFFIX', name_suffix)
configure_file(output: 'config.h', configuration: conf)
# Post-install scripts

View file

@ -6,3 +6,10 @@ option('iso_639_xml', type: 'string', value: '', description: 'Full path to the
option('iso_3166_xml', type: 'string', value: '', description: 'Full path to the ISO 3166 XML file.')
option('libunwind_optional', type: 'boolean', value: false, description: 'Determines if libunwind is required.')
option('tnef-support', type: 'boolean', value: true, description: 'Whether to support TNEF attachments (requires libytnef).')
option(
'profile',
type: 'combo',
value: 'default',
choices: ['default','development'],
description: 'The build profile for Geary. One of "default" or "development".'
)

View file

@ -12,7 +12,7 @@
*/
{
"app-id": "org.gnome.Geary",
"app-id": "org.gnome.GearyDevel",
"branch": "master",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
@ -20,7 +20,7 @@
"command": "geary",
"tags": ["nightly"],
"desktop-file-name-prefix": "(Nightly) ",
"desktop-file-name-suffix": " (Development)",
"finish-args": [
/* X11 + XShm access */
@ -254,6 +254,7 @@
"name": "geary",
"buildsystem": "meson",
"builddir": true,
"config-opts" : ["-Dprofile=development"],
"sources": [
{
"type": "git",

View file

@ -71,6 +71,9 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane, CommandPane {
[GtkChild]
private Gtk.Grid welcome_panel;
[GtkChild]
private Gtk.Image welcome_icon;
[GtkChild]
private Gtk.ListBox accounts_list;
@ -89,6 +92,7 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane, CommandPane {
public EditorListPane(Editor editor) {
this.editor = editor;
this.welcome_icon.icon_name = GearyApplication.APP_ID;
// keep our own copy of this so we can disconnect from its signals
// without worrying about the editor's lifecycle

View file

@ -57,6 +57,7 @@ public class Accounts.Editor : Gtk.Dialog {
public Editor(GearyApplication application, Gtk.Window parent) {
this.application = application;
this.transient_for = parent;
this.icon_name = GearyApplication.APP_ID;
this.accounts = application.controller.account_manager;
this.certificates = application.controller.certificate_manager;

View file

@ -13,14 +13,19 @@ extern const string _WEB_EXTENSIONS_DIR;
extern const string _SOURCE_ROOT_DIR;
extern const string _BUILD_ROOT_DIR;
extern const string GETTEXT_PACKAGE;
extern const string _APP_ID;
extern const string _NAME_SUFFIX;
extern const string _PROFILE;
extern const string _VERSION;
/**
* The interface between Geary and the desktop environment.
*/
public class GearyApplication : Gtk.Application {
public const string NAME = "Geary";
public const string APP_ID = "org.gnome.Geary";
public const string NAME = "Geary" + _NAME_SUFFIX;
public const string APP_ID = _APP_ID;
public const string SCHEMA_ID = "org.gnome.Geary";
public const string DESCRIPTION = _("Send and receive email");
public const string COPYRIGHT_1 = _("Copyright 2016 Software Freedom Conservancy Inc.");
public const string COPYRIGHT_2 = _("Copyright 2016-2019 Geary Development Team.");
@ -28,7 +33,7 @@ public class GearyApplication : Gtk.Application {
public const string WEBSITE_LABEL = _("Visit the Geary web site");
public const string BUGREPORT = "https://wiki.gnome.org/Apps/Geary/ReportingABug";
public const string VERSION = Geary.Version.NUMBER;
public const string VERSION = _VERSION;
public const string INSTALL_PREFIX = _INSTALL_PREFIX;
public const string GSETTINGS_DIR = _GSETTINGS_DIR;
public const string SOURCE_ROOT_DIR = _SOURCE_ROOT_DIR;
@ -66,7 +71,6 @@ public class GearyApplication : Gtk.Application {
// Local-only command line options
private const string OPTION_VERSION = "version";
private const string OPTION_VERSION_FULL = "version-full";
// Local command line options
private const string OPTION_DEBUG = "debug";
@ -147,10 +151,6 @@ public class GearyApplication : Gtk.Application {
/// Command line option
N_("Display program version"), null },
// Use this to specify arguments in the help section
{ OPTION_VERSION_FULL, 'V', 0, GLib.OptionArg.NONE, null,
/// Command line option
N_("Display program version and revision id"), null },
// Use this to specify arguments in the help section
{ GLib.OPTION_REMAINING, 0, 0, GLib.OptionArg.STRING_ARRAY, null, null,
"[mailto:[...]]" },
{ null }
@ -277,7 +277,6 @@ public class GearyApplication : Gtk.Application {
/// Application runtime information label
info.add({ _("Geary version"), VERSION });
info.add({ _("Geary revision"), Geary.Version.ID });
/// Application runtime information label
info.add({ _("GTK version"),
"%u.%u.%u".printf(
@ -392,16 +391,7 @@ public class GearyApplication : Gtk.Application {
"%s: %s\n", this.binary, GearyApplication.VERSION
);
return 0;
} else if (options.contains(OPTION_VERSION_FULL)) {
GLib.stdout.printf(
"%s: %s (%s)\n",
this.binary,
GearyApplication.VERSION,
Geary.Version.ID
);
return 0;
}
return -1;
}
@ -424,7 +414,7 @@ public class GearyApplication : Gtk.Application {
// Calls Gtk.init(), amongst other things
base.startup();
this.config = new Configuration(APP_ID);
this.config = new Configuration(SCHEMA_ID);
this.autostart = new Application.StartupManager(
this.config, this.get_desktop_directory()
);
@ -484,22 +474,6 @@ public class GearyApplication : Gtk.Application {
public async void show_about() {
yield this.present();
// Use just the version string for stable builds, i.e. those
// with even-numbered minor revisions like "3.32.0", but show
// the version number and revision for unstable builds
// i.e. those with odd-numbered minor revisions like "3.33.0"
string displayed_version = VERSION;
string[] version_parts = VERSION.split(".");
if (version_parts.length >= 2) {
int minor = int.parse(version_parts[1]);
if (minor % 2 == 1) {
displayed_version = "%s (%s)".printf(
Geary.Version.NUMBER,
Geary.Version.ID
);
}
}
Gtk.show_about_dialog(get_active_window(),
"program-name", NAME,
"comments", DESCRIPTION,
@ -507,7 +481,7 @@ public class GearyApplication : Gtk.Application {
"copyright", string.join("\n", COPYRIGHT_1, COPYRIGHT_2),
"license-type", Gtk.License.LGPL_2_1,
"logo-icon-name", APP_ID,
"version", displayed_version,
"version", VERSION,
"website", WEBSITE,
"website-label", WEBSITE_LABEL,
"title", _("About %s").printf(NAME),
@ -709,10 +683,9 @@ public class GearyApplication : Gtk.Application {
int mutex_token = yield this.controler_mutex.claim_async();
if (this.controller == null) {
message(
"%s %s (%s) prefix=%s exec_dir=%s is_installed=%s",
"%s %s prefix=%s exec_dir=%s is_installed=%s",
NAME,
VERSION,
Geary.Version.ID,
INSTALL_PREFIX,
exec_dir.get_path(),
this.is_installed.to_string()

View file

@ -13,7 +13,7 @@ public class SecretMediator : Geary.CredentialsMediator, Object {
private const string ATTR_PROTO = "proto";
private static Secret.Schema schema = new Secret.Schema(
GearyApplication.APP_ID,
GearyApplication.SCHEMA_ID,
Secret.SchemaFlags.NONE,
ATTR_LOGIN, Secret.SchemaAttributeType.STRING,
ATTR_HOST, Secret.SchemaAttributeType.STRING,

View file

@ -352,6 +352,11 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
Gtk.StyleContext.add_provider_for_screen(Gdk.Display.get_default().get_default_screen(),
provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
if (_PROFILE != "") {
Gtk.StyleContext ctx = this.get_style_context();
ctx.add_class("devel");
}
provider.parsing_error.connect((section, error) => {
uint start = section.get_start_line();
uint end = section.get_end_line();

View file

@ -12,7 +12,7 @@ public class UnityLauncher : Geary.BaseObject {
public UnityLauncher(NewMessagesMonitor monitor) {
this.monitor = monitor;
entry = Unity.LauncherEntry.get_for_desktop_id("org.gnome.Geary.desktop");
entry = Unity.LauncherEntry.get_for_desktop_id(GearyApplication.APP_ID + ".desktop");
set_count(0);
monitor.folder_removed.connect(on_folder_removed);

View file

@ -5,6 +5,7 @@ n * Copyright 2016 Software Freedom Conservancy Inc.
* (version 2.1 or later). See the COPYING file in this distribution.
*/
extern const string _VERSION;
errordomain CommandException {
USAGE,
@ -409,7 +410,7 @@ class ImapConsole : Gtk.Window {
Gee.HashMap<string, string> fields = new Gee.HashMap<string, string>();
fields.set("name", "geary-console");
fields.set("version", Geary.Version.NUMBER);
fields.set("version", _VERSION);
this.cx.send_command(new Geary.Imap.IdCommand(fields));
}

View file

@ -320,7 +320,6 @@ geary_engine_vala_sources = files(
geary_engine_sources = [
geary_engine_vala_sources,
geary_version_vala,
]
geary_engine_dependencies = [

View file

@ -1,18 +0,0 @@
/*
* Copyright 2016 Software Freedom Conservancy Inc.
* Copyright 2019 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
/** Provides access to Engine version and revision numbers. */
namespace Geary.Version {
/** The current version number for this build. */
public const string NUMBER = "@VERSION@";
/** The source code identifier for this build. */
public const string ID = "@REVISION@";
}

View file

@ -1,19 +1,3 @@
# Version
geary_version_in = configure_file(
input: 'geary-version.vala.in',
output: 'geary-version.vala.in',
configuration: conf,
install: false
)
geary_version_vala = vcs_tag(
command: '../build-aux/git_version.py',
input: geary_version_in,
output: 'geary-version.vala',
replace_string: '@REVISION@'
)
# Common vala options
geary_vala_options = [
'--target-glib=@0@'.format(target_glib),

View file

@ -16,7 +16,7 @@ class ConfigurationTest : TestCase {
public override void set_up() {
Environment.unset_variable("XDG_CURRENT_DESKTOP");
this.test_config = new Configuration(GearyApplication.APP_ID);
this.test_config = new Configuration(GearyApplication.SCHEMA_ID);
}
public void desktop_environment() throws Error {

View file

@ -13,7 +13,7 @@ public abstract class ClientWebViewTestCase<V> : TestCase {
protected ClientWebViewTestCase(string name) {
base(name);
this.config = new Configuration(GearyApplication.APP_ID);
this.config = new Configuration(GearyApplication.SCHEMA_ID);
this.config.enable_debug = true;
ClientWebView.init_web_context(
this.config,

View file

@ -14,7 +14,7 @@ public class ClientWebViewTest : TestCase {
}
public void init_web_context() throws Error {
Configuration config = new Configuration(GearyApplication.APP_ID);
Configuration config = new Configuration(GearyApplication.SCHEMA_ID);
config.enable_debug = true;
ClientWebView.init_web_context(
config,

View file

@ -7,7 +7,6 @@
<property name="modal">True</property>
<property name="default_width">700</property>
<property name="default_height">450</property>
<property name="icon_name">org.gnome.Geary</property>
<property name="type_hint">dialog</property>
<child type="titlebar">
<placeholder/>

View file

@ -41,11 +41,10 @@
<property name="halign">center</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkImage">
<object class="GtkImage" id="welcome_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixel_size">64</property>
<property name="icon_name">org.gnome.Geary</property>
<property name="use_fallback">True</property>
</object>
<packing>

View file

@ -334,6 +334,7 @@
<style>
<class name="geary-titlebar"/>
<class name="geary-titlebar-right"/>
<class name="titlebar"/>
</style>
</object>
<packing>