Skip to content

Commit

Permalink
Add development profile/manifest (workbenchdev#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp authored Sep 28, 2022
1 parent dff12ca commit 5989dde
Show file tree
Hide file tree
Showing 23 changed files with 186 additions and 100 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ cd Workbench
git submodule update
```

Also make sure that you're building the development target (`re.sonny.Workbench.Devel`).

Feel free to come by [#workbench:matrix.org](https://matrix.to/#/#workbench:matrix.org).

## Packaging
Expand Down
2 changes: 1 addition & 1 deletion data/re.sonny.Workbench.desktop → data/app.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Exec=workbench %U
Terminal=false
Type=Application
Categories=WebDevelopment;Development;IDE;GNOME;GTK;
Icon=re.sonny.Workbench
Icon=@app_id@
# TRANSLATORS: Don't translate
Keywords=CSS;JavaScript;GJS;Blueprint;builder;Vala;
DBusActivatable=true
Expand Down
4 changes: 2 additions & 2 deletions data/re.sonny.Workbench.gschema.xml → data/app.gschema.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<schemalist gettext-domain="re.sonny.Workbench">
<schema id="re.sonny.Workbench" path="/re/sonny/Workbench/">
<schemalist gettext-domain="@app_id@">
<schema id="@app_id@" path="/re/sonny/Workbench/">
<key name="color-scheme" type="i">
<default>0</default>
</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<component type="desktop">
<id>re.sonny.Workbench</id>
<launchable type="desktop-id">re.sonny.Workbench.desktop</launchable>
<id>@app_id@</id>
<launchable type="desktop-id">@app_id@.desktop</launchable>
<name translatable="no">Workbench</name>
<developer_name translatable="no">Sonny Piers</developer_name>
<update_contact>[email protected]</update_contact>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0</project_license>
<summary>Learn and prototype with GNOME technologies</summary>
<translation type="gettext">re.sonny.Workbench</translation>
<translation type="gettext">@app_id@</translation>
<description>
<p>Workbench goal is to let you experiment with GNOME technologies, no matter if tinkering for the first time or building and testing a GTK user interface.</p>
<p>Among other things, Workbench comes with</p>
Expand Down
2 changes: 1 addition & 1 deletion data/re.sonny.Workbench.service → data/app.service
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=re.sonny.Workbench
Name=@app_id@
Exec=@bindir@/workbench --gapplication-service
File renamed without changes
31 changes: 20 additions & 11 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
desktop_file = i18n.merge_file(
input: 're.sonny.Workbench.desktop',
output: 're.sonny.Workbench.desktop',
input: configure_file(
input: 'app.desktop',
output: 'tmp.app.desktop',
configuration: { 'app_id': app_id }
),
output: '@[email protected]'.format(app_id),
type: 'desktop',
po_dir: '../po',
install: true,
Expand All @@ -15,19 +19,21 @@ if desktop_utils.found()
endif

appstream_file = i18n.merge_file(
input: 're.sonny.Workbench.metainfo.xml',
output: 're.sonny.Workbench.metainfo.xml',
input: configure_file(
input: 'app.metainfo.xml',
output: 'tmp.app.metainfo.xml',
configuration: { 'app_id': app_id }
),
output: '@[email protected]'.format(app_id),
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo')
)

service_conf = configuration_data()
service_conf.set('bindir', bindir)
configure_file(
input: 're.sonny.Workbench.service',
output: 're.sonny.Workbench.service',
configuration: service_conf,
input: 'app.service',
output: '@0@.service'.format(app_id),
configuration: { 'app_id': app_id, 'bindir': bindir },
install_dir: join_paths(get_option('datadir'), 'dbus-1/services')
)

Expand All @@ -38,7 +44,10 @@ if appstream_util.found()
)
endif

install_data('re.sonny.Workbench.gschema.xml',
configure_file(
input: 'app.gschema.xml',
output: '@[email protected]'.format(app_id),
configuration: { 'app_id': app_id },
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)

Expand All @@ -49,4 +58,4 @@ if compile_schemas.found()
)
endif

install_subdir('icons/', install_dir : join_paths(get_option('datadir')))
install_subdir('icons/hicolor', install_dir : join_paths(get_option('datadir'), 'icons'))
18 changes: 15 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('re.sonny.Workbench', ['vala', 'c'],
project('Workbench', ['vala', 'c'],
version: '43.0',
meson_version: '>= 0.59.0',
license: 'GPL-3.0-only'
Expand All @@ -7,11 +7,23 @@ project('re.sonny.Workbench', ['vala', 'c'],
gnome = import('gnome')
i18n = import('i18n')

application_id = meson.project_name()
if get_option('profile') == 'development'
app_id = 're.sonny.Workbench.Devel'
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
if vcs_tag == ''
version_suffix = '-devel'
else
version_suffix = '-@0@'.format (vcs_tag)
endif
else
app_id = 're.sonny.Workbench'
version_suffix = ''
endif

prefix = get_option('prefix')
bindir = join_paths(prefix, 'bin')
datadir = join_paths(prefix, get_option('datadir'))
pkgdatadir = join_paths(datadir, application_id)
pkgdatadir = join_paths(datadir, app_id)

subdir('data')
subdir('src')
Expand Down
9 changes: 9 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
option(
'profile',
type: 'combo',
choices: [
'default',
'development'
],
value: 'default'
)
2 changes: 1 addition & 1 deletion po/meson.build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
i18n.gettext(application_id, preset: 'glib', args: ['--no-wrap'])
i18n.gettext(app_id, preset: 'glib', args: ['--no-wrap'])
71 changes: 71 additions & 0 deletions re.sonny.Workbench.Devel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"app-id": "re.sonny.Workbench.Devel",
"runtime": "org.gnome.Sdk",
"runtime-version": "43",
"sdk": "org.gnome.Sdk",
"command": "workbench",
"finish-args": [
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--device=dri",
"--socket=session-bus",
"--share=network"
],
"modules": [
{
"name": "vte",
"buildsystem": "meson",
"config-opts": [
"-Ddocs=false",
"-Dgtk3=false",
"-Dgtk4=true",
"-Dvapi=false",
"-Dglade=false"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/vte.git",
"commit": "ae4a5d7df9e32ab40ceca5e06240561e819db148",
"tag": "0.70.0"
}
]
},
{
"name": "libportal",
"buildsystem": "meson",
"config-opts": ["-Ddocs=false", "-Dvapi=false", "-Dbackends=gtk4"],
"sources": [
{
"type": "archive",
"url": "https://github.com/flatpak/libportal/releases/download/0.6/libportal-0.6.tar.xz",
"sha256": "88a12c3ba71bc31acff7238c280de697d609cebc50830c3766776ec35abc6566"
}
]
},
{
"name": "blueprint-compiler",
"buildsystem": "meson",
"builddir": true,
"sources": [
{
"type": "dir",
"path": "./blueprint-compiler"
}
]
},
{
"name": "Workbench",
"buildsystem": "meson",
"builddir": true,
"config-opts": ["-Dprofile=development"],
"sources": [
{
"type": "dir",
"path": "."
}
]
}
]
}
15 changes: 9 additions & 6 deletions re.sonny.Workbench.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "re.sonny.Workbench",
"app-id": "re.sonny.Workbench",
"runtime": "org.gnome.Sdk",
"runtime-version": "43",
"sdk": "org.gnome.Sdk",
Expand All @@ -12,7 +12,6 @@
"--socket=session-bus",
"--share=network"
],
"x-run-args": [],
"modules": [
{
"name": "vte",
Expand Down Expand Up @@ -51,19 +50,23 @@
"builddir": true,
"sources": [
{
"type": "dir",
"path": "./blueprint-compiler"
"type": "git",
"url": "https://gitlab.gnome.org/sonny/blueprint-compiler",
"commit": "592ed7acab26f1633c03b0cd703a9cf2b7f09cb9"
}
]
},
{
"name": "Workbench",
"buildsystem": "meson",
"builddir": true,
"config-opts": ["-Dprofile=default"],
"sources": [
{
"type": "dir",
"path": "."
"type": "git",
"url": "https://github.com/sonnyp/Workbench.git",
"tag": "v43.0",
"commit": "dff12cab700f452601b23e4cafbbb4c24d610946"
}
]
}
Expand Down
14 changes: 8 additions & 6 deletions src/PanelUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import WorkbenchHoverProvider from "./WorkbenchHoverProvider.js";

const { addSignalMethods } = imports.signals;

export default function PanelUI({ builder, data_dir, version, term_console }) {
const SYSLOG_IDENTIFIER = pkg.name;

export default function PanelUI({ builder, data_dir, term_console }) {
let lang;

const panel = {
Expand Down Expand Up @@ -162,8 +164,8 @@ export default function PanelUI({ builder, data_dir, version, term_console }) {
await blueprint.request("initialize", {
processId: getPid(),
clientInfo: {
name: "re.sonny.Workbench",
version,
name: pkg.name,
version: pkg.version,
},
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#clientCapabilities
capabilities: {
Expand Down Expand Up @@ -224,14 +226,14 @@ export default function PanelUI({ builder, data_dir, version, term_console }) {
function logBlueprintError(err) {
GLib.log_structured("Blueprint", GLib.LogLevelFlags.LEVEL_CRITICAL, {
MESSAGE: `${err.message}`,
SYSLOG_IDENTIFIER: "re.sonny.Workbench",
SYSLOG_IDENTIFIER,
});
}

// function logBlueprintInfo(info) {
// GLib.log_structured("Blueprint", GLib.LogLevelFlags.LEVEL_WARNING, {
// MESSAGE: `${info.line + 1}:${info.col} ${info.message}`,
// SYSLOG_IDENTIFIER: "re.sonny.Workbench",
// SYSLOG_IDENTIFIER,
// });
// }

Expand All @@ -242,7 +244,7 @@ function logBlueprintDiagnostic({ range, message, severity }) {
}:${range.start.character} to ${range.end.line + 1}:${
range.end.character
} ${message}`,
SYSLOG_IDENTIFIER: "re.sonny.Workbench",
SYSLOG_IDENTIFIER,
});
}

Expand Down
6 changes: 3 additions & 3 deletions src/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "./troll/src/util.js";
import { getFlatpakInfo } from "./util.js";

export default function About({ application, version }) {
export default function About({ application }) {
const flatpak_info = getFlatpakInfo();

const debug_info = `
Expand All @@ -30,11 +30,11 @@ ${getBlueprintVersion()}
developer_name: "Sonny Piers",
copyright: "Copyright 2022 Sonny Piers",
license_type: Gtk.License.GPL_3_0_ONLY,
version,
version: pkg.version,
transient_for: application.get_active_window(),
modal: true,
website: "https://workbench.sonny.re",
application_icon: "re.sonny.Workbench",
application_icon: pkg.name,
issue_url: "https://github.com/sonnyp/Workbench/issues",
// TRANSLATORS: eg. 'Translator Name <[email protected]>' or 'Translator Name https://website.example'
translator_credits: _("translator-credits"),
Expand Down
4 changes: 2 additions & 2 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import About from "./about.js";
import shortcutsWindow from "./shortcutsWindow.js";
import { portal, languages, settings } from "./util.js";

export default function Actions({ application, version }) {
export default function Actions({ application }) {
const quit = new Gio.SimpleAction({
name: "quit",
parameter_type: null,
Expand All @@ -26,7 +26,7 @@ export default function Actions({ application, version }) {
parameter_type: null,
});
showAboutDialog.connect("activate", () => {
About({ application, version });
About({ application });
});
application.add_action(showAboutDialog);

Expand Down
File renamed without changes.
Loading

0 comments on commit 5989dde

Please sign in to comment.