Re: Is inclusion in GIR files transitive?



On Thu, 2015-01-15 at 01:32 +0000, Phil Clayton wrote:
When a GIR file contains an include entry as follows:

   <include name="<name>" version="<version>"/>

does that implicitly include all namespaces that have an include entry 
in <name>-<version>.gir?
*snip*

From looking at the code, it depends where the includes are interpreted.

When a GIR is converted into a typelib, its list of includes are
directly converted to dependencies and stored in the typelib.

When a typelib is loaded, its list of dependencies are exposed directly
as g_irepository_get_dependencies().

When a GIR file is created using g-ir-scanner, the code theoretically
recursively parses all includes, but that appears to be broken as the
namespaces put into self._namespace.includes and self._parsed_includes
in transformer.py differ: transitive dependencies are put into
self._parsed_includes, but girwriter.py only writes out the dependencies
from self._namespace.includes, so the transitive ones are dropped.

I’ve attached a really quick patch which fixes this for me, but it
probably misses some code paths, and probably doesn’t match with Colin’s
original intention for dependencies[1]. I don’t really know.

I am now wondering whether that is the right assumption because I am 
finding that g_irepository_get_dependencies is not returning all 
transitive dependencies (see attached).  It's supposed to because the 
documentation says so:
https://developer.gnome.org/gi/unstable/GIRepository.html#g-irepository-get-dependencies
Is that just a bug in GIRepository due to a change in the meaning of GIR 
files?

I’m leaning towards thinking it’s a bug, but then I have no idea how
this behaviour could have changed recently, and why it wasn’t noticed
before. Maybe commit 9c1d1813223346b17cfee0383bf026b2c93c385f?

Colin, do you have any ideas?

Philip

[1]:
https://git.gnome.org/browse/gobject-introspection/commit/?id=8e9b9ce60747b262e3e9c4be4ae85ee1319ae3f4

Attachment: 0001-giscanner-Fix-transitivity-of-includes.patch
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]