Sometimes I write things, sometimes I don't.

To content | To menu | To search

GIR for java-gnome: last update / summary

This is the last week for this year Google Summer of Code and so it is time to see all the work that has been done.
To summarize for the people that did not follow my work the goal was to rewrite a piece of the java-gnome's code generator to make it able to use the GObject Introspection data in place of the .defs data.

Since about a week I am proud to say that the goal has been reached and we have a ready to use GObject Introspection powered code generator for java-gnome. The code that has been produced is not merged yet into the master branch but I guess that this work will be done one day after this GSoC.

Now we are going to take a look at all the steps passed:

  • The first step was to decide what kind of Introspection data to use: typeslib or XML files. After some tests and thinking we have agreed with Serkan, my mentor, to use the XML format. It has the advantage to be human readable but it is boring to parse in Java. To make this more easy and little bit less boring I have decided to use the XOM API.
  • After some reading and quick tests, I was trying to convert the XML data to .defs files. I tried to do that in order to still be able to use the DefsParser that has been used and tested for years. The idea was to understand the XML format properly and to find equivalences between XML elements and Defs blocks.
  • After understanding the XML format and the XML elements well enough I could start the real work and implement the GIR data parser right inside the code generator. This was the most difficult part of my work. It was a long and complex process to ensure that we had a way to get all the data that we needed to generated the bindings properly. This part of the work took almost half of the GSoC to be completed and eventually being stable enough to be used.
  • Some code polishing were done to have something maintainable and well working. This has involved a small rework of the ./configure step when building java-gnome. This step now tries to find the required .gir files needed by the IntrospectionParser class.
  • Another big part of the code was to find a way to blacklist objects, functions and other things that we do not need to have a binding for. Without it the IntrospectionParser tries to generate bindings for all the things that it finds in the GIR data. After some researches and some trials I have decided to use an XML format file that contains a list of types that we care about and for each type a list of things that we must ignore.
  • The java-gnome's code generator also used to use some custom made Defs data to generate code in the way we wanted it to be generated. To be able to continue to do such a thing, I have decided to add a way to feed the bindings generator with .defs files that contain data that can be used to override XML data or simply to add some custom code.
  • Of course I have ran the full java-gnome's tests suite when the bindings eventually compiled. I made this to ensure that there were no regressions after switching to the Introspection based code generator. At the beginning I have found some regressions which have been fixed quite easily.
  • I have taken some time to test the IntrospectionParser with several .gir files to ensure that it was working properly with every .gir files. I guess that there will probably be some improvements to do in the future but for now it is working well enough.
  • Eventually, the last (and bonus) step of this GSoC was to propose the coverage of another library. I have taken the time to do that during the past weeks. So now we have a coverage of the libgweather. I have choosed libgweather because covering it involves to touch almost all elements of the code generator (types.list files, add overriders, modify the generated Java package name). Here is a auick screenshot, yes my work was not really "screenshotable" before that.

To conclude, I would like to thanks everyone that was involved in this Google Summer Code. Thanks to Carol Smith from Google, without her I would not have spent 3 awesome summers. Thanks to GNOME for selecting me as a student this year, this was a real pleasure to work for you guys. Big thanks to Serkan Kaba for mentoring me and also to Andrew Cowie who believed in me to achieve such an important goal for java-gnome. Thank you all for doing what you did for me!