From b65188cdb67a13e8d7b4b80050786df53ae0e42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 13 Apr 2022 19:36:36 +0200 Subject: [PATCH] misc: Create developers flatpak variant Be able to use nightly while hacking --- .gitlab-ci.yml | 40 ++++++++++++----- build-aux/org.gnome.Fractal.Hack.json | 65 +++++++++++++++++++++++++++ data/icons/org.gnome.Fractal.Hack.svg | 1 + meson.build | 13 +++++- meson_options.txt | 4 +- src/meson.build | 2 +- 6 files changed, 108 insertions(+), 17 deletions(-) create mode 100644 build-aux/org.gnome.Fractal.Hack.json create mode 100644 data/icons/org.gnome.Fractal.Hack.svg diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee095c4f..f2d68e94 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,16 +6,23 @@ stages: - deploy variables: - MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json" FLATPAK_MODULE: "fractal" - APP_ID: "org.gnome.Fractal.Devel" RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo" CI_IMAGE_X86_64: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/rust_bundle:master" CI_IMAGE_AARCH64: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/aarch64:gnome-nightly" +.hack: + variables: + MANIFEST_PATH: "build-aux/org.gnome.Fractal.Hack.json" + APP_ID: "org.gnome.Fractal.Hack" + +.devel: + variables: + MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json" + APP_ID: "org.gnome.Fractal.Devel" + .build_template: script: - - rewrite-flatpak-manifest ${MANIFEST_PATH} ${FLATPAK_MODULE} ${CONFIG_OPTS} - > xvfb-run -a -s "-screen 0 1024x768x24" flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH} @@ -76,6 +83,7 @@ checks: # Lint the code cargo-clippy: + extends: .hack image: '${CI_IMAGE_X86_64}' stage: check tags: @@ -87,36 +95,44 @@ cargo-clippy: # Build a debug version of the flatpak # Except on main flatpak: - extends: .build_x86_64 + extends: + - .hack + - .build_x86_64 stage: test variables: - BUNDLE: "fractal-devel.flatpak" - CONFIG_OPTS: "-Dprofile=development" + BUNDLE: "fractal-hack.flatpak" except: - main # Build the nightly version of the flatpak # Only on main build-x86_64: - extends: .build_x86_64 + extends: + - .devel + - .build_x86_64 stage: build variables: - BUNDLE: "fractal-nightly-x86_64.flatpak" - CONFIG_OPTS: "-Dprofile=nightly" + MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json" + APP_ID: "org.gnome.Fractal.Devel" + BUNDLE: "fractal-devel-x86_64.flatpak" only: - main build-aarch64: - extends: .build_aarch64 + extends: + - .devel + - .build_aarch64 stage: build variables: - BUNDLE: "fractal-nightly-aarch64.flatpak" - CONFIG_OPTS: "-Dprofile=nightly" + MANIFEST_PATH: "build-aux/org.gnome.Fractal.Devel.json" + APP_ID: "org.gnome.Fractal.Devel" + BUNDLE: "fractal-devel-aarch64.flatpak" only: - main # Build the docs # Only on main pages: + extends: .devel image: '${CI_IMAGE_X86_64}' stage: doc tags: diff --git a/build-aux/org.gnome.Fractal.Hack.json b/build-aux/org.gnome.Fractal.Hack.json new file mode 100644 index 00000000..02d1d28e --- /dev/null +++ b/build-aux/org.gnome.Fractal.Hack.json @@ -0,0 +1,65 @@ +{ + "app-id": "org.gnome.Fractal.Hack", + "runtime": "org.gnome.Platform", + "runtime-version": "master", + "sdk": "org.gnome.Sdk", + "sdk-extensions": [ + "org.freedesktop.Sdk.Extension.rust-stable", + "org.freedesktop.Sdk.Extension.llvm12" + ], + "command": "fractal", + "finish-args": [ + "--socket=fallback-x11", + "--socket=wayland", + "--socket=pulseaudio", + "--share=network", + "--share=ipc", + "--device=dri", + "--env=RUST_LOG=fractal=debug", + "--env=G_MESSAGES_DEBUG=none", + "--env=RUST_BACKTRACE=1" + ], + "build-options": { + "append-ld-library-path": "/usr/lib/sdk/llvm12/lib", + "append-path": "/usr/lib/sdk/llvm12/bin:/usr/lib/sdk/rust-stable/bin", + "build-args": [ + "--share=network" + ], + "test-args": [ + "--socket=x11", + "--share=network" + ] + }, + "modules": [ + { + "name": "libshumate", + "buildsystem": "meson", + "config-opts": [ + "-Dgir=false", + "-Dvapi=false", + "-Dgtk_doc=false" + ], + "sources": [ + { + "type": "git", + "url": "https://gitlab.gnome.org/GNOME/libshumate/", + "tag": "1.0.0.alpha.1" + } + ] + }, + { + "name": "fractal", + "buildsystem": "meson", + "run-tests": true, + "config-opts": [ + "-Dprofile=hack" + ], + "sources": [ + { + "type": "dir", + "path": "../" + } + ] + } + ] +} \ No newline at end of file diff --git a/data/icons/org.gnome.Fractal.Hack.svg b/data/icons/org.gnome.Fractal.Hack.svg new file mode 100644 index 00000000..cd749398 --- /dev/null +++ b/data/icons/org.gnome.Fractal.Hack.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/meson.build b/meson.build index 7bb26abb..ed7ed47a 100644 --- a/meson.build +++ b/meson.build @@ -47,7 +47,16 @@ iconsdir = datadir / 'icons' podir = meson.project_source_root() / 'po' gettext_package = meson.project_name() -if get_option('profile') == 'development' or get_option('profile') == 'nightly' +if get_option('profile') == 'hack' + profile = 'Hack' + vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() + if vcs_tag == '' + version_suffix = '-hack' + else + version_suffix = '-@0@'.format(vcs_tag) + endif + application_id = '@0@.@1@'.format(base_id, profile) +elif get_option('profile') == 'development' profile = 'Devel' vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() if vcs_tag == '' @@ -68,7 +77,7 @@ meson.add_dist_script( meson.project_source_root() ) -if get_option('profile') == 'development' +if get_option('profile') == 'hack' # Setup pre-commit hook for ensuring coding style is always consistent message('Setting up git pre-commit hook..') run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit') diff --git a/meson_options.txt b/meson_options.txt index bcc92673..d539538d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,8 +4,8 @@ option( choices: [ 'default', 'development', - 'nightly', + 'hack', ], value: 'default', - description: 'The build profile for Fractal. One of "default" or "development".' + description: 'The build profile for Fractal. One of "default", "development" or "hack".' ) diff --git a/src/meson.build b/src/meson.build index a95b4946..a8e9092b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -21,7 +21,7 @@ run_command( cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ] cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ] -if get_option('profile') == 'default' or get_option('profile') == 'nightly' +if get_option('profile') == 'default' or get_option('profile') == 'development' cargo_options += [ '--release' ] rust_target = 'release' message('Building in release mode')