Allow for parallel development instance
This adds a configuration option in meson, if set it changes the application ID allowing for stable and development version to be run at the same time.
This commit is contained in:
parent
15457e1db4
commit
569c00ff5f
@ -10,9 +10,10 @@ flatpak:
|
|||||||
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
|
image: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master"
|
||||||
stage: "test"
|
stage: "test"
|
||||||
variables:
|
variables:
|
||||||
MANIFEST_PATH: "org.gnome.Podcasts.json"
|
MANIFEST_PATH: "org.gnome.PodcastsDevel.json"
|
||||||
FLATPAK_MODULE: "gnome-podcasts"
|
FLATPAK_MODULE: "gnome-podcasts"
|
||||||
DBUS_ID: "org.gnome.Podcasts"
|
CONFIGURE_ARGS: "-Dprofile=development"
|
||||||
|
DBUS_ID: "org.gnome.PodcastsDevel"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
|
- flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
|
||||||
@ -21,7 +22,7 @@ flatpak:
|
|||||||
- flatpak-builder --run app ${MANIFEST_PATH} glib-compile-resources --sourcedir=podcasts-gtk/resources/ podcasts-gtk/resources/resources.xml
|
- flatpak-builder --run app ${MANIFEST_PATH} glib-compile-resources --sourcedir=podcasts-gtk/resources/ podcasts-gtk/resources/resources.xml
|
||||||
|
|
||||||
# Build the flatpak repo
|
# Build the flatpak repo
|
||||||
- flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app _build
|
- flatpak-builder --run app ${MANIFEST_PATH} meson --prefix=/app ${CONFIGURE_ARGS} _build
|
||||||
- flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
|
- flatpak-builder --run app ${MANIFEST_PATH} ninja -C _build install
|
||||||
|
|
||||||
# Run the tests
|
# Run the tests
|
||||||
|
|||||||
36
meson.build
36
meson.build
@ -7,6 +7,25 @@ project(
|
|||||||
license: 'GPLv3',
|
license: 'GPLv3',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if get_option('profile') == '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 = ''
|
||||||
|
version_suffix = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
application_id = 'org.gnome.Podcasts@0@'.format(profile)
|
||||||
|
i18n = import('i18n')
|
||||||
|
|
||||||
|
subdir('podcasts-gtk/po')
|
||||||
|
podir = join_paths (meson.source_root (), 'podcasts-gtk', 'po')
|
||||||
|
|
||||||
podcasts_version = meson.project_version()
|
podcasts_version = meson.project_version()
|
||||||
version_array = podcasts_version.split('.')
|
version_array = podcasts_version.split('.')
|
||||||
podcasts_major_version = version_array[0].to_int()
|
podcasts_major_version = version_array[0].to_int()
|
||||||
@ -18,16 +37,12 @@ podcasts_bindir = join_paths(podcasts_prefix, get_option('bindir'))
|
|||||||
podcasts_localedir = join_paths(podcasts_prefix, get_option('localedir'))
|
podcasts_localedir = join_paths(podcasts_prefix, get_option('localedir'))
|
||||||
|
|
||||||
podcasts_conf = configuration_data()
|
podcasts_conf = configuration_data()
|
||||||
podcasts_conf.set('BINDIR', podcasts_bindir)
|
podcasts_conf.set('appid', application_id)
|
||||||
|
podcasts_conf.set('bindir', podcasts_bindir)
|
||||||
|
|
||||||
datadir = get_option('datadir')
|
datadir = get_option('datadir')
|
||||||
icondir = join_paths(datadir, 'icons')
|
|
||||||
subdir('podcasts-gtk/resources')
|
subdir('podcasts-gtk/resources')
|
||||||
|
|
||||||
i18n = import('i18n')
|
|
||||||
subdir('podcasts-gtk/po')
|
|
||||||
podir = join_paths (meson.source_root (), 'podcasts-gtk', 'po')
|
|
||||||
|
|
||||||
cargo = find_program('cargo', required: false)
|
cargo = find_program('cargo', required: false)
|
||||||
gresource = find_program('glib-compile-resources', required: false)
|
gresource = find_program('glib-compile-resources', required: false)
|
||||||
cargo_vendor = find_program('cargo-vendor', required: false)
|
cargo_vendor = find_program('cargo-vendor', required: false)
|
||||||
@ -38,7 +53,14 @@ cargo_release = custom_target('cargo-build',
|
|||||||
output: ['gnome-podcasts'],
|
output: ['gnome-podcasts'],
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: podcasts_bindir,
|
install_dir: podcasts_bindir,
|
||||||
command: [cargo_script, '@CURRENT_SOURCE_DIR@', '@OUTPUT@', podcasts_localedir])
|
command: [cargo_script,
|
||||||
|
'@CURRENT_SOURCE_DIR@',
|
||||||
|
'@OUTPUT@',
|
||||||
|
podcasts_localedir,
|
||||||
|
application_id,
|
||||||
|
podcasts_version + version_suffix,
|
||||||
|
profile
|
||||||
|
])
|
||||||
|
|
||||||
run_target('release', command: ['scripts/release.sh',
|
run_target('release', command: ['scripts/release.sh',
|
||||||
meson.project_name() + '-' + podcasts_version
|
meson.project_name() + '-' + podcasts_version
|
||||||
|
|||||||
9
meson_options.txt
Normal file
9
meson_options.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
option (
|
||||||
|
'profile',
|
||||||
|
type: 'combo',
|
||||||
|
choices: [
|
||||||
|
'default',
|
||||||
|
'development'
|
||||||
|
],
|
||||||
|
value: 'default'
|
||||||
|
)
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"app-id" : "org.gnome.Podcasts",
|
"app-id" : "org.gnome.PodcastsDevel",
|
||||||
"runtime" : "org.gnome.Platform",
|
"runtime" : "org.gnome.Platform",
|
||||||
"runtime-version" : "master",
|
"runtime-version" : "master",
|
||||||
"sdk" : "org.gnome.Sdk",
|
"sdk" : "org.gnome.Sdk",
|
||||||
@ -30,8 +30,7 @@
|
|||||||
],
|
],
|
||||||
"env" : {
|
"env" : {
|
||||||
"CARGO_HOME" : "/run/build/Podcasts/cargo",
|
"CARGO_HOME" : "/run/build/Podcasts/cargo",
|
||||||
"RUST_BACKTRACE" : "1",
|
"RUST_BACKTRACE" : "1"
|
||||||
"DEBUG" : "true"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modules" : [
|
"modules" : [
|
||||||
@ -48,6 +47,7 @@
|
|||||||
{
|
{
|
||||||
"name" : "gnome-podcasts",
|
"name" : "gnome-podcasts",
|
||||||
"buildsystem" : "meson",
|
"buildsystem" : "meson",
|
||||||
|
"config-opts" : [ "-Dprofile=development" ],
|
||||||
"sources" : [
|
"sources" : [
|
||||||
{
|
{
|
||||||
"type" : "git",
|
"type" : "git",
|
||||||
@ -1,7 +1,3 @@
|
|||||||
use std::env;
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Write;
|
|
||||||
use std::path::Path;
|
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -9,9 +5,10 @@ fn main() {
|
|||||||
println!("cargo:rerun-if-changed=resources");
|
println!("cargo:rerun-if-changed=resources");
|
||||||
println!("cargo:rerun-if-changed=resources/*");
|
println!("cargo:rerun-if-changed=resources/*");
|
||||||
|
|
||||||
Command::new("glib-compile-resources")
|
let out = Command::new("glib-compile-resources")
|
||||||
.args(&["--generate", "resources.xml"])
|
.args(&["--generate", "resources.xml"])
|
||||||
.current_dir("resources")
|
.current_dir("resources")
|
||||||
.status()
|
.status()
|
||||||
.unwrap();
|
.expect("failed to generate resources");
|
||||||
|
assert!(out.success());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,13 +81,12 @@ Tobias Bernard
|
|||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage" id="image">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="pixel_size">256</property>
|
<property name="pixel_size">256</property>
|
||||||
<property name="icon_name">org.gnome.Podcasts-symbolic</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="dim-label"/>
|
<class name="dim-label"/>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -18,3 +18,15 @@ list, border {
|
|||||||
.player-show-label {
|
.player-show-label {
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.devel headerbar {
|
||||||
|
background: transparent -gtk-icontheme("system-run-symbolic") 80% 0/128px 128px no-repeat,
|
||||||
|
linear-gradient(to left,
|
||||||
|
mix(@theme_selected_bg_color, @theme_bg_color, 0.5) 8%,
|
||||||
|
@theme_bg_color 25%);
|
||||||
|
color: alpha(@theme_fg_color, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.devel headerbar label {
|
||||||
|
color: @theme_fg_color;
|
||||||
|
}
|
||||||
@ -1 +1,15 @@
|
|||||||
install_subdir('hicolor', install_dir: icondir)
|
scalable_dir = join_paths('hicolor', 'scalable', 'apps')
|
||||||
|
|
||||||
|
install_data(
|
||||||
|
join_paths(scalable_dir, 'org.gnome.Podcasts.svg'),
|
||||||
|
install_dir: join_paths(datadir, 'icons', scalable_dir),
|
||||||
|
rename: '@0@.svg'.format(application_id)
|
||||||
|
)
|
||||||
|
|
||||||
|
symbolic_dir = join_paths('hicolor', 'symbolic', 'apps')
|
||||||
|
|
||||||
|
install_data(
|
||||||
|
join_paths(symbolic_dir, 'org.gnome.Podcasts-symbolic.svg'),
|
||||||
|
install_dir: join_paths(datadir, 'icons', symbolic_dir),
|
||||||
|
rename: '@0@-symbolic.svg'.format(application_id)
|
||||||
|
)
|
||||||
@ -1,27 +1,41 @@
|
|||||||
subdir('icons')
|
subdir('icons')
|
||||||
|
|
||||||
|
desktop_conf = configuration_data()
|
||||||
|
desktop_conf.set('icon', application_id)
|
||||||
i18n.merge_file ('desktop-file',
|
i18n.merge_file ('desktop-file',
|
||||||
type: 'desktop',
|
type: 'desktop',
|
||||||
input: 'org.gnome.Podcasts.desktop.in',
|
input: configure_file(
|
||||||
output: 'org.gnome.Podcasts.desktop',
|
input: files('org.gnome.Podcasts.desktop.in.in'),
|
||||||
|
output: 'org.gnome.Podcasts.desktop.in',
|
||||||
|
configuration: desktop_conf
|
||||||
|
),
|
||||||
|
output: '@0@.desktop'.format(application_id),
|
||||||
po_dir: podir,
|
po_dir: podir,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: join_paths (datadir, 'applications')
|
install_dir: join_paths (datadir, 'applications')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
appdata_conf = configuration_data()
|
||||||
|
appdata_conf.set('appid', application_id)
|
||||||
i18n.merge_file ('appdata-file',
|
i18n.merge_file ('appdata-file',
|
||||||
input: 'org.gnome.Podcasts.appdata.xml.in',
|
input: configure_file(
|
||||||
output: 'org.gnome.Podcasts.appdata.xml',
|
input: files('org.gnome.Podcasts.appdata.xml.in.in'),
|
||||||
|
output: 'org.gnome.Podcasts.appdata.xml.in',
|
||||||
|
configuration: appdata_conf
|
||||||
|
),
|
||||||
|
output: '@0@.appdata.xml'.format(application_id),
|
||||||
po_dir: podir,
|
po_dir: podir,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: join_paths (datadir, 'appdata')
|
install_dir: join_paths (datadir, 'metainfo')
|
||||||
)
|
)
|
||||||
|
|
||||||
install_data('org.gnome.Podcasts.gschema.xml', install_dir: join_paths(datadir, 'glib-2.0', 'schemas'))
|
install_data('org.gnome.Podcasts.gschema.xml', install_dir: join_paths(datadir, 'glib-2.0', 'schemas'))
|
||||||
|
|
||||||
configure_file(input: 'org.gnome.Podcasts.service.in',
|
configure_file(
|
||||||
output: 'org.gnome.Podcasts.service',
|
input: 'org.gnome.Podcasts.service.in',
|
||||||
configuration: podcasts_conf,
|
output: '@0@.service'.format(application_id),
|
||||||
install_dir: join_paths([datadir,'dbus-1/services']))
|
configuration: podcasts_conf,
|
||||||
|
install_dir: join_paths(datadir,'dbus-1', 'services')
|
||||||
|
)
|
||||||
|
|
||||||
meson.add_install_script('../../scripts/compile-gschema.py')
|
meson.add_install_script('../../scripts/compile-gschema.py')
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<component type="desktop">
|
<component type="desktop">
|
||||||
<id>org.gnome.Podcasts</id>
|
<id>@appid@</id>
|
||||||
<name>Podcasts</name>
|
<name>Podcasts</name>
|
||||||
<project_license>GPL-3.0</project_license>
|
<project_license>GPL-3.0</project_license>
|
||||||
<metadata_license>CC0-1.0</metadata_license>
|
<metadata_license>CC0-1.0</metadata_license>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
Name=Podcasts
|
Name=Podcasts
|
||||||
Comment=Listen to your favorite podcasts, right from your desktop.
|
Comment=Listen to your favorite podcasts, right from your desktop.
|
||||||
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
|
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
|
||||||
Icon=org.gnome.Podcasts
|
Icon=@icon@
|
||||||
Exec=gnome-podcasts
|
Exec=gnome-podcasts
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
@ -1,3 +1,3 @@
|
|||||||
[D-BUS Service]
|
[D-BUS Service]
|
||||||
Name=org.gnome.Podcasts
|
Name=@appid@
|
||||||
Exec=@BINDIR@/gnome-podcasts --gapplication-service
|
Exec=@bindir@/gnome-podcasts --gapplication-service
|
||||||
@ -28,7 +28,8 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use i18n::i18n;
|
use i18n::i18n;
|
||||||
|
|
||||||
pub(crate) const APP_ID: &str = "org.gnome.Podcasts";
|
pub(crate) const APP_ID: &str = env!("APP_ID");
|
||||||
|
pub(crate) const VERSION: &str = env!("VERSION");
|
||||||
|
|
||||||
/// Creates an action named `name` in the action map `T with the handler `F`
|
/// Creates an action named `name` in the action map `T with the handler `F`
|
||||||
fn action<T, F>(thing: &T, name: &str, action: F)
|
fn action<T, F>(thing: &T, name: &str, action: F)
|
||||||
@ -82,12 +83,15 @@ pub(crate) struct App {
|
|||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub(crate) fn new(application: >k::Application) -> Rc<Self> {
|
pub(crate) fn new(application: >k::Application) -> Rc<Self> {
|
||||||
let settings = gio::Settings::new(APP_ID);
|
let settings = gio::Settings::new("org.gnome.Podcasts");
|
||||||
|
|
||||||
let (sender, receiver) = unbounded();
|
let (sender, receiver) = unbounded();
|
||||||
|
|
||||||
let window = gtk::ApplicationWindow::new(application);
|
let window = gtk::ApplicationWindow::new(application);
|
||||||
window.set_title(&i18n("Podcasts"));
|
window.set_title(&i18n("Podcasts"));
|
||||||
|
if APP_ID.ends_with("Devel") {
|
||||||
|
window.get_style_context().map(|c| c.add_class("devel"));
|
||||||
|
}
|
||||||
|
|
||||||
let weak_s = settings.downgrade();
|
let weak_s = settings.downgrade();
|
||||||
let weak_app = application.downgrade();
|
let weak_app = application.downgrade();
|
||||||
@ -380,6 +384,7 @@ impl App {
|
|||||||
|
|
||||||
let application = gtk::Application::new(APP_ID, gio::ApplicationFlags::empty())
|
let application = gtk::Application::new(APP_ID, gio::ApplicationFlags::empty())
|
||||||
.expect("Application initialization failed...");
|
.expect("Application initialization failed...");
|
||||||
|
application.set_resource_base_path("/org/gnome/Podcasts");
|
||||||
|
|
||||||
let weak_app = application.downgrade();
|
let weak_app = application.downgrade();
|
||||||
application.connect_startup(move |_| {
|
application.connect_startup(move |_| {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use app::APP_ID;
|
use app::{APP_ID, VERSION};
|
||||||
use gtk;
|
use gtk;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
|
||||||
@ -27,9 +27,7 @@ pub(crate) fn about_dialog(window: >k::ApplicationWindow) {
|
|||||||
dialog.set_copyright("© 2017, 2018 Jordan Petridis");
|
dialog.set_copyright("© 2017, 2018 Jordan Petridis");
|
||||||
dialog.set_license_type(gtk::License::Gpl30);
|
dialog.set_license_type(gtk::License::Gpl30);
|
||||||
dialog.set_modal(true);
|
dialog.set_modal(true);
|
||||||
// TODO: make it show it fetches the commit hash from which it was built
|
dialog.set_version(VERSION);
|
||||||
// and the version number is kept in sync automatically
|
|
||||||
dialog.set_version("0.4.4");
|
|
||||||
dialog.set_program_name(&i18n("Podcasts"));
|
dialog.set_program_name(&i18n("Podcasts"));
|
||||||
dialog.set_website("https://wiki.gnome.org/Apps/Podcasts");
|
dialog.set_website("https://wiki.gnome.org/Apps/Podcasts");
|
||||||
dialog.set_website_label(i18n("Learn more about GNOME Podcasts").as_str());
|
dialog.set_website_label(i18n("Learn more about GNOME Podcasts").as_str());
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
use gtk;
|
use app::APP_ID;
|
||||||
|
use gtk::{self, prelude::*};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -15,6 +16,8 @@ impl Default for EmptyView {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let builder = gtk::Builder::new_from_resource("/org/gnome/Podcasts/gtk/empty_view.ui");
|
let builder = gtk::Builder::new_from_resource("/org/gnome/Podcasts/gtk/empty_view.ui");
|
||||||
let view: gtk::Box = builder.get_object("empty_view").unwrap();
|
let view: gtk::Box = builder.get_object("empty_view").unwrap();
|
||||||
|
let image: gtk::Image = builder.get_object("image").unwrap();
|
||||||
|
image.set_from_icon_name(format!("{}-symbolic", APP_ID).as_str(), 256);
|
||||||
EmptyView(view)
|
EmptyView(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
export CARGO_HOME=$1/target/cargo-home
|
export CARGO_HOME=$1/target/cargo-home
|
||||||
export RUSTFLAGS="--cfg rayon_unstable"
|
export RUSTFLAGS="--cfg rayon_unstable"
|
||||||
export PODCASTS_LOCALEDIR="$3"
|
export LOCALEDIR="$3"
|
||||||
|
export APP_ID="$4"
|
||||||
|
export VERSION="$5"
|
||||||
|
export PROFILE="$6"
|
||||||
|
|
||||||
if [[ $DEBUG = true ]]
|
if [[ "$PROFILE" == "Devel" ]]
|
||||||
then
|
then
|
||||||
echo "DEBUG MODE"
|
echo "DEBUG MODE"
|
||||||
cargo build -p podcasts-gtk && cp $1/target/debug/podcasts-gtk $2
|
cargo build -p podcasts-gtk && cp $1/target/debug/podcasts-gtk $2
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user