GNOME Bugzilla – Bug 559704
Switch to .gir
Last modified: 2018-05-22 13:12:52 UTC
Switch from old gobject-introspection code to .gir format. All pending issues will be added as a dependency of this bug.
C header filenames are missing in .gir currently.
Can we update this bug with the remaining blockers, filing new gobject-introspection bugs? Re comment #1 - if we put the pkg-config name in the .gir, would that suffice?
Made a list of blockers : Tests on Gio-2.0 ========== V: In VAPI G: VAPI from gir 1) header declarations (V ok; G dumb values) reason: Missing in gir, will be added [juergbi] 2) virtual and abstract methods (V ok; G not virtual) reason: additionnal callback defined in class/iface-struct for virtual and abstract methods already made a patch 3) static interface methods (V ok; G not virtual) reason 1: additionnal function defined in namespace for static interface methods reason 2: no is-iface-func-for attribute in gir already made a patch 4) public fields "parent_instance" and "priv" (V no; G yes) reason: present in the gir file 5) 'unowned' return value (V yes; G no) reason: GIRParser.vala:743 type.value_owned = true; status: should be false, no ? 6) c:type taken in account for constructor return value (V yes; G no) reason: not processed in parse_type() 7) DataInputStream.read_byte returned value type (V uchar; G uint8) reason: different declaration in V and gir 8) ? on nullable parameters (V yes; G no) reason: no 'allow-none' attribute in gir, (example ok in G: FileOutputStream.query_info) 9) 'owned' string parameter (V no; G yes) reason: in CodeWriter?? transfer is full and type is string? 10) [NoWrapper] methods (V yes; G no) 11) signal's parameter name propagation (V ok; G loosed generated param name) 12) parameter name prefixing for Vala's registered names (V yes; G no) 13) properties' construct; decl. (V yes; G no) reason: GIRParser.vala:743 << reader.get_attribute ("construct") >> instead of "construct-only" ?? 14) *Class classes (V yes; G no) -> shouln'd ThemedIconClass and all *Class be removed from V ? 15) missing prerequisite class on interfaces (V no; G yes) reason: missing information in gir 16) some gpointer userdata are in G reason: declared in the gir Also some interesting facts... Class differences: - in V no Unix*, no DesktopAppInfo, Emblem nor EmblemedIcon - in G no *Class, FileAttributeInfo*, IOExtension*, IOModule*, IOShedulerJob Interface differences: - in V no DesktopAppInfoLookup - in G interfaces have no prerequisite GLib.Object Re comment #2 - we also need an attribute in gir to specify included .h files.
Struct differences: - in V no *Private should be made private in gir ?
Created attachment 129150 [details] [review] First work on getting gir-based vapi generation working properly Corrects problems 1), 2), 3), 5), 13) and also uses the new 'package' element as library name for the vapi. Beware that for optimal results patches in #572423 and #572408 have to be applied on g-i.
Created attachment 129262 [details] [review] In the middle of fixing #559704 - Add support for package and c:include tags. - Add support for unions. - Add support for abstract, virtual and static methods. - Add support for constants in classes. - Add support for property tag's construct-only attribute.
Created attachment 129349 [details] [review] In the middle of fixing #559704 - Part 1 - Add support for package and c:include tags - Add support for unions - Add support for abstract, virtual and static methods - Add support for constants in classes - Add support for property tag's construct-only attribute - Add support for the c:type attribute
Created attachment 129443 [details] [review] Additional fix for nullable and ownership transfer for fields and return values This patch must be applied along to patch 129349
Created attachment 129572 [details] [review] Fixes Iface structs according to bug 572434 resolution
commit 63e4647aaefdfdacc11fcb015a970a9bd925d457 Author: Jürg Billeter <j@bitron.ch> Date: Fri Feb 27 22:38:29 2009 +0100 GIR parser: Add support for package and c:include tags Based on patch by Didier Villevalois, fixes part of bug 559704
commit 70818c4048a61a9dc650a07ff64fe577a0b7b689 Author: Jürg Billeter <j@bitron.ch> Date: Fri Feb 27 22:55:48 2009 +0100 GIR parser: Add support for unions and boxed types Based on patch by Didier Villevalois, fixes part of bug 559704
Created attachment 133002 [details] [review] Add support for virtual method tags in interfaces. Here's a series of patches that improves GIR support in Vala.
Created attachment 133003 [details] [review] Add support for union tags in records.
Created attachment 133004 [details] [review] Add support for c:prefix in namespaces.
Created attachment 133005 [details] [review] Add namespace exception for GdkPixbuf. As noted in the code, it's more of a hack/workaround than a real fix.
Created attachment 133006 [details] [review] Don't parse GObject-specific private structs and fields. Specifically, structs ending in "Class" or "Private", and fields named "priv", "parent_instance", or "parent". This also seems more like a workaround for the current behavior in GObject Introspection, which ptitjes pointed out in comment #3.
Created attachment 133017 [details] [review] Ensure that packages parsed from GIR files are read. Parse GIR files before .vala/.vapi files. Whitespace fixes. Change the visibility of Vala.VAPIGen and its add_package() method. Add the vapigen instance as a field of the GIR parser.
commit fe18c65bd8ce803d608758cf396e460f134426b5 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Wed Apr 29 13:48:42 2009 +0200 GIR parser: Add c:prefix parsing Signed-off-by: Mark Lee <marklee@svn.gnome.org> Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 859b3872843ed2671f043b48e3cbf26fd6d7be21 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Wed Apr 29 12:58:57 2009 +0200 GIR parser: Fix virtual method and signal parsing Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit e15b061fbad4fd6edd55794c62257c32380c5414 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Wed Apr 29 12:15:56 2009 +0200 GIR parser: Mark constants as external to not require initializer Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit a1472539782383b3acc60c9ae5bbc7d16c0a826c Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Wed Apr 29 00:50:04 2009 +0200 GIR parser: Fix allow-none attribute parsing in fields and return values Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit e8f2dbe325cd698a9fc99041a930eec8312e5b45 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Wed Apr 29 00:39:23 2009 +0200 GIR parser: Fix construct-only attribute parsing for properties Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 8c0e76d573e0ab735d2724511e198ed7724b4a3f Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Wed Apr 29 00:32:40 2009 +0200 GIR parser: Parse class constants Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 8e0d23f08b15290a587dc0eee5396f9c251c4a06 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Wed Apr 29 00:20:46 2009 +0200 GIR parser: Fix c:type parsing in types and constructor return value Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 17baf0d6a32dc41efe222917f31f8c58ae829ab4 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Thu Apr 16 19:41:20 2009 +0200 GIR parser: Handle module GModule in namespace GLib Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr>
I've applied all GIR parser patches from ptitjes's repository, as far as I can tell. Are any of the patches attached here still pending?
Created attachment 136978 [details] [review] fix the case of cprefix and lower_case_cprefix in generated vapi. I consulted ptitjes on this and he told me to make this patch. I am trying to make newer bindings for clutter-0.9 using the generated gir files and Clutter-0.9.gir defines c:prefix="Clutter". Existing code turns that into cprefix="CLUTTER" and lower_case_cprefix="Clutter_", both of which are incorrect. This patch will make cprefix="Clutter" and lower_case_cprefix="clutter_" which are the correct values.
commit ff781d2ea864c3fe8c2afe0a134544b2334104c1 Author: Jordan Yelloz <jordan.yelloz@gmail.com> Date: Fri Jun 19 00:59:14 2009 -0700 GIR parser: Fix case for cprefix
Created attachment 150119 [details] [review] girwriter: always include GLib and GObject
Created attachment 150120 [details] [review] girwriter: put parent_class in the class struct
Created attachment 150121 [details] [review] girwriter: embed <callback> inside <field> for virtual methods see gobject-introspection commit f8693bda3775f6339f38a17c037ac7bc4a4cc3f7
Created attachment 150122 [details] [review] girwriter: fix cname for vfunc <callback> element
Created attachment 150123 [details] [review] girwriter: write virtual signal handlers
Created attachment 150124 [details] [review] girwriter: write parent_instace and priv fields
Created attachment 150125 [details] [review] girwriter: write user_data parameter for delegates
With these patches, I could compile a Vala generated gir with g-ir-compiler (In reply to comment #22) > Created an attachment (id=150119) [details] [review] > girwriter: always include GLib and GObject btw, this is just a workaround for bug 584683
Created attachment 150724 [details] [review] GIR parser: Fix valamarkupreader's filename field and add support for parsing callbacks as a type. First, for some reason the filename property wasn't initializing properly in valamarkupreader so I changed it to a GObject-type constructor. Second, I added the ability to parse a callback as a type.
commit 495cd714aca44534b1cec1fb71edb20a40ae47d0 Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Thu Dec 3 21:10:28 2009 +0100 GIR writer: Write user_data parameter for delegates commit 93568146e15af82783e298bcc9948796d6ed2119 Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Thu Dec 3 20:45:23 2009 +0100 GIR writer: Write parent_instace and priv fields commit cb344b3564768ab5503ce044de18d5a75e813c29 Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Thu Dec 3 20:02:39 2009 +0100 GIR writer: Write virtual signal handlers commit d30820a866aaabf5bf500f17e0afdb28ad2b44fb Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Thu Dec 3 20:00:54 2009 +0100 GIR writer: Fix cname for vfunc <callback> element commit 8ce3708986ba02e1a7e9aee9ff5c08f160e6cabe Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Thu Dec 3 18:51:46 2009 +0100 GIR writer: Embed <callback> inside <field> for virtual methods See gobject-introspection commit f8693bda. commit 91e8b4886c993d7ce4bb82857714aaf106925f74 Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Thu Dec 3 18:40:53 2009 +0100 GIR writer: Add parent_class to the class struct commit 81084a45a913a69e69d50892ac0db038d981e5fe Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Fri Sep 4 16:18:38 2009 +0100 GIR writer: Always include GLib and GObject
commit 0a477a48040208d31f99ec69f20817c62d462186 Author: Jordan Yelloz <jordan.yelloz@gmail.com> Date: Sun Jan 3 00:47:06 2010 -0800 GIR parser: Add support for parsing callback types
Created attachment 153814 [details] [review] GIR parser: Add a special case mapping for GObject.TypeInterface to GLib.Type
(In reply to comment #33) > GIR parser: Add a special case mapping for GObject.TypeInterface to GLib.Type I feel this is incorrect (GType is an integer while GTypeInterface is a struct), what's the use case for this?
Created attachment 162693 [details] [review] girparser: StringBuilder is GLib.String not GObject.String
Created attachment 162694 [details] [review] girparser: add an exception for Atk.Implementor Atk.Implementor has a GType name of AtkImplementorIface and that's what gobject-introspection uses.
Created attachment 162695 [details] [review] girwriter: fix closure attribute for delegate targets The code was assuming that data_type would be a Delegate for a DelegateType while it is null.
Created attachment 162698 [details] [review] girparser: correctly find the namespace for a given gir namespace this is done by searching for gir_namespace in all namespaces
Created attachment 164552 [details] [review] GIR Parser: do not assume that interface structs have the Iface suffix Interfaces generated using G_DEFINE_INTERFACE have Interface suffix. The code generator also needs to be fixed (a workaround for now is to add typedefs from *Interface to *Iface).
Comment on attachment 162693 [details] [review] girparser: StringBuilder is GLib.String not GObject.String commit 60380e8e99bd0998be4c268d599c61c28d8dab9b Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Fri Apr 9 17:52:32 2010 +0100 girparser: StringBuilder is GLib.String not GObject.String
Comment on attachment 162694 [details] [review] girparser: add an exception for Atk.Implementor commit 6293d01d61dbe3741965b7d402573548cc35bf22 Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Fri Apr 30 22:19:17 2010 +0100 girparser: Add an exception for Atk.Implementor Atk.Implementor has a GType name of AtkImplementorIface and this is what gobject-introspection uses.
Comment on attachment 162695 [details] [review] girwriter: fix closure attribute for delegate targets commit 8b6b3a70498dddafa4b97d7d1bc7e6d451779441 Author: Abderrahim Kitouni <a.kitouni@gmail.com> Date: Sat May 15 18:25:21 2010 +0100 girwriter: Fix closure attribute for delegate targets The code was assuming that data_type would be a Delegate for a DelegateType while it is null.
(In reply to comment #34) > (In reply to comment #33) > > GIR parser: Add a special case mapping for GObject.TypeInterface to GLib.Type > I feel this is incorrect (GType is an integer while GTypeInterface is a > struct), what's the use case for this? I agree, this looks wrong.
how about patch 164552? Yes it' just a workaround but it's needed by libpeas right now. And if you don't like the other patch (about namespaces), I can reorder them.
Created attachment 166500 [details] [review] Support nested GIR includes.
Comment on attachment 166500 [details] [review] Support nested GIR includes. moved to bug 623526
Comment on attachment 162698 [details] [review] girparser: correctly find the namespace for a given gir namespace Merge of switch-to-gir made this obsolete, because it has been fully reworked. Thanks for the work.
Could anyone update: https://live.gnome.org/Vala/Bindings in order to know how to use GIR files to create vapi files. Have you consider to create macros, like GObject-Introspection does, to add automatic vapi generation and install for Vala based projects? I've filed the Bug 649526, for this.
This bug depends on GObject Introspection, then may is a task for 2.0 milestone.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/17.