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

Improve buildsystem #3586

Merged
merged 6 commits into from
Dec 10, 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/build_flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6
with:
bundle: bottles.flatpak
manifest-path: build-aux/com.usebottles.bottles.json
manifest-path: build-aux/com.usebottles.bottles.Devel.json
cache-key: flatpak-builder-${{ github.sha }}
4 changes: 2 additions & 2 deletions .github/workflows/update-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
PR_BRANCH: pr/ci-manifest/${{ github.ref_name }}
FEDC_ARGS: --update --require-important-update --commit-only --never-fork "bottles-repository/build-aux/com.usebottles.bottles.json"
FEDC_ARGS: --update --require-important-update --commit-only --never-fork "bottles-repository/build-aux/com.usebottles.bottles.Devel.json"
UPDATE_PYTHON: false

jobs:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
run: |
git checkout -B ${{ env.PR_BRANCH }}
git push -f --set-upstream origin ${{ env.PR_BRANCH }}
git diff ${{ github.ref_name }} --exit-code build-aux/com.usebottles.bottles.json
git diff ${{ github.ref_name }} --exit-code build-aux/com.usebottles.bottles.Devel.json
updated=$?
if [ $updated -ne 0 ] || [ "${{ env.UPDATE_PYTHON }}" = true ]; then
gh pr create --title ":robot:: Update manifest (important)" --body ":wrench: One or more modules marked as 'important' have been updated." --head ${{ env.PR_BRANCH }} --base ${{ github.ref_name }}
Expand Down
10 changes: 5 additions & 5 deletions CODING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
#### Build & install

```bash
flatpak-builder --install --user --force-clean ./.flatpak-builder/out ./build-aux/com.usebottles.bottles.json
flatpak-builder --install --user --force-clean ./.flatpak-builder/out ./build-aux/com.usebottles.bottles.Devel.json
```

#### Run

```bash
flatpak run com.usebottles.bottles
flatpak run com.usebottles.bottles.Devel
```

#### Uninstall devel version

```bash
flatpak uninstall com.usebottles.bottles//master
flatpak uninstall com.usebottles.bottles.Devel
```

## Unit Test
Expand Down Expand Up @@ -51,9 +51,9 @@ cat > po/POTFILES <<EOF
EOF
grep -rlP "_\(['\"]" bottles | sort >> po/POTFILES
cat >> po/POTFILES <<EOF
data/com.usebottles.bottles.desktop.in
data/com.usebottles.bottles.desktop.in.in
data/com.usebottles.bottles.gschema.xml
data/com.usebottles.bottles.metainfo.xml.in
data/com.usebottles.bottles.metainfo.xml.in.in
EOF
```

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ There are two methods to build Bottles. The first and longer method is using `or

1. Install [`org.flatpak.Builder`](https://github.com/flathub/org.flatpak.Builder) from Flathub
1. Clone `https://github.com/bottlesdevs/Bottles.git` (or your fork)
1. Run `flatpak run org.flatpak.Builder --install --install-deps-from=flathub --default-branch=master --force-clean build-dir build-aux/com.usebottles.bottles.json` in the terminal from the root of the repository (use `--user` if necessary)
1. Run `flatpak run com.usebottles.bottles//master` to launch it
1. Run `flatpak run org.flatpak.Builder --install --install-deps-from=flathub --default-branch=master --force-clean build-dir build-aux/com.usebottles.bottles.Devel.json` in the terminal from the root of the repository (use `--user` if necessary)
1. Run `flatpak run com.usebottles.bottles.Devel` to launch it

### Meson

Since Bottles is primarily and officially distributed as a Flatpak, we only provide instructions to directly build it inside a Flatpak environment:

1. Download and install the latest build of Bottles: [bottles-x86_64.zip](https://nightly.link/bottlesdevs/Bottles/workflows/build_flatpak/main/bottles-x86_64.zip). Unzip it, and run `flatpak install bottles.flatpak` (use `--user` if necessary)
2. Run `flatpak run -d --filesystem=$PWD --command=bash com.usebottles.bottles//master` from the root of the repository, followed by `./utils/install.sh`. This will build Bottles and install it under the `build/` directory.
2. Run `flatpak run -d --filesystem=$PWD --command=bash com.usebottles.bottles.Devel` from the root of the repository, followed by `./utils/install.sh`. This will build Bottles and install it under the `build/` directory.
3. Run `./build/bin/bottles` to launch Bottles

Due to GNOME Builder limitations, Builder cannot build Bottles for the time being; see [GNOME/gnome-builder#2061](https://gitlab.gnome.org/GNOME/gnome-builder/-/issues/2061) for more context. This is the best workaround we can provide.
Expand Down
3 changes: 2 additions & 1 deletion bottles/backend/params.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
APP_VERSION = "@APP_VERSION@"
APP_ID = "com.usebottles.bottles"
BASE_ID = "@BASE_ID@"
APP_ID = "@APP_ID@"
9 changes: 6 additions & 3 deletions bottles/frontend/bottles.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
pkgdatadir = "@pkgdatadir@"
localedir = "@localedir@"
# noinspection DuplicatedCode
gresource_path = f"{pkgdatadir}/bottles.gresource"
data_gresource_path = f"{pkgdatadir}/data.gresource"
bottles_gresource_path = f"{pkgdatadir}/bottles.gresource"
sys.path.insert(1, pkgdatadir)

# Remove GTK_THEME variable to prevent breakages
Expand All @@ -39,9 +40,11 @@
if __name__ == "__main__":
from gi.repository import Gio

resource = Gio.Resource.load(gresource_path)
data_resource = Gio.Resource.load(data_gresource_path)
bottles_resource = Gio.Resource.load(bottles_gresource_path)
# noinspection PyProtectedMember
resource._register()
data_resource._register()
bottles_resource._register()

from bottles.frontend import main

Expand Down
1 change: 0 additions & 1 deletion bottles/frontend/const.py

This file was deleted.

1 change: 0 additions & 1 deletion bottles/frontend/devel/const.py

This file was deleted.

3 changes: 2 additions & 1 deletion bottles/frontend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class Bottles(Adw.Application):

def __init__(self):
super().__init__(
application_id="com.usebottles.bottles",
application_id=APP_ID,
resource_base_path="/com/usebottles/bottles",
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
register_session=True,
)
Expand Down
12 changes: 4 additions & 8 deletions bottles/frontend/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,15 @@ params_file = configure_file(

fs = import('fs')

if not fs.is_file('/' + '.flatpak-info')
error('file does not exist')
endif

bottles_sources = [
'__init__.py',
'main.py',
'const.py',
'operation.py',
params_file,
'/' + '.flatpak-info',
]

if get_option('devel')
bottles_sources += [
'devel/const.py',
]
endif

install_data(bottles_sources, install_dir: frontenddir)
5 changes: 3 additions & 2 deletions bottles/frontend/params.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Application details
APP_NAME = "@APP_NAME@"
APP_NAME_LOWER = APP_NAME.lower()
APP_ID = "com.usebottles.bottles"
BASE_ID = "@BASE_ID@"
APP_ID = "@APP_ID@"
APP_VERSION = "@APP_VERSION@"
APP_ICON = "@APP_ID@"
BUILD_TYPE = "prod"
PROFILE = "@PROFILE@"

# Internal settings not user editable
ANIM_DURATION = 120
Expand Down
141 changes: 55 additions & 86 deletions bottles/frontend/ui/bottles.gresource.xml
Original file line number Diff line number Diff line change
@@ -1,89 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/usebottles/bottles">
<file>style.css</file>
<file>style-dark.css</file>
<file>window.ui</file>
<file>new.ui</file>
<file>list.ui</file>
<file>loading.ui</file>
<file>list-entry.ui</file>
<file>task-entry.ui</file>
<file>dependency-entry.ui</file>
<file>program-entry.ui</file>
<file>importer-entry.ui</file>
<file>state-entry.ui</file>
<file>installer-entry.ui</file>
<file>dll-override-entry.ui</file>
<file>env-var-entry.ui</file>
<file>component-entry.ui</file>
<file>drive-entry.ui</file>
<file>library-entry.ui</file>
<file>local-resource-entry.ui</file>
<file>exclusion-pattern-entry.ui</file>
<file>details.ui</file>
<file>details-bottle.ui</file>
<file>details-dependencies.ui</file>
<file>details-installers.ui</file>
<file>details-preferences.ui</file>
<file>details-versioning.ui</file>
<file>details-taskmanager.ui</file>
<file>preferences.ui</file>
<file>importer.ui</file>
<file>library.ui</file>
<file>dialog-launch-options.ui</file>
<file>dialog-dll-overrides.ui</file>
<file>dialog-env-vars.ui</file>
<file>dialog-crash-report.ui</file>
<file>dialog-duplicate.ui</file>
<file>dialog-rename.ui</file>
<file>dialog-gamescope.ui</file>
<file>dialog-vkbasalt.ui</file>
<file>dialog-fsr.ui</file>
<file>dialog-mangohud.ui</file>
<file>dialog-display.ui</file>
<file>dialog-drives.ui</file>
<file>dialog-journal.ui</file>
<file>dialog-sandbox.ui</file>
<file>dialog-installer.ui</file>
<file>dialog-bottle-picker.ui</file>
<file>dialog-proton-alert.ui</file>
<file>dialog-deps-check.ui</file>
<file>dialog-exclusion-patterns.ui</file>
<file>dialog-upgrade-versioning.ui</file>
<file>dialog-vmtouch.ui</file>
<file>onboard.ui</file>
<file>about.ui</file>

</gresource>
<gresource prefix="/com/usebottles/bottles/icons/scalable/actions">
<file alias="bottles-steam-symbolic.svg">../../../data/icons/symbolic/scalable/apps/bottles-steam-symbolic.svg</file>
<file alias="external-link-symbolic.svg">../../../data/icons/symbolic/scalable/actions/external-link-symbolic.svg</file>
<file alias="applications-system-symbolic.svg">../../../data/icons/symbolic/scalable/actions/applications-system-symbolic.svg</file>
<file alias="application-x-addon-symbolic.svg">../../../data/icons/symbolic/scalable/actions/application-x-addon-symbolic.svg</file>
<file alias="computer-symbolic.svg">../../../data/icons/symbolic/scalable/actions/computer-symbolic.svg</file>
<file alias="document-save-symbolic.svg">../../../data/icons/symbolic/scalable/actions/document-save-symbolic.svg</file>
<file alias="go-next-symbolic.svg">../../../data/icons/symbolic/scalable/actions/go-next-symbolic.svg</file>
<file alias="go-previous-symbolic.svg">../../../data/icons/symbolic/scalable/actions/go-previous-symbolic.svg</file>
<file alias="media-playback-start-symbolic.svg">../../../data/icons/symbolic/scalable/actions/media-playback-start-symbolic.svg</file>
<file alias="media-playback-stop-symbolic.svg">../../../data/icons/symbolic/scalable/actions/media-playback-stop-symbolic.svg</file>
<file alias="preferences-desktop-apps-symbolic.svg">../../../data/icons/symbolic/scalable/actions/preferences-desktop-apps-symbolic.svg</file>
<file alias="preferences-system-time-symbolic.svg">../../../data/icons/symbolic/scalable/actions/preferences-system-time-symbolic.svg</file>
<file alias="selection-mode-symbolic.svg">../../../data/icons/symbolic/scalable/actions/selection-mode-symbolic.svg</file>
<file alias="system-run-symbolic.svg">../../../data/icons/symbolic/scalable/actions/system-run-symbolic.svg</file>
<file alias="system-shutdown-symbolic.svg">../../../data/icons/symbolic/scalable/actions/system-shutdown-symbolic.svg</file>
<file alias="system-software-install-symbolic.svg">../../../data/icons/symbolic/scalable/actions/system-software-install-symbolic.svg</file>
<file alias="view-more-symbolic.svg">../../../data/icons/symbolic/scalable/actions/view-more-symbolic.svg</file>
<file alias="open-menu-symbolic.svg">../../../data/icons/symbolic/scalable/actions/open-menu-symbolic.svg</file>
<file alias="system-search-symbolic.svg">../../../data/icons/symbolic/scalable/actions/system-search-symbolic.svg</file>
<file alias="list-add-symbolic.svg">../../../data/icons/symbolic/scalable/actions/list-add-symbolic.svg</file>
<file alias="paper-symbolic.svg">../../../data/icons/symbolic/scalable/actions/paper-symbolic.svg</file>
<file alias="info-symbolic.svg">../../../data/icons/symbolic/scalable/actions/info-symbolic.svg</file>
<file alias="library-symbolic.svg">../../../data/icons/symbolic/scalable/actions/library-symbolic.svg</file>
<file alias="warning-symbolic.svg">../../../data/icons/symbolic/scalable/actions/warning-symbolic.svg</file>
</gresource>
<gresource prefix="/com/usebottles/bottles/images">
<file alias="images/bottles-welcome.svg">../../../data/images/bottles-welcome.svg</file>
<file alias="images/bottles-welcome-night.svg">../../../data/images/bottles-welcome-night.svg</file>
</gresource>
<gresource prefix="/com/usebottles/bottles">
<file>style.css</file>
<file>style-dark.css</file>
<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">new.ui</file>
<file preprocess="xml-stripblanks">list.ui</file>
<file preprocess="xml-stripblanks">loading.ui</file>
<file preprocess="xml-stripblanks">list-entry.ui</file>
<file preprocess="xml-stripblanks">task-entry.ui</file>
<file preprocess="xml-stripblanks">dependency-entry.ui</file>
<file preprocess="xml-stripblanks">program-entry.ui</file>
<file preprocess="xml-stripblanks">importer-entry.ui</file>
<file preprocess="xml-stripblanks">state-entry.ui</file>
<file preprocess="xml-stripblanks">installer-entry.ui</file>
<file preprocess="xml-stripblanks">dll-override-entry.ui</file>
<file preprocess="xml-stripblanks">env-var-entry.ui</file>
<file preprocess="xml-stripblanks">component-entry.ui</file>
<file preprocess="xml-stripblanks">drive-entry.ui</file>
<file preprocess="xml-stripblanks">library-entry.ui</file>
<file preprocess="xml-stripblanks">local-resource-entry.ui</file>
<file preprocess="xml-stripblanks">exclusion-pattern-entry.ui</file>
<file preprocess="xml-stripblanks">details.ui</file>
<file preprocess="xml-stripblanks">details-bottle.ui</file>
<file preprocess="xml-stripblanks">details-dependencies.ui</file>
<file preprocess="xml-stripblanks">details-installers.ui</file>
<file preprocess="xml-stripblanks">details-preferences.ui</file>
<file preprocess="xml-stripblanks">details-versioning.ui</file>
<file preprocess="xml-stripblanks">details-taskmanager.ui</file>
<file preprocess="xml-stripblanks">preferences.ui</file>
<file preprocess="xml-stripblanks">importer.ui</file>
<file preprocess="xml-stripblanks">library.ui</file>
<file preprocess="xml-stripblanks">dialog-launch-options.ui</file>
<file preprocess="xml-stripblanks">dialog-dll-overrides.ui</file>
<file preprocess="xml-stripblanks">dialog-env-vars.ui</file>
<file preprocess="xml-stripblanks">dialog-crash-report.ui</file>
<file preprocess="xml-stripblanks">dialog-duplicate.ui</file>
<file preprocess="xml-stripblanks">dialog-rename.ui</file>
<file preprocess="xml-stripblanks">dialog-gamescope.ui</file>
<file preprocess="xml-stripblanks">dialog-vkbasalt.ui</file>
<file preprocess="xml-stripblanks">dialog-fsr.ui</file>
<file preprocess="xml-stripblanks">dialog-mangohud.ui</file>
<file preprocess="xml-stripblanks">dialog-display.ui</file>
<file preprocess="xml-stripblanks">dialog-drives.ui</file>
<file preprocess="xml-stripblanks">dialog-journal.ui</file>
<file preprocess="xml-stripblanks">dialog-sandbox.ui</file>
<file preprocess="xml-stripblanks">dialog-installer.ui</file>
<file preprocess="xml-stripblanks">dialog-bottle-picker.ui</file>
<file preprocess="xml-stripblanks">dialog-proton-alert.ui</file>
<file preprocess="xml-stripblanks">dialog-deps-check.ui</file>
<file preprocess="xml-stripblanks">dialog-exclusion-patterns.ui</file>
<file preprocess="xml-stripblanks">dialog-upgrade-versioning.ui</file>
<file preprocess="xml-stripblanks">dialog-vmtouch.ui</file>
<file preprocess="xml-stripblanks">onboard.ui</file>
<file preprocess="xml-stripblanks">about.ui</file>
</gresource>
</gresources>
1 change: 0 additions & 1 deletion bottles/frontend/ui/list.blp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ template $BottleView: Adw.Bin {
}

Adw.StatusPage bottle_status {
icon-name: "com.usebottles.bottles-symbolic";
title: _("Bottles");
hexpand: true;
vexpand: true;
Expand Down
3 changes: 1 addition & 2 deletions bottles/frontend/ui/loading.blp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ template $LoadingView: Adw.Bin {
Box {
orientation: vertical;

Adw.StatusPage {
icon-name: "com.usebottles.bottles";
Adw.StatusPage loading_status_page {
title: _("Starting up…");
hexpand: true;
vexpand: true;
Expand Down
1 change: 0 additions & 1 deletion bottles/frontend/ui/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ using Adw 1;

template $MainWindow: Adw.ApplicationWindow {
title: "Bottles";
icon-name: "com.usebottles.bottles";
close-request => $on_close_request();

Adw.ToastOverlay toasts {
Expand Down
3 changes: 3 additions & 0 deletions bottles/frontend/views/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from bottles.backend.utils.threading import RunAsync
from bottles.backend.wine.executor import WineExecutor
from bottles.frontend.utils.filters import add_executable_filters, add_all_filters
from bottles.frontend.params import APP_ID


@Gtk.Template(resource_path="/com/usebottles/bottles/list-entry.ui")
Expand Down Expand Up @@ -182,6 +183,8 @@ def __init__(self, window, arg_bottle=None, **kwargs):
Signals.ManagerLocalBottlesLoaded, self.backend_local_bottle_loaded
)

self.bottle_status.set_icon_name(f"{APP_ID}-symbolic")

self.update_bottles()

def __search_bottles(self, widget, event=None, data=None):
Expand Down
3 changes: 3 additions & 0 deletions bottles/frontend/views/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from bottles.backend.models.result import Result
from bottles.backend.state import SignalManager, Signals
from bottles.frontend.utils.gtk import GtkUtils
from bottles.frontend.params import APP_ID


@Gtk.Template(resource_path="/com/usebottles/bottles/loading.ui")
Expand All @@ -33,10 +34,12 @@ class LoadingView(Adw.Bin):
label_fetched = Gtk.Template.Child()
label_downloading = Gtk.Template.Child()
btn_go_offline = Gtk.Template.Child()
loading_status_page = Gtk.Template.Child()
# endregion

def __init__(self, **kwargs):
super().__init__(**kwargs)
self.loading_status_page.set_icon_name(APP_ID)
self.btn_go_offline.connect("clicked", self.go_offline)

@GtkUtils.run_in_main_loop
Expand Down
4 changes: 2 additions & 2 deletions bottles/frontend/windows/bottlepicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from bottles.backend.managers.manager import Manager
from bottles.backend.models.config import BottleConfig
from bottles.frontend.params import APP_ID
from bottles.frontend.params import BASE_ID


class BottleEntry(Adw.ActionRow):
Expand All @@ -36,7 +36,7 @@ class BottlePickerDialog(Adw.ApplicationWindow):
"""This class should not be called from the application GUI, only from CLI."""

__gtype_name__ = "BottlePickerDialog"
settings = Gio.Settings.new(APP_ID)
settings = Gio.Settings.new(BASE_ID)
Adw.init()

# region Widgets
Expand Down
Loading
Loading