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

Check for manually implemented types missing from Gir.toml in the manual section #10

Open
sdroege opened this issue Jun 9, 2020 · 12 comments

Comments

@sdroege
Copy link
Member

sdroege commented Jun 9, 2020

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/169

@gdesmott
Copy link

gdesmott commented Jun 9, 2020

I can work on this but will need a bit more context.

How would you detected that a type defined in source code is meant to be a manual implementation of a binded type (instead of just convenient high level API for example)?

@GuillaumeGomez
Copy link
Member

It's defined in the Gir.toml file with rename for example. I think it's the only case actually? So first, you need to get the information from the Gir.toml file.

@gdesmott
Copy link

gdesmott commented Jun 9, 2020

Isn't it the other way around? Get all the manually implemented types in the source code and check if they are present in the toml file?

@sdroege
Copy link
Member Author

sdroege commented Jun 9, 2020

@gdesmott You could check if a struct/enum of the same name is declared in src/*.rs, that should be sufficient. Main problem is that it might be done via a macro (like the miniobjects in GStreamer).

@sdroege
Copy link
Member Author

sdroege commented Jun 9, 2020

Or assuming that if a src/foo.rs exists and we would usually put the autogenerated code into src/auto/foo.rs but it's not actually autogenerated, that then it is missing from the Gir.toml? I can't think of a single case right now where that heuristic would fail.

@gdesmott
Copy link

gdesmott commented Jun 9, 2020

Or assuming that if a src/foo.rs exists and we would usually put the autogenerated code into src/auto/foo.rs but it's not actually autogenerated

How would you check "we would usually put the autogenerated code into src/auto/foo.rs"?
The existing get_objects() implementation craft the list of objects from the ones declared in the toml file so if it's missing there it won't appear in our list, which is exactly what we'd like to detect.

@sdroege
Copy link
Member Author

sdroege commented Jun 9, 2020

From the .gir files... which we don't have available here yet. Hm! :)

@gdesmott
Copy link

gdesmott commented Jun 9, 2020

So ideally we need to gather information from:

  • the gir file
  • the toml file
  • the actual source code

and then cross-check them all together.

Wouldn't it make more sense to do that in the gir generator itself as it already has the info regarding the gir and toml files?

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jun 9, 2020

Not sure if we want that in gir directly... (ping @EPashkin). To be noted: you can use gir as a lib though.

@sdroege
Copy link
Member Author

sdroege commented Jun 9, 2020

the actual source code

Checking the existence of files seems sufficient for now :)

@EPashkin
Copy link
Member

EPashkin commented Jun 9, 2020

@GuillaumeGomez you already added "not_bound" mode that checks both gir and toml file,
proposed option also better be in Gir too.
As it will only check presence of files no extra dependencies needed.

@GuillaumeGomez
Copy link
Member

Fine by me then! Let's add a check mode in gir. We can call it here through a script or whatever. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants