diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0768b36a0ac27b35f6096fefb4e1498b64c4ad6..28f9ce98960d245e00730dd6ea03356c8c2e7136 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,9 +13,10 @@ flatpak: MANIFEST_PATH: "flatpak/org.gnome.Polari.json" RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo" FLATPAK_MODULE: "polari" + BRANCH: "snapshot" # Make sure to keep this in sync with the Flatpak manifest, all arguments # are passed except the config-args because we build it ourselves - MESON_ARGS: "" + MESON_ARGS: "-Dsnapshot=true" DBUS_ID: "org.gnome.Polari" before_script: @@ -26,11 +27,11 @@ flatpak: # are passed except the config-args because we build it ourselves - 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-builder --finish-only --repo=repo --default-branch=${BRANCH} app ${MANIFEST_PATH} # Run automatic tests inside the Flatpak env - flatpak build app ninja -C _build test # Generate a Flatpak bundle - - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${DBUS_ID} + - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${DBUS_ID} ${BRANCH} after_script: - tar -czf cache.tar.gz .flatpak-builder/cache diff --git a/data/resources/application.css b/data/resources/application.css index 6c0f72fbe9b379b00ded7d6a993cef1e03d74268..3af920da4cb89b38c94170b066b464be08c10d41 100644 --- a/data/resources/application.css +++ b/data/resources/application.css @@ -209,9 +209,17 @@ treeview.polari-server-room-list { /* Differentiate test instance from "normal" ones */ window.test-instance headerbar:last-child { - background-image: -gtk-icontheme('system-run-symbolic'); - background-blend-mode: color-burn; + background-image: cross-fade(25% -gtk-icontheme('system-run-symbolic')); background-repeat: no-repeat; background-position: 1em center; background-size: 4em; } + +/* Differentiate snapshot builds from regular ones */ +window.snapshot headerbar { background: none; } +window.snapshot .titlebar { + background: linear-gradient(to left, #a5b1bd 0%, #a5b1bd 8%, @theme_bg_color 25%); + box-shadow: inset 0 1px #f1f3f5; + border-color: #909fae; + color: alpha(@theme_fg_color, 0.4); +} diff --git a/meson.build b/meson.build index 6089d55ce4416896126dda94bff92ec88c8308c4..9f913f46dfc969f82e03d59b57a4f23783acaea0 100644 --- a/meson.build +++ b/meson.build @@ -39,10 +39,29 @@ telepathy_glib = dependency('telepathy-glib') girepository = dependency('gobject-introspection-1.0') gjs = dependency('gjs-1.0') +conf = configuration_data() + +conf.set_quoted('PACKAGE_NAME', meson.project_name()) +conf.set_quoted('PACKAGE_VERSION', '@VCS_TAG@') +conf.set_quoted('PREFIX', prefix) +conf.set_quoted('LIBDIR', libdir) +conf.set_quoted('PKGLIBDIR', pkglibdir) + cc = meson.get_compiler('c') -if (cc.has_function('strcasestr')) - add_project_arguments('-DHAVE_STRCASECSTR', language: 'c') -endif +conf.set10('HAVE_STRCASESTR', cc.has_function('strcasestr')) +conf.set10('SNAPSHOT', get_option('snapshot')) + +config_h = declare_dependency( + sources: vcs_tag( + command: ['git', 'describe'], + input: configure_file( + configuration: conf, + output: 'config.h.in' + ), + output: 'config.h' + ), + include_directories: include_directories('.') +) subdir('src') subdir('data') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000000000000000000000000000000000..74573004911ea93f7793951053402dd82b4f1dbd --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,5 @@ +option('snapshot', + type: 'boolean', + value: false, + description: 'Build development snapshot' +) diff --git a/src/application.js b/src/application.js index dc07080dfc0aa6bd9bbd82b343dac9ac7c2532f1..65f04ae3694afaf34342c9a7c375da08ce34ac81 100644 --- a/src/application.js +++ b/src/application.js @@ -29,7 +29,6 @@ var Application = GObject.registerClass({ super._init({ application_id: 'org.gnome.Polari', flags: Gio.ApplicationFlags.HANDLES_OPEN }); - GLib.set_application_name('Polari'); GLib.set_prgname('polari'); this._retryData = new Map(); this._nickTrackData = new Map(); diff --git a/src/mainWindow.js b/src/mainWindow.js index f5d87975e7dd297204b5ee2b0c579050bfb6f82e..b5a803615a600f7e28672566be9958006784118f 100644 --- a/src/mainWindow.js +++ b/src/mainWindow.js @@ -134,6 +134,8 @@ var MainWindow = GObject.registerClass({ if (app.isTestInstance) this.get_style_context().add_class('test-instance'); + if (GLib.get_application_name().toLowerCase().includes('snapshot')) + this.get_style_context().add_class('snapshot'); // command output notifications should not pop up over // the input area, but appear to emerge from it, so diff --git a/src/meson.build b/src/meson.build index 45e95f281468fca48ec1acacf3186b02cce58ee0..32df375e0f0f49c7bea35d34541de3e3d18017fb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -59,16 +59,8 @@ src_resources = gnome.compile_resources( c_name: 'src_resources' ) -exeargs = [ - '-DPACKAGE_NAME="polari"', - '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()), - '-DPREFIX="@0@"'.format(prefix), - '-DLIBDIR="@0@"'.format(libdir), - '-DPKGLIBDIR="@0@"'.format(pkglibdir) -] polari = executable('polari', ['polari.c', src_resources, data_resources], - dependencies: [gio, girepository, gjs], - c_args: exeargs, + dependencies: [config_h, gio, girepository, gjs], install: true ) diff --git a/src/polari.c b/src/polari.c index 30f43675ab4f43cd6208d82d9fa687c723738840..9804f5e871cdb7fa0f479c967f648a17ed039f58 100644 --- a/src/polari.c +++ b/src/polari.c @@ -1,6 +1,8 @@ #include #include +#include "config.h" + G_DEFINE_AUTOPTR_CLEANUP_FUNC (GjsContext, g_object_unref) const char *src = @@ -9,6 +11,27 @@ const char *src = " prefix: '" PREFIX "'," " libdir: '" LIBDIR "' });"; +static char ** +get_js_argv (int argc, const char * const *argv) +{ + char * injected_args[] = { +#ifdef SNAPSHOT + "--test-instance", +#endif + NULL + }; + char **strv; + int js_argc = argc - 1; // gjs doesn't do argv[0] + int i; + + strv = g_new0 (char *, js_argc + G_N_ELEMENTS (injected_args) + 1); + for (i = 0; i < js_argc; i++) + strv[i] = g_strdup (argv[i + 1]); + for (i = 0; i < G_N_ELEMENTS (injected_args); i++) + strv[js_argc + i] = g_strdup (injected_args[i]); + return strv; +} + int main (int argc, char *argv[]) { @@ -16,6 +39,7 @@ main (int argc, char *argv[]) g_autoptr (GOptionContext) option_context = NULL; g_autoptr (GError) error = NULL; g_autoptr (GjsContext) context = NULL; + g_auto (GStrv) js_argv = NULL; gboolean debugger = FALSE; int status; @@ -25,6 +49,12 @@ main (int argc, char *argv[]) { NULL } }; +#ifdef SNAPSHOT + g_set_application_name ("Polari Development Snapshot"); +#else + g_set_application_name ("Polari"); +#endif + g_irepository_prepend_search_path (PKGLIBDIR); context = g_object_new (GJS_TYPE_CONTEXT, @@ -41,8 +71,10 @@ main (int argc, char *argv[]) if (debugger) gjs_context_setup_debugger_console (context); + js_argv = get_js_argv (argc, (const char * const *)argv); + if (!gjs_context_define_string_array (context, "ARGV", - argc - 1, (const char **)argv + 1, + -1, (const char **)js_argv, &error)) { g_message ("Failed to define ARGV: %s", error->message);