Open EPashkin opened 9 years ago
Also "return out parameters" little depends on this.
I do plan to start the sys crate generation but why should anything else depend on that?
You still planing, or already started?
In "return out parameters" I planing add rets:Vec<Parameters>
along with old ret: Option<Parameter>
to object::Info
.
I want this issue act as warning remover, therefore, I propose do it myself
No, I have not started that. But I didn't want to couple the sys crate generation with other modes too much, for instance, I don't see why it should care about which widgets and methods are generated.
If you want generate all function, then no dependence.
gkoz: if you don't begin generate sys module, can i generate functions for all classes?
Alright, go ahead.
gkoz: can you add to gtk-sys file funcs.rs where move GtkAboutDialog
functions?
I have problem with this.
I don't see the point of splitting the sys crates into modules especially if they're autogenerated.
Then where i write functions?
Or you want autogenerate all sys module from begining?
Yes, I could be wrong but this task seems simple enough to generate everything at once.
Ok. Then in first version i just rewrite begining of lib.rs.
:+1:
I think we're almost feature-complete vs the handmade sys crates so it's time to eliminate the gtk-related hardcoded stuff and accommodate generating all of glib-sys
, gdk-sys
, (possbily pango-sys
), and gtk-sys
.
Any hardcode in sys?
IMHO better start with glib-sys
. we need generate lib.rs, glib.rs, gobject.rs, gio.rs
?
Not sure what better, one Gir.toml
for each project, that can be stored in project,
or one config for all libs, that stored in gir
One way could be to generate glib.rs
, gio.rs
etc and do glob reexports in the lib.rs
(pub use glib::*;
). We'd also need a manual module with gboolean
, gsize
and other typedefs that could be imported uniformly from every generated module.
Any hardcode in sys?
Yes, the sys-related stuff.
Ok, I try make template tomorrow
What harcoded in sys?
IMHO only file path, and fix_namespace
, it will changed anyway
A part of the statics.rs
too. Maybe that's all that is hardcoded.
As to the configs, currently I prefer to have a separate config for each lib (namespace), for this choosing a config from command line would be handy. The configs might need to support blacklisting types and definitely need blacklisting constants because GLib-2.0.gir
has a bunch of platform-specific ones.
Let's just save ourselves the trouble and make glib-sys
, gio-sys
etc separate crates. This will have very little impact on the "front end" crates anyway.
If @GuillaumeGomez allow it
As long as it doesn't break rust-gnome "environment", there's no problem for me.
Actually, if someone could explain me a bit longer what's happening here, it would be amazing ! If you want to generate crates to be bound by all rust-gnome libraries, shouldn't we run tests before ? Otherwise, I can give write access to crates to @gkoz.
@GuillaumeGomez
The crates generated by this utility aren't yet ready to replace the rust-gnome ones (actually, only the glib-sys
crate builds cleanly so far) but they're getting there and I plan to closely review the differences when that time comes. Testing the stuff properly is a tall order though because the coverage our examples
crate provides is rather modest :)
The task will be less cumbersome if there is a 1:1 match between the libraries (such as glib
, gio
, gobject
) and crates, so the generator won't have to incorporate another bunch of special cases. This doesn't make it necessary to change the higher level crates organization. But we might consider putting the new sys crates into their own single sys
(or ffi
) repo and removing the sys crates from the rest of the repos.
We actually could already do it. I think it's a bit disturbing for newcomers. We didn't have a big enough use to split sys
from its "parent". Maybe it's the time ?
In a week we might have a prototype repo with newly generated sys crates for everything except cairo.
Perfect, I'll wait until this date then. :-)
For full replace current syses we also need feature
generation and better with deprecation.
The current sys crates don't really do anything with the features, if I remember right. But we might make the build script add some constant that will help downstream crates change their cfgs.
When i tried apply replace sys in gtk it errored about features https://github.com/rust-gnome/gtk/blob/master/Cargo.toml
The features are present in gtk-sys' Cargo.toml
but don't do anything. Since it just works, we can instead stop expecting the sys crates to have them.
IMHO generate build script unneeded functionality, as it almost never changed, so not need to update from *.gir. Also in manual way can be checked needed library in os specified way (ex. for Gio-2.0.gir
it can always check gio-2.0
and only on linux check gio-unix-2.0
).
I've finally found all the pieces need to replace the feature
s with cfg
s set by the build scripts, will make a proof of concept soon. The build script will be responsible for detecting the available library version and setting the cfg
s that describe it (similar to current features).
Good. You will create issue for discussing "features" in https://github.com/rust-gnome/gtk ?
Yes.
Good work on autodetecting features. Yet still I do not see the point to auto-generate build script.
For one, they turned out big enough that not using some kind of template is going to be problematic.
Potentially even Cargo.toml
could be partly generated. Since toml is structured, it's possible to rewrite select portions while preserving manual modifications.
Agree, but IMHO as with build scripts it better done later, after we make main functionality. We still don't have signals.
Found attribute introspectable
in GLib-2.0.gir
. Don't we need ignore this function?
<function name="append_vals"
c:identifier="g_array_append_vals"
introspectable="0">
Yes, the auxiliary files can be left for later. I guess the build scripts could be rewritten to be more easily copyable by hand. But they're not very hard to generate either. (BTW does the generator still fail to create the target directory e.g. pango-sys
?)
introspectable
has to do with dynamic introspection used by dynamic languages that (I believe) process at runtime the type libraries, which are binary platform-specific versions of the GIR. We can ignore it.
Creating dir fixed with removing it from test.sh
Seems I totally misunderstand what we doing with "features". We add '#[cfg(gtk_3_10)]` to sys crates code or this condition added only in "normal" crates?
Ultimately both. It's essential in normal crates and nice to have in the sys ones.
Marked as done build script and features
"foreign" modules still need solution?
If you still don't start it, i can begin do it (about 1 day) in following way: Add in Gir.toml
options.sys_subpath = "gtk-sys"
Generate funcs.rs withstatus = "generate"
widgets functions, that will be included and reexported in lib.rs. All sys-depended code will go tosys
subdirs ofanalyze
andcodegen
State of sys generation:
Features:
fontconfig
,freetype
,xlib
) need some solutionOption<fn(...)>
handling more precise to respect non-nullable paramerersDebug
for structs. This is complicated by the lack ofimpl Debug for fn(...)