Skip to content

Conversation

@dcbaker
Copy link
Member

@dcbaker dcbaker commented Oct 29, 2025

This series is a largish project to try to move more of the input validation up to the Interpreter level and out of the Build and Backend levels.

Initially it uses typed_kwargs() to manage install_dir.

Second, it moves some information that we were previously (re)computing on the fly to precomputation.

Finally, it splits out of the vala specific install handling into it's own vala specific keyword arguments in the interpreter. This allows for:

  1. less copying defaults when using vala
  2. is less opaque than the current setup
  3. provides better error checking

@dcbaker dcbaker marked this pull request as draft October 29, 2025 23:07
@dcbaker dcbaker force-pushed the wip/2025-10/build-target-install-dir branch 2 times, most recently from 6bd15ae to 33b7fa2 Compare October 30, 2025 16:26
@dcbaker dcbaker force-pushed the wip/2025-10/build-target-install-dir branch 4 times, most recently from c3bb989 to da3b3b3 Compare November 5, 2025 19:13
@dcbaker dcbaker marked this pull request as ready for review November 13, 2025 16:56
@dcbaker dcbaker added the typing label Nov 13, 2025
This just puts the type checking in the frontend, there's still some
serious cleanup in the build and backend that need to happen.
Among other things it will say "expects X but only has Y", even if Y >
X.
This `install_dir` is slightly different than the one in `BuildTarget`
(though I'd like to make them the same in the future). It is only
allowed to be `str | bool | None`, and the implementation has always
assumed this, it would have broken with an array value.
This simplifies a lot of code, and allows us to read an attribute rather
than call a method in `get_link_dep_mappings`.
This pulls some of the setting of default install dirs out of the ninja
backend and into the common build layer and interpreter. There is still
more work to do here, but this reworks the internals to be more
consistent.
…BuildTarget

For an end user it's opaque what these extra dirs do (even if in the
backend it's a fine data layout). Additionally, it isn't exactly obvious
that passing `install_dir : [true, true, true, true]` isn't valid if
`vala_gir` isn't set. This makes things much more obvious, and means
that an end user only needs to set values they want to overwrite.

Consider this:
```meson
library(
  'foo',
  'foo.vala',
  vala_gir : 'foo.gir',
  install : true,
  install_dir : [true, true, true, get_option('datadir') / 'mygir'],
)
```
The end use needs to know what all of these fields mean, and they need
to specify *every* field. Consider now:
```meson
library(
  'foo',
  'foo.vala',
  vala_gir : 'foo.gir',
  install : true,
  install_vala_gir_dir : get_option('datadir') / 'mygir',
)
```

This does not change the backend representation, since that works and is
mostly fine. There's probably some improvements that could be made to
group outputs and their install status together in such a way that we
cant have mismatched lists, but I haven't undertaken that here.
@dcbaker dcbaker force-pushed the wip/2025-10/build-target-install-dir branch from da3b3b3 to 63863cc Compare December 3, 2025 21:04
@dcbaker dcbaker added this to the 1.11 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant