Skip to content

Commit

Permalink
[WIP] Meson build system
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Dec 25, 2023
1 parent 80cb5f8 commit f7ad7b4
Show file tree
Hide file tree
Showing 54 changed files with 730 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .github/problem-matchers/generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"owner": "generic",
"pattern": [
{
"regexp": "^([^\\s:]+):(\\d+)(?::(\\d+))?:?\\s+(?:((?i)warning|error):?)?\\s*(.+)$",
"regexp": "^(?:\\.\\./)?([^\\s:]+):(\\d+)(?::(\\d+))?:?\\s+(?:((?i)warning|error):?)?\\s*(.+)$",
"file": 1,
"line": 2,
"column": 3,
Expand All @@ -17,7 +17,7 @@
"owner": "generic-nolocation",
"pattern": [
{
"regexp": "^(?:([^\\s:]+):?\\s+)?((?i)warning|error):?\\s*(.+)$",
"regexp": "^(?:\\.\\./)?(?:([^\\s:]+):?\\s+)?((?i)warning|error):?\\s*(.+)$",
"file": 1,
"severity": 2,
"message": 3
Expand Down
2 changes: 1 addition & 1 deletion .github/problem-matchers/gettext-stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"severity": "warning",
"pattern": [
{
"regexp": "msgfmt .* --statistics .* (po/.*\\.po)",
"regexp": "(?:^|\\s)(?:\\.\\./)?(locale/.*\\.po)$",
"file": 1
},
{
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:

- name: Install JS dependencies
id: npm
run: npm ci
run: npm install
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Lint JS code
run: make "ESLINT_OPTS=--format .github/eslint-formatter.js" lint
run: npm run-script lint -- --format .github/eslint-formatter.js
if: ${{ always() && steps.npm.conclusion == 'success' }}

- name: Pre-create pip cache directory
Expand Down Expand Up @@ -76,14 +76,20 @@ jobs:
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Compile GSettings schemas
run: make schemas 2>&1 | tee schemas.log
run: glib-compile-schemas --strict --dry-run schemas | tee schemas.log
shell: bash
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- id: meson-setup
name: Prepare build directory
run: meson setup build
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Validate Gtk .ui files
run: xvfb-run make gtk-builder-validate 2>&1 | tee gtk-builder.log
run: xvfb-run ninja -j1 validate-pref-ui 2>&1 | tee gtk-builder.log
working-directory: build
shell: bash
if: ${{ always() && steps.checkout.conclusion == 'success' }}
if: ${{ always() && steps.meson-setup.conclusion == 'success' }}

- name: Ensure Python requirements .txt files are in sync with .in files
run: |
Expand All @@ -102,7 +108,7 @@ jobs:
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Upload reports to Testspace
run: testspace --verbose eslint.xml "*.log{lint}"
run: testspace --verbose eslint.xml "build/*.log{lint}"
if: ${{ always() && steps.setup_testspace.outcome == 'success' }}

pack:
Expand All @@ -119,13 +125,17 @@ jobs:
- name: Enable generic error matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

- name: Prepare build directory
run: meson setup build

- name: Build extension package
run: xvfb-run make ONLY_RELEASE_LOCALES=true pack
run: xvfb-run ninja -j1 pack
working-directory: build

- name: Upload extension package as artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: pack
path: "*.shell-extension.zip"
path: "build/*.shell-extension.zip"
if-no-files-found: error
19 changes: 11 additions & 8 deletions .github/workflows/check-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:

env:
FORCE_COLOR: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
configure:
Expand All @@ -23,7 +22,7 @@ jobs:
echo -n linguas= >>$GITHUB_OUTPUT
grep -Ev '^\s*#.*' LINGUAS | jq -Rcn '[inputs | scan("\\S+")]' >>$GITHUB_OUTPUT
shell: bash
working-directory: po
working-directory: locale

check:
needs: configure
Expand All @@ -44,22 +43,26 @@ jobs:

- run: git config --global --replace-all safe.directory "$GITHUB_WORKSPACE"

- name: Enable generic problem matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

- name: Enable gettext stats problem matcher
run: echo "::add-matcher::.github/problem-matchers/gettext-stats.json"

- name: Enable generic problem matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"
- name: Prepare build directory
run: meson setup build
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Compile translation
run: make msgfmt/${{ matrix.lang }} 2>&1 | tee $GITHUB_STEP_SUMMARY
run: ninja -j1 -v msgfmt-${{ matrix.lang }} 2>&1 | tee $GITHUB_STEP_SUMMARY
shell: bash
working-directory: build

- name: Disable gettext stats problem matcher
run: echo "::remove-matcher owner=gettext-stats::"

- name: Ensure .po file is in sync with .pot
run: |
touch po/*.pot # Make sure .pot won't be re-generated
make msgcmp/${{ matrix.lang }} 2>&1
run: ninja -j1 msgcmp-${{ matrix.lang }}
shell: bash
working-directory: build
if: ${{ always() && steps.checkout.conclusion == 'success' }}
15 changes: 12 additions & 3 deletions .github/workflows/pot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- master

env:
PO_FILES: po/*.po po/*.pot
PO_FILES: locale/*.po locale/*.pot

jobs:
pot:
Expand All @@ -33,8 +33,17 @@ jobs:
- name: Enable generic error matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

- name: Update .pot files
run: po/update-pot.sh
- name: Prepare build directory
run: meson setup build
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Update .pot file
run: ninja -j1 pot
working-directory: build

- name: Merge changes into .po files
run: ninja -j1 msgmerge
working-directory: build

- name: Check if there are any changes
id: diff
Expand Down
13 changes: 1 addition & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
*~
/node_modules/

# Makefile output
/*.shell-extension.zip
/ddterm/pref/ui/
/ddterm/com.github.amezin.ddterm.desktop
/ddterm/com.github.amezin.ddterm.desktop.in
/ddterm/com.github.amezin.ddterm.service
/metadata.json
/schemas/gschemas.compiled
/locale/
/tmp/
/revision.txt
/node_modules/

# do-in-docker.sh/do-in-podman.sh
/.container-home/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ then
PATH="$bindir${PATH:+:${PATH}}"
fi

exec gjs -m "${bindir%/*}/ddterm/app/main.js" "$@"
exec "@GJS@" -m "${bindir%/*}/ddterm/app/main.js" "$@"
16 changes: 16 additions & 0 deletions bin/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pack += configure_file(
input: 'com.github.amezin.ddterm.in',
output: '@BASENAME@',
configuration: gjs_config,
install: true,
install_dir: extension_dir / 'bin',
install_mode: 'rwxr-xr-x'
)

launcher_installed = extension_dir / 'bin' / 'com.github.amezin.ddterm'

install_symlink(
'com.github.amezin.ddterm',
pointing_to: launcher_installed,
install_dir: bindir,
)
13 changes: 13 additions & 0 deletions ddterm/app/icons/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
icon_files = files(
'quotation-symbolic.svg',
'regex-symbolic.svg',
'uppercase-symbolic.svg',
)

foreach icon_file : icon_files
pack += fs.copyfile(
icon_file,
install: true,
install_dir: extension_dir / 'ddterm' / 'app' / 'icons',
)
endforeach
38 changes: 38 additions & 0 deletions ddterm/app/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
app_js_files = files(
'accellabel.js',
'application.js',
'appwindow.js',
'dependencies-notification.js',
'dependencies.js',
'gtktheme.js',
'heapdump.js',
'init.js',
'main.js',
'meta.js',
'notebook.js',
'pcre2.js',
'prefsdialog.js',
'search.js',
'settings.js',
'tablabel.js',
'tcgetpgrp.js',
'terminal.js',
'terminalpage.js',
'terminalsettings.js',
'urldetect.js',
'urldetect_patterns.js',
'waitstatus.js'
)

potfiles += app_js_files
potfiles += files('menus.ui')

foreach app_file : app_js_files + files('dependencies.json', 'menus.ui', 'style.css')
pack += fs.copyfile(
app_file,
install: true,
install_dir: extension_dir / 'ddterm' / 'app',
)
endforeach

subdir('icons')
52 changes: 52 additions & 0 deletions ddterm/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ddterm_files = files(
'com.github.amezin.ddterm.Extension.xml',
'com.github.amezin.ddterm.HeapDump.xml',
'com.github.amezin.ddterm.service.in',
)

foreach ddterm_file : ddterm_files
pack += fs.copyfile(
ddterm_file,
install: true,
install_dir: extension_dir / 'ddterm',
)
endforeach

desktop_entry_untranslated = files('com.github.amezin.ddterm.desktop.in.in')
potfiles += desktop_entry_untranslated

pack += i18n.merge_file(
input: desktop_entry_untranslated,
output: '@BASENAME@',
po_dir: '../locale',
type: 'desktop',
)

launcher_config = configuration_data()
launcher_config.set('LAUNCHER', launcher_installed)

i18n.merge_file(
input: configure_file(
input: desktop_entry_untranslated,
output: '@BASENAME@_configured',
configuration: launcher_config,
),
output: '@BASENAME@',
po_dir: '../locale',
type: 'desktop',
install: true,
install_dir: applications_dir,
)

configure_file(
input: 'com.github.amezin.ddterm.service.in',
output: '@BASENAME@',
configuration: launcher_config,
install: true,
install_dir: dbus_service_dir,
)

subdir('app')
subdir('pref')
subdir('shell')
subdir('util')
33 changes: 33 additions & 0 deletions ddterm/pref/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pref_files = files(
'adw.js',
'animation.js',
'behavior.js',
'colors.js',
'command.js',
'compatibility.js',
'panelicon.js',
'positionsize.js',
'scrolling.js',
'shortcuts.js',
'tabs.js',
'text.js',
'util.js',
'widget.js',
)

potfiles += pref_files

pref_copy_files = []

foreach pref_file : pref_files
pref_copy_files += fs.copyfile(
pref_file,
install: true,
install_dir: extension_dir / 'ddterm' / 'pref',
)
endforeach

pack += pref_copy_files

subdir('ui')
subdir('test')
18 changes: 18 additions & 0 deletions ddterm/pref/test/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pref_test_common_files = [
fs.copyfile('common.js'),
pref_copy_files,
schema_copy,
schemas_compiled,
]

run_target(
'pref-gtk3-test',
command: [gjs, '-m', fs.copyfile('gtk3.js')],
depends: [pref_test_common_files, pref_ui_gtk3_files]
)

run_target(
'pref-gtk4-test',
command: [gjs, '-m', fs.copyfile('gtk4.js')],
depends: [pref_test_common_files, pref_ui_gtk4_files]
)
Loading

0 comments on commit f7ad7b4

Please sign in to comment.