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

elementary OS 7 App Template #26

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4e6882b
Add eos7 flatpak manifest and template file
colinkiama Apr 8, 2023
6972fe7
Create root meson.build file for eos7 template
colinkiama Apr 8, 2023
1ff5bf0
Add src files for eos7 template
colinkiama Apr 8, 2023
053ff33
Add data files for eos7 template
colinkiama Apr 8, 2023
d8027d4
Add translation (po) files for eos7 template
colinkiama Apr 8, 2023
5937594
Add editorconfig for eos7
colinkiama Apr 8, 2023
a2444bb
Add gitignore for eos7
colinkiama Apr 8, 2023
fc34901
Add README for eos7
colinkiama Apr 8, 2023
882e93e
Improve build instructions in eos7 template
colinkiama Apr 8, 2023
3688815
Add and load css stylesheet in eos7 template
colinkiama Apr 8, 2023
c4332fd
Fix build errors in eos7 template
colinkiama Apr 8, 2023
92c26c1
Fix default namespace name in eos7 template
colinkiama Apr 8, 2023
da4d12b
Improved gitignore and default namespace for eos7
colinkiama Apr 8, 2023
43390aa
Fix typos and build errors with eos7 template
colinkiama Apr 8, 2023
d940f5d
Move icons to separate directory in eos7
colinkiama Apr 8, 2023
69e2be6
Add CI Workflow for eos7 template
colinkiama Apr 8, 2023
246c148
Fix translation generation bugs
colinkiama Apr 8, 2023
12c5c40
Vertically center label in eos7 template
colinkiama Apr 8, 2023
3fef545
Fix gitignore
colinkiama Apr 8, 2023
f79ccc3
Remove old gitignore for eos7
colinkiama Apr 8, 2023
45a8ae7
Run templating through github ci in eos7
colinkiama Apr 8, 2023
cafd521
Fix lint issues in eos7 template
colinkiama Apr 8, 2023
d110c6f
Add URL Variables for eos7 template
colinkiama Apr 8, 2023
0e9d94f
Update eos7 url template variable patterns
colinkiama Apr 8, 2023
44a685f
Fix: CI Workflow being run through eos7 template
colinkiama Apr 8, 2023
ea968e2
Imporve organisation of appstream metadata for eos7 template
colinkiama Apr 8, 2023
f244e25
Add information about AppStream releases in eos7 template
colinkiama Apr 8, 2023
da54f1b
Fix unit tests in eos7 template
colinkiama Apr 8, 2023
3886ac1
Fix metadata typos in eos7 template
colinkiama Apr 8, 2023
f9e160f
Fix elementary Adwaita override behaviour
colinkiama Apr 8, 2023
6ec2010
Rename elementary OS templates
colinkiama Apr 8, 2023
808c48c
Move internationalisation setup to Application class (eos)
colinkiama Apr 8, 2023
787bc0c
Rely on granite instead of libadwaita (eos)
colinkiama Apr 14, 2023
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
36 changes: 36 additions & 0 deletions templates/eos/${APP_ID}.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is the same ID that you've used in meson.build and other files
app-id: ${APP_ID}

# Instead of manually specifying a long list of build and runtime dependencies,
# we can use a convenient pre-made runtime and SDK. For this example, we'll be
# using the runtime and SDK provided by elementary.
runtime: io.elementary.Platform
runtime-version: "7.2"
sdk: io.elementary.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.vala
build-options:
prepend-path: /usr/lib/sdk/vala/bin
prepend-ld-library-path: /usr/lib/sdk/vala/lib

# This should match the exec line in your .desktop file and usually is the same
# as your app ID
command: ${APP_ID}

# Here we can specify the kinds of permissions our app needs to run. Since we're
# not using hardware like webcams, making sound, or reading external files, we
# only need permission to draw our app on screen using either X11 or Wayland.
finish-args:
- "--share=ipc"
- "--socket=fallback-x11"
- "--socket=wayland"

# This section is where you list all the source code required to build your app.
# If we had external dependencies that weren't included in our SDK, we would list
# them here.
modules:
- name: ${APP_NAME}
buildsystem: meson
sources:
- type: dir
path: .
66 changes: 66 additions & 0 deletions templates/eos/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

# This workflow will run for any pull request or pushed commit
# on: [push, pull_request]

on:
push:
branches:
- main

pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "flatpak"
flatpak:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# This job runs in a special container designed for building Flatpaks for AppCenter
container:
image: ghcr.io/elementary/flatpak-platform/runtime:7.2
options: --privileged

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it
- uses: actions/checkout@v3

- name: "Install Vala Freedesktop Extension SDK"
run: "flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && flatpak install -y runtime/org.freedesktop.Sdk.Extension.vala/x86_64/22.08"

# Builds your flatpak manifest using the Flatpak Builder action
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
# This is the name of the Bundle file we're building and can be anything you like
bundle: ${APP_NAME}.flatpak
# This uses your app's RDNN ID
manifest-path: ${APP_ID}.yml

# You can automatically run any of the tests you've created as part of this workflow
run-tests: true

# These lines specify the location of the elementary Runtime and Sdk
repository-name: appcenter
repository-url: https://flatpak.elementary.io/repo.flatpakrepo
cache-key: "flatpak-builder-${{ github.sha }}"

lint:
runs-on: ubuntu-latest

container:
image: valalang/lint

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Lint
run: io.elementary.vala-lint .
6 changes: 6 additions & 0 deletions templates/eos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/_build
/build
/app
/.flatpak
/.flatpak-builder
/subprojects/**/
62 changes: 46 additions & 16 deletions templates/eos/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,52 @@
# ${PROJECT_NAME}
# ${APP_TITLE}

${PROJECT_SUMMARY}
${APP_SUMMARY}

## Building, Testing, and Installation
## Build Instructions

You'll need the following dependencies to build:
* libgtk-3-dev
* meson
* valac
### Flatpak (Recommended)

Run `meson build` to configure the build environment and run `ninja` to build
```Bash
meson build --prefix=/usr
cd build
ninja
Either:

- Use Visual Studio Code with [Flatpak extension](https://marketplace.visualstudio.com/items?itemName=bilelmoussaoui.flatpak-vscode
- Use [GNOME Builder](https://apps.gnome.org/en-GB/app/org.gnome.Builder/)
- Flatpak integrations for of your preferred IDE/Code Editor
- Or use the [flatpak and flatpak-builder](https://docs.flatpak.org/en/latest/first-build.htm) commands.

### Meson

#### Dependencies

- glib-2.0
- gobject-2.0
- gee-0.8
- gtk4
- granite-7

#### Build Commands

To build:

```sh
meson build --prefix=/usr
cd build
ninja
```
To install, use `ninja install`, then execute with `com.${USERNAME}.${PROGRAM_NAME}`
```Bash
sudo ninja install
com.github.${USERNAME}.${PROGRAM_NAME}

To test:

(Assuming you're in the project root and have already built the app)

```sh
cd build
meson test
```

To install:

(Assuming you're in project root)

```sh
cd build
sudo ninja install
```
11 changes: 11 additions & 0 deletions templates/eos/data/${APP_NAME}.desktop.in.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.0
Type=Application

Name=@APP_TITLE@
Comment=@APP_SUMMARY@
Categories=${APP_CATEGORIES}

Icon=@APP_ID@
Exec=@APP_ID@
Terminal=false
6 changes: 6 additions & 0 deletions templates/eos/data/${APP_NAME}.gresource.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="@APP_PATH@">
<file>style.css</file>
</gresource>
</gresources>
20 changes: 20 additions & 0 deletions templates/eos/data/${APP_NAME}.gschema.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema path="@APP_PATH@" id="@APP_ID@">
<key name="window-width" type="i">
<default>640</default>
<summary>Most recent window width</summary>
<description>Most recent window width</description>
</key>
<key name="window-height" type="i">
<default>480</default>
<summary>Most recent window height</summary>
<description>Most recent window height</description>
</key>
<key name="window-maximized" type="b">
<default>false</default>
<summary>Open window maximized.</summary>
<description>Whether the main window of the application should open maximized or not.</description>
</key>
</schema>
</schemalist>
32 changes: 32 additions & 0 deletions templates/eos/data/${APP_NAME}.metainfo.xml.in.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>@APP_ID@</id>
<launchable type="desktop-id">@[email protected]</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>@APP_LICENSE_TYPE@</project_license>

<name>@APP_TITLE@</name>
<summary>@APP_SUMMARY@</summary>
<description>
<p>@APP_SUMMARY@</p>
</description>

<url type="homepage">@APP_HOMEPAGE_URL@</url>
<url type="bugtracker">@APP_BUG_TRACKER_URL@</url>

<developer_name>@APP_DEVELOPER_NAME@</developer_name>

<content_rating type="oars-1.1"></content_rating>

<provides>
<binary>@APP_ID@</binary>
</provides>

<releases>
<!--
You need to add at least one release so that the GitHub CI Action can build your flatpak
For more infomation, see the AppStream documentation:
https://freedesktop.org/software/appstream/docs/sect-Metadata-Releases.html
-->
</releases>
</component>
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
88 changes: 88 additions & 0 deletions templates/eos/data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Tell meson where to find our resources file and to compile it as a GResource
gresource = gnome.compile_resources(
'gresource',
configure_file(
input: app_name + '.gresource.xml.in',
output: app_name + '.gresource.xml',
configuration: config_data,
),
source_dir: join_paths(meson.source_root(), 'data'),
)

#Translate and install our .desktop file
desktop_file = i18n.merge_file(
input: configure_file(
input: app_name + '.desktop.in.in',
output: app_name + '.desktop.in',
configuration: config_data,
),
output: app_id + '.desktop',
po_dir: meson.source_root() / 'po',
type: 'desktop',
install: true,
install_dir: get_option('datadir') / 'applications',
)

desktop_utils = find_program('desktop-file-validate', required: false)
if desktop_utils.found()
test('Validate desktop file', desktop_utils, args: [desktop_file])
endif

# Translate and install our .metainfo file
appstream_file = i18n.merge_file(
input: configure_file(
input: app_name + '.metainfo.xml.in.in',
output: app_name + '.metainfo.xml.in',
configuration: config_data,
),
output: app_id + '.metainfo.xml',
po_dir: meson.source_root() / 'po',
install: true,
install_dir: get_option('datadir') / 'metainfo',
)

appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test(
'Validate appstream file',
appstream_util,
args: ['validate', appstream_file],
)
endif

# Install gschema (settings) file
gschema_file = configure_file(
input: app_name + '.gschema.xml.in',
output: app_id + '.gschema.xml',
configuration: config_data,
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
)

compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found()
test(
'Validate schema file',
compile_schemas,
args: ['--strict', '--dry-run', meson.current_build_dir()],
)
endif

# Install our icons in all the required sizes
icon_sizes = ['16', '24', '32', '48', '64', '128']

foreach i : icon_sizes
install_data(
'icons' / i + '.svg',
install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i /
'apps',
rename: app_id + '.svg',
)
install_data(
'icons' / i + '.svg',
install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i +
'@2' / 'apps',
rename: app_id + '.svg',
)
endforeach


Empty file added templates/eos/data/style.css
Empty file.
Loading