After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 660594 - a type is not found in a gir when using parent metadata for to generate the vapi it depens upon.
a type is not found in a gir when using parent metadata for to generate the v...
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: GObject Introspection
0.14.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2011-09-30 20:47 UTC by Alban Browaeys
Modified: 2018-05-22 14:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alban Browaeys 2011-09-30 20:47:33 UTC
Is using '* parent="Evolution.Util"' supposed to prevent from generating bindings that depends on the one generated with this metadata ?


I have this in a gir :
      <virtual-method name="validate" invoker="validate">
        <return-value transfer-ownership="none">
          <type name="gboolean" c:type="gboolean"/>
        </return-value>
        <parameters>
          <parameter name="alert" transfer-ownership="none">
            <type name="EvolutionUtil.Alert" c:type="EAlert**"/>
          </parameter>
        </parameters>
      </virtual-method>

This one depends ona vapi I generated via vapigen too which start with:
/* evolution-util-3.0.vapi generated by vapigen, do not modify. */

[CCode (cprefix = "E", gir_namespace = "EvolutionUtil", gir_version = "3.0", lower_case_cprefix = "e_")]
namespace Evolution {
        namespace Util {

and has:

                [CCode (cheader_filename = "e-util/e-account-utils.h,e-util/e-activity.h,e-util/e-alert-dialog.h,e-util/e-alert-sink.h,e-util/e-alert.h,e-util/e-bit-array.h,e-util/e-categories-config.h,e-util/e-charset.h,e-util/e-config.h,e-util/e-datetime-format.h,e-util/e-dialog-utils.h,e-util/e-dialog-widgets.h,e-util/e-event.h,e-util/e-extensible.h,e-util/e-extension.h,e-util/e-file-utils.h,e-util/e-html-utils.h,e-util/e-icon-factory.h,e-util/e-import.h,e-util/e-marshal.h,e-util/e-mktemp.h,e-util/e-module.h,e-util/e-plugin-ui.h,e-util/e-plugin-util.h,e-util/e-plugin.h,e-util/e-poolv.h,e-util/e-print.h,e-util/e-selection.h,e-util/e-signature-list.h,e-util/e-signature-utils.h,e-util/e-signature.h,e-util/e-sorter-array.h,e-util/e-sorter.h,e-util/e-text-event-processor-emacs-like.h,e-util/e-text-event-processor-types.h,e-util/e-text-event-processor.h,e-util/e-ui-manager.h,e-util/e-unicode.h,e-util/e-util-enums.h,e-util/e-util-enumtypes.h,e-util/e-util.h,e-util/e-xml-utils.h,e-util/gconf-bridge.h", cname = "EAlert", type_id = "e_alert_get_type ()")]
                public class Alert : GLib.Object {
                        [CCode (has_construct_function = false)]
                        protected Alert ();
                        [CCode (cname = "e_alert_add_action")]
                        public void add_action (Gtk.Action action, int response_id);
                        [CCode (cname = "e_alert_new_array", has_construct_function = false)]
                        public Alert.array (string tag, GLib.GenericArray<void*> args);
                        [CCode (cname = "e_alert_get_default_response")]
                        public int get_default_response ();
                        [CCode (cname = "e_alert_get_message_type")]
                        public Gtk.MessageType get_message_type ();
                        [CCode (cname = "e_alert_get_primary_text")]
                        public unowned string get_primary_text ();
                        [CCode (cname = "e_alert_get_secondary_text")]
                        public unowned string get_secondary_text ();
                        [CCode (cname = "e_alert_get_stock_id")]
                        public unowned string get_stock_id ();
                        [CCode (cname = "e_alert_run_dialog")]
                        public static int run_dialog (Gtk.Window parent, Evolution.Util.Alert alert);
                        [CCode (cname = "e_alert_set_default_response")]
                        public void set_default_response (int response_id);
                        [CCode (cname = "e_alert_set_message_type")]
                        public void set_message_type (Gtk.MessageType message_type);
                        [CCode (cname = "e_alert_set_primary_text")]
                        public void set_primary_text (string primary_text);
                        [CCode (cname = "e_alert_set_secondary_text")]
                        public void set_secondary_text (string secondary_text);
                        [CCode (cname = "e_alert_start_timer")]
                        public void start_timer (uint seconds);
                        [NoAccessorMethod]
                        public GLib.GenericArray<weak void*> args { owned get; construct; }
                        [NoAccessorMethod]
                        public Gtk.MessageType message_type { get; set; }
                        [NoAccessorMethod]
                        public string primary_text { owned get; set; }
                        [NoAccessorMethod]
                        public string secondary_text { owned get; set; }
                        [NoAccessorMethod]
                        public string tag { owned get; construct; }
                        [HasEmitter]
                        public virtual signal void response (int response_id);
                }

This vapi was generated with metadata:
EvolutionUtil name="Evolution"
* parent="Evolution.Util"

which is the only way I found to translate my namespace from EvolutionUtil to namespace Evolution { namespace Utl { .

Doing :
/usr/local/bin/vapigen \
	--vapidir=. \
	--girdir=../e-util \
	--library evolution-filter-3.0 \
	--metadatadir=. \
	../filter/EFilter-3.0.gir

results in:

EFilter-3.0.gir:239.69-239.69: error: The type name `Evolution.Alert' could not be found
            <type name="EvolutionUtil.Alert" c:type="EAlert**"/>
                                                                    ^
EFilter-3.0.gir:249.65-249.65: error: The type name `Xml.NodePtr' could not be found
            <type name="libxml2.NodePtr" c:type="xmlNodePtr"/>
                                                                ^
EFilter-3.0.gir:259.65-259.65: error: The type name `Xml.NodePtr' could not be found
            <type name="libxml2.NodePtr" c:type="xmlNodePtr"/>
                                                                ^
EFilter-3.0.gir:969.69-969.69: error: The type name `Evolution.Alert' could not be found
            <type name="EvolutionUtil.Alert" c:type="EAlert**"/>
                                                                    ^
EFilter-3.0.gir:979.65-979.65: error: The type name `Xml.NodePtr' could not be found
            <type name="libxml2.NodePtr" c:type="xmlNodePtr"/>
                                                                ^
EFilter-3.0.gir:992.65-992.65: error: The type name `Xml.NodePtr' could not be found
            <type name="libxml2.NodePtr" c:type="xmlNodePtr"/>
                                                                ^
EFilter-3.0.gir:1138.69-1138.69: error: The type name `Evolution.Alert' could not be found
            <type name="EvolutionUtil.Alert" c:type="EAlert**"/>
                                                                    ^
EFilter-3.0.gir:1148.65-1148.65: error: The type name `Xml.NodePtr' could not be found
            <type name="libxml2.NodePtr" c:type="xmlNodePtr"/>
                                                                ^
Generation failed: 8 error(s), 0 warning(s)


To sum up :
the ore of the issue is that I have a gir with an argument of type name="EvolutionUtil.Alert" . I have a vapi
which had namespace EvolutionUtil (this worked). I was told to use '* parent="Evolution.Util"' in the metadata to be able to have a top namespace evolution for all the evolution bindings but then vapigen complains that it cannot find "Evolution.Alert" when using vapigen against the gir which has the argument of type EvolutionUtil.Alert .

My finding seems clue me to think that vapigen properly attempt to find the Alert declaration in the vapi I generated wit the metadata '* parent="Evolution.Util'" . But then it only goes one level into the nested namespaces Evolution.Util, ie it stop at Evolution . If I hack this vapi to replace "namespace Evolution { namespace Util" by "namespace Evolution34 { namespace Util {" the error becomes :
EFilter-3.0.gir:239.69-239.69: error: The type name `Evolution34.Alert' could not be found
            <type name="EvolutionUtil.Alert" c:type="EAlert**"/>
                                                                    ^
Also If I remove the nested "namespace Util" the error vanish.

Is using '* parent="Evolution.Util"' supposed to prevent generating bindings against this vapi 


(I am on Vala 0.14.0.20-2d9c1)
Comment 1 GNOME Infrastructure Team 2018-05-22 14:10:39 UTC
-- 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/236.