This is already done by the gnome.generate_gir() module. https://bugzilla.gnome.org/show_bug.cgi?id=790385