GNOME Bugzilla – Bug 568951
the Gir file generated by VALA is not compatible with GIR 0.6.3.
Last modified: 2009-05-26 08:10:47 UTC
Please describe the problem: the Gir file generated by VALA is not compatible with GIR 0.6.3. in GIR 0.6.3, (1) 'function' is used for static members and 'method' for instance member. (2) 'utf8' is used for 'string' (3) enum and constant expects a value attribute. (4) transfer-ownership becomes mandatory for parameter and return-value tag. Vala's girwriter doesn't reflect these changes and produces non-compilable .gir files. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information: A patch follows.
Created attachment 127151 [details] [review] significantly-improve-girwriter-for-gir-0.6.3 This patch is experimental; several unclear part are marked as FIXME. This patch is sufficiently strong to produce a correct .gir file for Global Menu's main library. (although the <include> tags has to be embeded after the file is produced).
GIR 0.6.3 also removed the 'self' parameter for 'member' tags. I have the updated patch at home(will be posting it later).
Created attachment 127219 [details] [review] updated patch to remove 'self' parameter in method tag
Created attachment 127226 [details] [review] use the correct property name (canonical name) The member get_canonical_name() in Vala.Property is changed from private to public. Also to note: the signal name is not canonical.
Created attachment 127228 [details] [review] if the base class is g_object_type, 'parent' attribute should not be specified.
*** Bug 572122 has been marked as a duplicate of this bug. ***
Bug 572122 has more patches, we need to merge the fixes.
Created attachment 129242 [details] [review] Merges the patches from 572122 et 568951
Created attachment 129268 [details] [review] Enhance gir compliance - Merges patches from #572122 and #568951) - Add constant c:identifier for enum values and constant - Handles interfaces static methods
Created attachment 129313 [details] [review] Enhance gir compliance - continued - Merges patches from #572122 and #568951) - Add constant c:identifier for enum values and constant - Handles interfaces static methods - Handles abstract and virtual methods - Fix c:include generation by traversing namespace's child symbols
Created attachment 129348 [details] [review] Enhance gir compliance - Part 1 - Merges patches from #572122 and #568951) - Add constant c:identifier for enum values and constant - Handles interfaces static methods - Handles abstract and virtual methods - Fix c:include generation by traversing namespace's children symbols - Adds allow-none attribute for nullable parameters and return value
Created attachment 129445 [details] [review] Additional fix for ownership transfer for return values This patch must be applied along to patch 129348
Created attachment 129574 [details] [review] Fixes Iface structs according to bug 572434 resolution
Created attachment 131078 [details] [review] Patchset (23 patches) - Enhance gir compliance You can cherry pick the commits from the Vala git clone: http://git.freesmartphone.org/?p=vala.git;a=shortlog;h=refs/heads/gir-support DONE - Support for the namespace name and version name in library name with proper "*-version" regexp parsing - Fix export of namespace version - Generate <include/> tags - Generate <package/> tag - Generate <c:include/> tags - Generate c:type, glib:type-name and glib:get-type attributes for all enum|class|interface tags - Generate type structs for classes and interfaces - Generate static methods correctly - Avoid generating parameters tag if not necessary - Generate virtual and abstract methods correctly (method + virtual-method + callback in type struct) - Generate abstract attribute for abstract classes - Generate type correctly with adhoc c:type (pointer types and parametered types) - Generate constant c:identifier and value - Generate enum values and c:identifer attributes - Fix missing transfer-ownership attribute on parameters and return value - Generate allow-none on parameters, return values and fields - Generate c:type on callbacks - Generate property's cannonical name instead of name - Generate readable, construct and construct-only attributes on property - Generate throws attribute on constructors, methods and callbacks TODO - Generate signals parameters - get-quark & codes on errordomain - Generate annotations on all elements - Flatten namespaces - Unprefix namespace name in class|interface|struct names Depending on g-i state ---------------------- - Export weak information on fields - Export throws error names Depending on valac ------------------ - Non-object class with props are not reporterd - Support for varargs
Created attachment 131127 [details] [review] Patchset (25 patches) - Enhance gir compliance Here is an update. I've implemented all of what could be currently done. Yet to do: - Fix namespace name (also filename must be the same name) - Flatten namespaces - Unprefix namespace name in class|interface|struct names Depending on g-i state: - Export weak information on fields - Export throws error names - Compute vfunc offsets Depending on valac state: - Non-object class with props are not reporterd - Support for varargs I won't work on the remaining items until we have a proper discussion about the relationship between Vala namespaces/packages/shared-libs and g-i namespaces/packages/shared-libs. Please pull: http://git.freesmartphone.org/?p=vala.git;a=shortlog;h=refs/heads/gir-support Didier 'Ptitjes (25): Support for the namespace name and version in library name with proper "*-version" regexp parsing Add proper version and 'vala-' prefix to libraries Fix export of namespace version Fix namespace tag indentation Add mandatory xmlns attributes Generate <include/> tags Generate <package/> tag Generate <c:include/> tags Generate c:type, glib:type-name and glib:get-type attributes for all enum|class|interface tags Generate type structs for classes and interfaces Generate static methods correctly Avoid generating parameters tag if not necessary Generate virtual and abstract methods correctly (method + virtual-method + callback in type struct) Generate abstract attribute for abstract classes Generate type correctly with adhoc c:type (pointer types and parametered types) Generate constant c:identifier and value Generate enum values and c:identifer attributes Fix missing transfer-ownership attribute on parameters and return value Generate allow-none attribute on parameters, return values and fields Generate c:type attribute on callbacks Generate property's cannonical name instead of name Generate readable, construct and construct-only attributes on property Generate throws attribute on constructors, methods and callbacks Generate get-quark & codes attributes on errordomain and generate codes' enum Generate annotations on all elements Stats: ccode/Makefile.am | 6 +- compiler/Makefile.am | 2 +- compiler/valacompiler.vala | 16 ++- gee/Makefile.am | 6 +- gobject/Makefile.am | 6 +- gobject/valagirwriter.vala | 445 +++++++++++++++++++++++++++++++++++++++++--- vala/Makefile.am | 6 +- vala/valaproperty.vala | 2 +- vapigen/Makefile.am | 4 +- 9 files changed, 447 insertions(+), 46 deletions(-)
commit 272f24bfa19ee7be735dd2a5feacc1ea02d111ad Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sun Mar 22 16:34:29 2009 +0100 GIR writer: Generate annotations on all elements Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 240395509ca0eb0f3c20dc56e5a758426c077edc Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sun Mar 22 14:39:38 2009 +0100 GIR writer: Improve errordomain generation Generate get-quark and codes attributes on errordomain and generate enum for error codes. Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 4b936d9f35fabd83b263ab7c586c3852b7aa25fb Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 20:40:17 2009 +0100 GIR writer: Generate enum values and c:identifer attributes Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 3e2f3ff6d353936748e9d0d5a8441af618980339 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sat Mar 21 06:05:03 2009 +0100 GIR writer: Generate throws attribute Generate throws attribute on constructors, methods and callbacks. Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit c8abdb70a5f35f5eab388bca049d12432f70552a Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sat Mar 21 05:20:22 2009 +0100 GIR writer: Improve property generation Generate readable, construct and construct-only attributes on property. Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 689b045f6487c3e48c8a997b7216b4c9d05a16d9 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sat Mar 21 04:45:12 2009 +0100 GIR writer: Generate property's cannonical name instead of name Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 7f07fa0c0d1eb32f8297a71124a9c2423522a2fd Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sat Mar 21 04:38:19 2009 +0100 GIR writer: Generate c:type attribute on callbacks Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 9ff319ed826b2bd7abfd795d50b270bba5aa97d6 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sat Mar 21 04:22:24 2009 +0100 GIR writer: Generate allow-none attributes Generate allow-none attributes on parameters, return values and fields. Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 4a4caa865bb43b9044db6bc7aaedfe642807349f Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Sat Mar 21 04:15:25 2009 +0100 GIR writer: Fix missing transfer-ownership attributes Fix missing transfer-ownership attribute on parameters and return value. Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit f5e09e95b79225b0baaa4396bd5d8d2092e7a61f Author: Jürg Billeter <j@bitron.ch> Date: Thu Apr 30 23:10:22 2009 +0200 GIR writer: Fix critical warnings commit 20ab99e1375a38443a4a24c2501c596ec18bf103 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 20:12:17 2009 +0100 GIR writer: Generate constant c:identifier and value Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 43a74d2583ea54e7b0f72be50bc98a11711b89ad Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 19:32:26 2009 +0100 GIR writer: Support pointer types and generic types Generate type correctly with adhoc c:type (pointer types and parametered types). Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 2f8362f54a790a93dd1b3fe3af2cd178f498c001 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 17:50:51 2009 +0100 GIR writer: Generate abstract attribute for abstract classes Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 5c56cb48b9b2ef10f9cd32d972c205fe221b1220 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 17:45:56 2009 +0100 GIR writer: Fix virtual method generation Generate virtual and abstract methods correctly (method + virtual-method + callback in type struct). Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit c151c53e622c7b7af62018cf61b044235a85c2da Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 17:27:55 2009 +0100 GIR writer: Avoid generating parameters tag if not necessary Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 0cb6ab426342d76d18354b815cd18bc05213d608 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 17:25:19 2009 +0100 GIR writer: Generate static methods correctly Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 7beb7e3df2e3f3fc42c63348768aff81b1a2a905 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 16:50:43 2009 +0100 GIR writer: Generate type structs for classes and interfaces Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 97159d6894896d149c69776e3277ae03db420cec Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Fri Mar 20 16:20:04 2009 +0100 Generate type attributes for all enum|class|interface tags Generate c:type, glib:type-name and glib:get-type attributes for all enum|class|interface tags. Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr>
commit 8e69c79011a2f2686553396f4df368c8da4a639a Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Mon Mar 30 19:12:34 2009 +0200 GIR writer: Generate <package/> tag Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 1969b270ffa72703c9f4687dd970fccd1b1c6327 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Mon Mar 30 19:07:03 2009 +0200 GIR writer: Generate correct GIR namespace name and version Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr> commit 712d456a7f8ab7ffe3a157c24d0ed16e8bdf33e6 Author: Didier 'Ptitjes <ptitjes@free.fr> Date: Mon Mar 30 19:01:40 2009 +0200 Add --gir option to enable GIR generation Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr>