build: Use dedicated resources for helper programs

Using a single resource file for all JS sources saves a couple of
build system instructions, but has some serious downsides:

 - bundling the entire shell code with the tools blows
   up their size unnecessarily

 - the tools are rebuilt unnecessarily for any shell
   code change

Autotools was painful enough to let this slip, but with meson we
don't have any excuses - using the actual dependencies speeds up
the build a tiny bit and reduces the tools' sizes from over 2M
to about 50k.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/192
This commit is contained in:
Florian Müllner 2018-08-10 13:56:07 +02:00 committed by Florian Müllner
parent 9cf571efbd
commit 95788c9834
5 changed files with 34 additions and 6 deletions

View File

@ -9,8 +9,6 @@
<file>gdm/realmd.js</file> <file>gdm/realmd.js</file>
<file>gdm/util.js</file> <file>gdm/util.js</file>
<file>extensionPrefs/main.js</file>
<file>misc/config.js</file> <file>misc/config.js</file>
<file>misc/extensionUtils.js</file> <file>misc/extensionUtils.js</file>
<file>misc/fileUtils.js</file> <file>misc/fileUtils.js</file>
@ -33,8 +31,6 @@
<file>perf/core.js</file> <file>perf/core.js</file>
<file>perf/hwtest.js</file> <file>perf/hwtest.js</file>
<file>portalHelper/main.js</file>
<file>ui/accessDialog.js</file> <file>ui/accessDialog.js</file>
<file>ui/altTab.js</file> <file>ui/altTab.js</file>
<file>ui/animation.js</file> <file>ui/animation.js</file>

View File

@ -6,3 +6,17 @@ js_resources = gnome.compile_resources(
c_name: 'shell_js_resources', c_name: 'shell_js_resources',
dependencies: [config_js] dependencies: [config_js]
) )
portal_resources = gnome.compile_resources(
'portal-resources', 'portal-resources.gresource.xml',
source_dir: ['.', meson.current_build_dir()],
c_name: 'portal_js_resources',
dependencies: [config_js]
)
prefs_resources = gnome.compile_resources(
'prefs-resources', 'prefs-resources.gresource.xml',
source_dir: ['.', meson.current_build_dir()],
c_name: 'prefs_js_resources',
dependencies: [config_js]
)

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell">
<file>misc/config.js</file>
<file>portalHelper/main.js</file>
</gresource>
</gresources>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell">
<file>extensionPrefs/main.js</file>
<file>misc/config.js</file>
<file>misc/extensionUtils.js</file>
<file>misc/fileUtils.js</file>
<file>misc/params.js</file>
</gresource>
</gresources>

View File

@ -261,7 +261,7 @@ executable('gnome-shell', 'main.c',
) )
executable('gnome-shell-extension-prefs', executable('gnome-shell-extension-prefs',
'gnome-shell-extension-prefs.c', js_resources, 'gnome-shell-extension-prefs.c', prefs_resources,
c_args: tools_cflags, c_args: tools_cflags,
dependencies: tools_deps, dependencies: tools_deps,
include_directories: [conf_inc], include_directories: [conf_inc],
@ -271,7 +271,7 @@ executable('gnome-shell-extension-prefs',
if have_networkmanager if have_networkmanager
executable('gnome-shell-portal-helper', executable('gnome-shell-portal-helper',
'gnome-shell-portal-helper.c', js_resources, 'gnome-shell-portal-helper.c', portal_resources,
c_args: tools_cflags, c_args: tools_cflags,
dependencies: tools_deps, dependencies: tools_deps,
include_directories: [conf_inc], include_directories: [conf_inc],