diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 569adbc..28d2af0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ flatpak: variables: # We are running tests manually RUN_TESTS: "0" - CONFIG_OPTS: "-Dprofile=ci" + CONFIG_OPTS: "-Dprofile=release -Dapp_id_suffix=.Devel" flatpak@aarch64: extends: ".flatpak@aarch64" @@ -23,7 +23,7 @@ flatpak@aarch64: interruptible: true variables: RUN_TESTS: "0" - CONFIG_OPTS: "-Dprofile=ci" + CONFIG_OPTS: "-Dprofile=release -Dapp_id_suffix=.Devel" cargo-fmt: image: "rust:slim" diff --git a/build-aux/flatpak/org.gnome.Loupe.Devel.json b/build-aux/flatpak/org.gnome.Loupe.Devel.json index 5a0fee0..b21a922 100644 --- a/build-aux/flatpak/org.gnome.Loupe.Devel.json +++ b/build-aux/flatpak/org.gnome.Loupe.Devel.json @@ -120,7 +120,8 @@ "name": "loupe", "buildsystem": "meson", "config-opts": [ - "-Dprofile=development" + "-Dprofile=dev", + "-Dapp_id_suffix=.Devel" ], "sources": [ { diff --git a/data/meson.build b/data/meson.build index 29da3b4..1aa6f22 100644 --- a/data/meson.build +++ b/data/meson.build @@ -108,7 +108,7 @@ gschema_conf = configuration_data() gschema_conf.set('app-id', app_id) gschema_conf.set('gettext-package', meson.project_name()) configure_file( - input: '@0@.gschema.xml.in'.format(base_id), + input: 'org.gnome.Loupe.gschema.xml.in', output: '@0@.gschema.xml'.format(app_id), configuration: gschema_conf, install: true, diff --git a/meson.build b/meson.build index f2f3683..afb8003 100644 --- a/meson.build +++ b/meson.build @@ -24,11 +24,9 @@ gtk4_x11 = dependency('gtk4-x11', required: get_option('x11')) cargo = find_program('cargo', required: true) glib_compile_schemas = find_program('glib-compile-schemas', required: true) -profile = '' version_suffix = '' if get_option('profile') != 'release' - profile = '.Devel' vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip() if vcs_tag == '' version_suffix = '-devel' @@ -39,8 +37,8 @@ endif prefix = get_option('prefix') -base_id = 'org.gnome.Loupe' -app_id = 'org.gnome.Loupe@0@'.format(profile) +app_id = 'org.gnome.Loupe@0@'.format(get_option('app_id_suffix')) +profile = get_option('profile') version = meson.project_version() + version_suffix localedir = prefix / get_option('localedir') bindir = prefix / get_option('bindir') diff --git a/meson_options.txt b/meson_options.txt index 65fdaf0..7228a3e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,16 +1,19 @@ option( 'profile', type: 'combo', - description: 'The build profiles for the application. Use development or ci for the .Devel app ID. ci also produces optimized bundles.', - choices: [ - 'release', - 'development', - 'ci', - ], + choices: ['release', 'dev'], value: 'release', + description: 'Cargo profile value.', +) +option( + 'app_id_suffix', + type: 'combo', + choices: ['', '.Devel'], + value: '', + description: 'Value will be appended to the app id.', ) option( 'x11', type: 'feature', description: 'Enable X11 specific features.', -) +) \ No newline at end of file diff --git a/src/config.rs b/src/config.rs index 53056ea..3612ca1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -16,7 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later pub const APP_ID: &str = default_env(option_env!("APP_ID"), "org.gnome.Loupe.Devel"); -pub const PROFILE: &str = default_env(option_env!("PROFILE"), ".Devel"); pub const VERSION: &str = default_env(option_env!("VERSION"), "unknown"); pub const LOCALEDIR: &str = default_env(option_env!("LOCALEDIR"), "/usr/share/locale/"); diff --git a/src/meson.build b/src/meson.build index 536190d..2957450 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,28 +3,26 @@ source_root = meson.project_source_root() cargo_options = ['--manifest-path', source_root / 'Cargo.toml'] cargo_options += ['--target-dir', build_root / 'src'] - -if get_option('profile') == 'development' - rust_target = 'debug' - message('Building in debug mode') -else - cargo_options += ['--release'] - rust_target = 'release' - message('Building in release mode') -endif +cargo_options += ['--profile', profile] if gtk4_x11.found() cargo_options += ['--features', 'x11'] endif +if profile == 'dev' + rust_target = 'debug' +elif profile == 'release' + rust_target = 'release' +endif + cargo_env = { 'CARGO_HOME': build_root / 'cargo-home', 'APP_ID': app_id, - 'PROFILE': profile, 'VERSION': version, 'LOCALEDIR': localedir, } +# Build binary cargo_build = custom_target( 'cargo-build', build_by_default: true, @@ -39,6 +37,7 @@ cargo_build = custom_target( ], ) +# Copy binary custom_target( 'cp-binary', depends: cargo_build, @@ -67,6 +66,7 @@ custom_target( ], ) +# Run tests test( 'cargo-test', cargo, diff --git a/src/window.rs b/src/window.rs index e865a44..5c104a5 100644 --- a/src/window.rs +++ b/src/window.rs @@ -205,7 +205,7 @@ mod imp { } )); - if config::PROFILE == ".Devel" { + if config::APP_ID.ends_with(".Devel") { obj.add_css_class("devel"); }