Port Greource compilation from build.rs to meson.
Here is what happens, in static_resource.rs we register the gresources by appending it to the binary at compile time with include_bytes!
macro. In order to generate the gresource
file we use a build.rs
file from back we don't had meson yet. This works as long build.rs
gets invoked. Now if you happen to have cached the rust artifacts but not the gresource
file, when trying to build the build hammond-gtk/build.rs
will never get invoked cause the artifacts are already up to date causing in no gresource
being generated which will lead to have nothing to append to the binary and thus failing the build. This has lead to another terrible hack in the CI to sidestep that issue.
I tried to use meson to compile them instead of build.rs
but the problem is that we just want to puke a resources.gresource
file in the hammond-gtk/resources/
directory. But I only could find option for either meson to handle appending it to the binary which does not play well with our current hack to have cargo support. Or to install it in a user directory and the retrieve it, I would prefer not doing this since it's one more thing that can go wrong and include_bytes!
stops one more bug at compile time.
I got this far:
gnome = import('gnome')
gresource = gnome.compile_resources(
'resources.gresource',
'hammond-gtk/resources/resources.xml',
source_dir: 'hammond-gtk/resources/',
gresource_bundle: true,
)
What needs to be done:
-
Integrate gresource
with meson -
remove build.rs
-
remove the CI hacks