Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Separate app-id for development build #275

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: reco.flatpak
manifest-path: com.github.ryonakano.reco.yml
manifest-path: build-aux/appcenter/com.github.ryonakano.reco.Devel.yml
run-tests: true
repository-name: appcenter
repository-url: https://flatpak.elementary.io/repo.flatpakrepo
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# build dirs
.flatpak-builder
build*
builddir*

# vim
*.swp
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ flatpak remote-add --user --if-not-exists appcenter https://flatpak.elementary.i
To build and install, use `flatpak-builder`, then execute with `flatpak run`:

```
flatpak-builder builddir --user --install --force-clean --install-deps-from=appcenter com.github.ryonakano.reco.yml
flatpak run com.github.ryonakano.reco
flatpak-builder builddir --user --install --force-clean --install-deps-from=appcenter build-aux/appcenter/com.github.ryonakano.reco.Devel.yml
flatpak run com.github.ryonakano.reco.Devel
```

### From Source Code (Native)
Expand All @@ -55,7 +55,7 @@ You'll need the following dependencies to build:
* libgtk-4-dev (>= 4.10)
* [libryokucha](https://github.com/ryonakano/ryokucha)
* [livechart](https://github.com/lcallarec/live-chart) (>= 1.10.0)
* meson (>= 0.57.0)
* meson (>= 0.58.0)
* valac

You'll need the following dependencies to run:
Expand Down
45 changes: 45 additions & 0 deletions build-aux/appcenter/com.github.ryonakano.reco.Devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
app-id: com.github.ryonakano.reco.Devel
runtime: io.elementary.Platform
runtime-version: '7.3'
sdk: io.elementary.Sdk
command: com.github.ryonakano.reco.Devel
finish-args:
- '--device=all'
- '--share=ipc'
- '--socket=wayland'
- '--socket=fallback-x11'
- '--socket=pulseaudio'
- '--env=GST_PLUGIN_PATH_1_0=/app/lib/gstreamer-1.0'
modules:
- name: live-chart
buildsystem: meson
sources:
- type: archive
url: https://github.com/lcallarec/live-chart/archive/refs/tags/1.10.0.tar.gz
sha256: 3f54c7569cc2a4711b5689038055aefc4321636f3e6dd4945e4be204bc9d4843

- name: gst-libav
buildsystem: meson
config_opts:
- '-Ddoc=disabled'
sources:
- type: archive
# we need to use the same version with gstreamer included in the sdk
url: https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.22.5.tar.xz
sha256: 8583f0c1f4fcb01eed11fa1e3c21126543a8bd739ed4fc1db31f756a5ab01d9a

- name: ryokucha
buildsystem: meson
sources:
- type: archive
url: https://github.com/ryonakano/ryokucha/archive/refs/tags/0.2.0.tar.gz
sha256: 40c038798cafd6f8f2de00b19a27b89042197a301b256b2afa8da35fcc21a2f6

- name: reco
buildsystem: meson
config_opts:
- '-Duse_submodule=false'
- '-Ddevelopment=true'
sources:
- type: dir
path: ../../
42 changes: 34 additions & 8 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,56 @@ icon_sizes = ['16', '24', '32', '48', '64', '128']
foreach i : icon_sizes
install_data(
'icons' / i / meson.project_name() + '.svg',
rename: app_id + '.svg',
install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i / 'apps'
)
endforeach

i18n.merge_file(
input: 'reco.desktop.in',
output: meson.project_name() + '.desktop',
desktop_conf = configuration_data()
desktop_conf.set('APP_NAME', app_name)
desktop_conf.set('APP_ID', app_id)
desktop_file_in = configure_file(
input: 'reco.desktop.in.in',
output: '@[email protected]'.format(app_id),
configuration: desktop_conf
)

desktop_file = i18n.merge_file(
input: desktop_file_in,
output: '@[email protected]'.format(app_id),
po_dir: meson.project_source_root() / 'po',
type: 'desktop',
install: true,
install_dir: get_option('datadir') / 'applications'
)

i18n.merge_file(
input: 'reco.metainfo.xml.in',
output: meson.project_name() + '.metainfo.xml',
appstream_conf = configuration_data()
appstream_conf.set('APP_ID', app_id)
appstream_conf.set('GETTEXT_PACKAGE', meson.project_name())
appstream_file_in = configure_file(
input: 'reco.metainfo.xml.in.in',
output: '@[email protected]'.format(app_id),
configuration: appstream_conf
)

appstream_file = i18n.merge_file(
input: appstream_file_in,
output: '@[email protected]'.format(app_id),
po_dir: meson.project_source_root() / 'po',
install: true,
install_dir: get_option('datadir') / 'metainfo'
)

gschema_conf = configuration_data()
gschema_conf.set('APP_ID', app_id)
gschema_file = configure_file(
input: 'reco.gschema.xml.in',
output: '@[email protected]'.format(app_id),
configuration: gschema_conf
)

install_data(
'reco.gschema.xml',
rename: meson.project_name() + '.gschema.xml',
gschema_file,
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas'
)

Expand Down
6 changes: 3 additions & 3 deletions data/reco.desktop.in → data/reco.desktop.in.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[Desktop Entry]
Name=Reco
Name=@APP_NAME@
GenericName=Audio Recording App
Comment=Focus on recording
Categories=Audio;AudioVideo;Utility;Recorder;
Exec=com.github.ryonakano.reco
Icon=com.github.ryonakano.reco
Exec=@APP_ID@
Icon=@APP_ID@
Terminal=false
Type=Application
X-GNOME-UsesNotifications=true
Expand Down
2 changes: 1 addition & 1 deletion data/reco.gschema.xml → data/reco.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<value value="2" nick="dark"/>
</enum>

<schema path="/com/github/ryonakano/reco/" id="com.github.ryonakano.reco">
<schema path="/com/github/ryonakano/reco/" id="@APP_ID@">
<key name="delay" type="u">
<default>0</default>
<summary>Delay in seconds</summary>
Expand Down
6 changes: 3 additions & 3 deletions data/reco.metainfo.xml.in → data/reco.metainfo.xml.in.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2018-2024 Ryo Nakano -->
<component type="desktop-application">
<id>com.github.ryonakano.reco</id>
<launchable type="desktop-id">com.github.ryonakano.reco.desktop</launchable>
<translation type="gettext">com.github.ryonakano.reco</translation>
<id>@APP_ID@</id>
<launchable type="desktop-id">@APP_ID@.desktop</launchable>
<translation type="gettext">@GETTEXT_PACKAGE@</translation>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>

Expand Down
9 changes: 8 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ project(
'com.github.ryonakano.reco',
'vala', 'c',
version: '5.0.1',
meson_version: '>=0.57.0'
meson_version: '>=0.58.0'
)

app_name = 'Reco'
app_id = meson.project_name()
if get_option('development')
app_name += ' (Development)'
app_id += '.Devel'
endif

gnome = import('gnome')
i18n = import('i18n')

Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option('use_submodule', type: 'boolean', value: true, description: 'Whether to build using git submodule')
option('development', type: 'boolean', value: false, description: 'If this is a development build')
4 changes: 2 additions & 2 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data/reco.desktop.in
data/reco.metainfo.xml.in
data/reco.desktop.in.in
data/reco.metainfo.xml.in.in
src/MainWindow.vala
src/Model/Recorder.vala
src/View/CountDownView.vala
Expand Down
7 changes: 4 additions & 3 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ public class Application : Gtk.Application {

public Application () {
Object (
application_id: "com.github.ryonakano.reco",
flags: ApplicationFlags.FLAGS_NONE
application_id: Config.APP_ID,
flags: ApplicationFlags.FLAGS_NONE,
resource_base_path: Config.RESOURCE_PREFIX
);
}

static construct {
settings = new Settings ("com.github.ryonakano.reco");
settings = new Settings (Config.APP_ID);
}

private bool style_action_transform_to_cb (Binding binding, Value from_value, ref Value to_value) {
Expand Down
4 changes: 3 additions & 1 deletion src/Config.vala.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Config {
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string LOCALEDIR = @LOCALEDIR@;
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string APP_ID = @APP_ID@;
public const string RESOURCE_PREFIX = @RESOURCE_PREFIX@;
}
2 changes: 1 addition & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public class MainWindow : Gtk.ApplicationWindow {
notification.add_button_with_target_value (_("Open folder"), "app.open", new Variant.string (save_path.get_parent ().get_path ()));
}

application.send_notification ("com.github.ryonakano.reco", notification);
application.send_notification (Config.APP_ID, notification);
}

if (destroy_on_save) {
Expand Down
4 changes: 3 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
config_data = configuration_data()
config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_data.set_quoted('APP_ID', app_id)
config_data.set_quoted('RESOURCE_PREFIX', '/' + meson.project_name().replace('.', '/'))
config_file = configure_file(
input: 'Config.vala.in',
output: '@BASENAME@',
Expand Down Expand Up @@ -46,7 +48,7 @@ else
endif

executable(
meson.project_name(),
app_id,
asresources,
config_file,
sources,
Expand Down