All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Changes that change the generated API have a
- Consider all String properties as nilable and add
prop_name?
andprop_name=(Nil)
(#160).
- Add support for Gio async functions (#157).
- Requires Crystal compiler >= 1.6.0 (No PR 😁 2ebec2b0f9251b56b4310a8413b5d828c339af5f).
- CI now uses newer libraries through Ubuntu 24.04 (#154).
- Some code cleanup (#155 #156).
- Fixed compilation problem when project dir has spaces, thanks @BigBoyBarney (#149)
- Fixed typo in cli help message.
- Fix compilation with GLib 2.80.
- Remove more deprecation warnings from crystal 1.11 😅️.
- Remove deprecation warnings from crystal 1.11.
- Tell the compiler LibGio.g_application_run can raise exceptions, so you can catch them.
- Use ::Bytes on array of UInt8 parameters and return values. (#140)
- Gio bindings are now included in GICrystal (#139).
- Easier to require just
GLib
,GObject
orGio
, userequire "gi-crystal/glib"
,require "gi-crystal/gobject"
orrequire "gi-crystal/gio"
- Fixed a crash when trying to cast modules (#132)
- Fix setter of GObject properties when using nulable types.
- Fixed a crash when using casted objects that came to Crystal first as a GObject::Object.
- Use Crystal Char for gunichar.
- Do not block the code generation if some TypeLib wasn't found, just warn instead.
- Fix compilation with glibs2 2.78 and gobj introspection 1.78 (#125).
- Increase reference of transfer full interface parameters (#122).
- Check if object is null before increase its reference (#119).
- Fix array of string properties (#118).
- Remove hardcoded
g_object_ref
calls, binding authors now need to implementGICrystal.ref
/GICrystal.unref
for their special types (#123).
- Annotate deprecated methods in bindings (#114).
- Add
#to_s
,#==
and.parse
toGLib::Variant
(#113). - Add GC resistant GObject subclasses 🎉️, thanks @BlobCodes (#107).
- Allow enum and flags to be ignored in binding.yml (#101).
- Print GI annotation info for vfunc, helping debugging.
- Bind false boolean constants to false (#111).
- Ensure Bool return type on vfuncs that return booleans (#110).
- Fix ownership transfer of vfunc return values (#102).
- Fix compilation for vfuncs returning nullable objects or strings (#104).
- Ignore deprecated
GObject::ValueArray
object. (#115)
- Add test helper methods:
ClosureDataManager.count
,ClosureDataManager.info
andClosureDataManager.deregister_all
(#92). - Added bindings for
GLib.real_name
(#93). - Added option to ignore constants in binding generation, thanks @charitybell (#95)
- Fix compilation with
-Ddebugmemory
for some struct bindings (#91). - Convert boolean return values in virtual functions (#96).
- Removed a lot of constants from GLib and GObject bindings (#97).
- Let struct bindings allocated on help to obey
-Ddebugmemory
flag. - Translate GTK doc parameter markup to crystal doc style.
- Removed version_from_shard dependency.
- Added declaration of
LibGLib.g_bytes_new_static
, used internally by other modules.
- Show Crystal version on generator logs.
- Support
Path
objects in signals, they are exposed as C strings to C code.
- Fix
GLib::SList
of modules (GObject interfaces) (#68). - Fix
GLib::SList
ofGObject::Object
. - Fix
GLib::List
of modules. - Fix
GLib::List
ofGObject::Object
. - Fix signals with modules (GObject interfaces) parameters.
- Do not use relative paths on
GiCrystal.require
macro (#70). - Fix binding generation for modules with no errors that doesn't depend on GLib (#79).
- Fix callback generation of callbacks without user_data paramenter as last parameter (#63).
- Fix signal boolean parameters (#66).
- Allow chaining up unsafe vfuncs, thanks @BlobCodes.
- Added support to declare GObject properties in Crystal classes 🎉️, thanks @BlobCodes (#44).
- Added possibility to ignore some struct fields in binding generation (#58).
- Crystalize even more docs, thanks @GeopJr (#62).
- Enum and flags
#g_type
method now works (#56). - Convert return values of vfuncs (#60).
- Changed format of
binding.yml
file for better flexibility. - Generate bindings for POD structs as Crystal structs (#58).
- Doc comments generation is now disabled by default (#59).
- Added option to complete ignore functions (i.e. ignore new added HarfBuzz functions that broke the generator).
- Fixed naming of virtual functions, now they can have any name.
- Correct generate code for structs with static array of structs, thanks @BlobCodes.
- Property constructors can be called in constructor super calls from user classes, e.g.
super(property: value)
. - Show if return value is nullable in generated code, helping debug.
- Implement virtual functions and allow including interfaces, thanks @BlobCodes (#26).
- Implement unsafe virtual functions, thanks @BlobCodes (#41).
- Implement user-transparent GObject enums, thanks @BlobCodes
- Use
GC.malloc_atomic
to allocate wrappers to reduce GC work, thanks @BlobCodes (#18). - Move struct wrappers data inside struct, reducing 1 malloc call, thanks @BlobCodes (#19).
- Translate GError in return values or signal parameters to exception objects. (#25)
- Raise a compile error when using
GObject::ParamSpec.g_type
. (#24) - Print info about ClosureDataManager when compiling using -Ddebugmemory.
GObject::GeneratedWrapper
annotation is nowGICrystal::GeneratedWrapper
.
- Don't use invalid characters when registering GObject types, thanks @BlobCodes (#30)
- Allow binding objects with functions named initialize/finalize, thanks @BlobCodes (#42)
- Signals can now be disconnected,
connect
method returns aGObject::SignalConnection
object.- Disconnect signals from an object is important to let them be collected by the GC.
- Raises a compile time error if trying to inherit from a final GObject type.
- Initial support for user defined signals 🎉️, current supported parameter types are
Number
,String
andBoolean
.
GLib::Bytes#data
now returns aSlice(UInt8)
instead ofEnumerator(UInt8)
.GLib::Bytes
constructor can accept any pointer + size in constructor, unsafe but doesn't copy data.- Removed all
GObject::ParamSpec
subclasses, they don't need to be exposed in bindings,GObject::ParamSpec
is enough. - Requires crystal compiler version >= 1.4.1.
- Don't generate code for constructors with empty parameters (generic constructor will work).
- Allow user objects inheriting GObject to have custom constructors.
- Support signals with array of GObjects.
- Support signals with array of GObjetct Interfaces.
- Support signals with boxed structs.
- Support signals with enums.
- Avoid copy strings when creating quarks to store object qdata.
- Fix signals with nullable strings.
- Don't use
self
on method implementations, so they can be used in constructors before instance variables be set.
- Callback parameters are now supported.
- Fixed size array parameters raises
ArgumentError
if the size is less than the expected size.
- User classes can inherit from classes with size bigger than
GObject::Object
(e.g.Gtk::Widget
). - Methods with nilable handmade types (GValue/GVariant) in parameters now works.
- Strings in structs now works.
- Signals with return types now works.
- Methods named
initialize
are now correctly binded to_initialize
, thanks @GeopJr. - Fixed parameters of fixed size arrays.
- Fix
make doc
.
-
Wrapper instances are now re-used and shared, so all variables wrapping the same GObject now share the same address and hold just 1 reference to the GObject, this mean some things:
- A lot less memory allocations! 🎉️.
- Ordinary Crystal casts will work for Objects created from Crystal code and you rarely will need to use the
.cast
method.
- Add support to subclass a GObject 🎉️.
- Fixed memory leak in GObject proeprty constructors.
- Fixed crash when trying to free memory of C arrays in return values.
- Fixed problems with floating references.
- Module functions are generated.
- Very basic support for GObject subclassing.
g_main_context_invoke
,g_main_context_invoke_full
andg_closure_invoke
got the right@[Raises]
annotation.- Don't raise an exception if the C library creates an enum or flag with an invalid value (i.e. with reserved fields).
- Fix assignment of false value for boolean properties in constructor.
- Fixed problems with GObject float references.
⚠️ GObject::ParamSpec
if back on bindings, so notify signals need to declare it again.- Some more functions were removed from the bindings, see commit
bd3cf6a3f96c5cb60796ef11ccceea242f4625cb
and2194662ca53648972787c507e0d5e010253f218b
. - Removed ameba development dependency.
- Better code blocks in documentation, thanks @GeopJr.
- It's possible to add
@[Raises]
annotation on functiosn that can executa a callback, thanks @BlobCodes.
- Structs with non pointers struct attributes works as expected.
- Structs comparisson now are made by
memcmp
. - Use the correct unref function for GLib types.
- Fix Makefile to work with parallel jobs.
- Generate interface signals.
- Bump required Crystal version to 1.3.2 since I'm only testing with this version 🤷️.
- Fix signals with nullable parameters.
- Fix methods returning arrays of primitive types of any kind.
⚠️ Implement functions that return non-null terminated array of strings.- Added bindings for GLib::Bytes.
- Convert compare-api tool to Crystal and improve it a lot, it will be a good tool to detect patches that break the API 😎️.
- Remove bindings for GLib
KeyFile
class, INI module in Crystal stdlib can replace it.
void*
return values in C are translated toPointer(Void)
instead ofPointer(Nil)
.- Constructors that may return
nil
now have the correct return type restriction. - GObjetct flags with no elements are generated as a enum instead of a constant.
- Add
./bin/compare-api
script to compare APIs generated by two different versions ofgi-crystal
. - Generate raw documentation for constants and enums.
- Print more GI annotations on generated code to ease debug.
- Revert auto require of GObject module on gi-crystal since it makes the compiles require the file twice.
⚠️ Fix binding of functions with GError and more than one parameter.⚠️ Constructor methods always return their own type despite the C function returns the parent type or not.
- Binding configuration now must be in binding.yml files.
- Command line no more need config paths, etc. gi-crystal can detect all bindings in the project and generate them.
- Need to run bin/gi-crystal manually before compile any project usign gi-crystal.
- Binding extra files are no longer copied into to generated output dir, but included directly.
- All generated files are now created under
lib/gi-crystal/src/auto/<module_dir>
by default. - GError are now translated to Crystal exceptions.
- GLib/GObject bindings are required when
gi-crystal
is required.
- Interfaces returned by methods can be used in GValues.
- Append
?
to property getters that starts withis_
. - Constructors with transfer none proper handle reference counting.
- Always use fully qualified names on property return types
-Ddebugmemory
compiler option can be used to debugfinalize
calls.
- First Release.