Workbench icon indicating copy to clipboard operation
Workbench copied to clipboard

vala: Port Vala to Meson

Open Diego-Ivan opened this issue 1 year ago • 7 comments

This PR ports Vala from scripts to Meson, and introduces a minimal Vala template with the Workbench API file and a meson build file.

Fixes https://github.com/workbenchdev/Workbench/issues/964 Fixes #913

Diego-Ivan avatar Jul 12 '24 16:07 Diego-Ivan

@sonnyp Existing sessions and all the demos work as expected. Projects don't, because meson won't accept the file paths given by a portal. I tested this with Rust/cargo and it happens too.

A possible solution might be copying the Vala sources to a temporary folder that meson accepts (like the cache directory) and compile it there. The source files are usually small so it shouldn't be expensive. What do you think?

Diego-Ivan avatar Jul 14 '24 23:07 Diego-Ivan

meson won't accept the file paths given by a portal

why not?

sonnyp avatar Jul 16 '24 10:07 sonnyp

Same as #846 unfortunately :(

Diego-Ivan avatar Jul 17 '24 05:07 Diego-Ivan

Same as https://github.com/workbenchdev/Workbench/issues/846 unfortunately :(

I see

A possible solution might be copying the Vala sources to a temporary folder that meson accepts (like the cache directory) and compile it there. The source files are usually small so it shouldn't be expensive. What do you think?

Sounds interesting, perhaps we can solve https://github.com/workbenchdev/Workbench/issues/846 the same way if it turns out to be a good idea.

I'm also interested to avoid having a builddir in the project directory.

Wanna give it a try?

sonnyp avatar Oct 07 '24 14:10 sonnyp

I tested this and besides projects it seems to work great. I also merged main into your branch and fixed conflicts.

sonnyp avatar Oct 07 '24 14:10 sonnyp

I'm also interested to avoid having a builddir in the project directory.

I think it would be better too, since Meson's builddirs can break between major versions, and old projects may break as a consequence of this.

I'll give it a try this week :)

Diego-Ivan avatar Oct 08 '24 15:10 Diego-Ivan

I think this PR is ready! A little summary of the changes:

  • Vala projects will be built in the /tmp/vala directory, instead of the working directory of the session.
  • The /tmp/vala folder will contain all the files necessary to compile a session. Every time Run is clicked, the main.vala file in the tmp folder will be replaced by the demo's/project's main.vala. Probably we can do this with Rust too, so we don't have to grant filesystem permissions to compile projects.

Also updated the newer demos in https://github.com/workbenchdev/demos/pull/187, tested locally and CI passed, so this is ready for review.

Diego-Ivan avatar Oct 14 '24 18:10 Diego-Ivan