Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules/wayland: document that scan_xml can take any protocol. #13724

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

ericonr
Copy link
Contributor

@ericonr ericonr commented Sep 28, 2024

A lot of projects vendor protocols, since the ones they are using aren't available in default system directories. One example would be kanshi, where I am trying to use the wayland module (see ericonr/kanshi#2).

Right now this PR has a few issues. The main one is that the first configuration works and the project can be built successfully, but then, when I touch any of the meson.build files, the reconfiguration fails:

../protocol/meson.build:3:31: ERROR: The file protocol/wlr-output-management-unstable-v1.xml does not exist.

I feel like I'm using a totally wrong way of getting the current source directory.

Furthermore, I don't think this is the ideal interface. A "directory" key might work better? For example in cases where people grab the protocol from a git submodule, so they can't have a meson.build in the same directory as the protocol definition. I would appreciate guidance on the interface definition and in actually implementing it.

@@ -112,11 +112,13 @@ def scan_xml(self, state: ModuleState, args: T.Tuple[T.List[FileOrString]], kwar
'wayland.find_protocol',
KwargInfo('state', str, default='stable', validator=in_set_validator({'stable', 'staging', 'unstable'})),
KwargInfo('version', (int, NoneType)),
KwargInfo('vendored', bool, default=False, since='1.6.0'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I indicate that this should be the next release?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just write the next release like you have, if this doesn't make it in till the next release, then we'd review saying "please update this to the next release"

Copy link
Member

@dcbaker dcbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a couple of small nits for this, but this also deserves a release snippet to be written, as it's a pretty useful change.

@@ -112,11 +112,13 @@ def scan_xml(self, state: ModuleState, args: T.Tuple[T.List[FileOrString]], kwar
'wayland.find_protocol',
KwargInfo('state', str, default='stable', validator=in_set_validator({'stable', 'staging', 'unstable'})),
KwargInfo('version', (int, NoneType)),
KwargInfo('vendored', bool, default=False, since='1.6.0'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just write the next release like you have, if this doesn't make it in till the next release, then we'd review saying "please update this to the next release"

)
def find_protocol(self, state: ModuleState, args: T.Tuple[str], kwargs: FindProtocol) -> File:
base_name = args[0]
xml_state = kwargs['state']
version = kwargs['version']
vendored = kwargs['vendored']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you also need to add the vendored keyword to the FindProtocol definition.

@ericonr
Copy link
Contributor Author

ericonr commented Oct 5, 2024

Hmm, turns out this is already supported, as used by GNOME: https://gitlab.gnome.org/GNOME/gtk/-/blob/2d1367ccdc4c604d8e5f5308763746eab01e6b6e/gdk/wayland/meson.build#L158

I will transition this PR into simply documenting that use case.

The quick example can be slightly misleading in implying that scan_xml
must use find_protocol, which is not the case. So explicitly mention it
in the scan_xml docs.
@ericonr ericonr changed the title wayland: support vendored protocols. modules/wayland: document that scan_xml can take any protocol. Oct 5, 2024
@ericonr ericonr requested a review from dcbaker October 5, 2024 01:13
@ericonr
Copy link
Contributor Author

ericonr commented Oct 29, 2024

Ping?

@eli-schwartz eli-schwartz merged commit d7e1d19 into mesonbuild:master Nov 1, 2024
8 checks passed
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.

4 participants