HxGodot / hxgodot

A Haxe GDExtension for Godot 4
MIT License
232 stars 11 forks source link

Binding generation is broken with haxe 4.3.3 #58

Closed dazKind closed 11 months ago

dazKind commented 1 year ago

$ haxelib run hxgodot generate_bindings -y
HxGodot (1.0.0-beta)
Generating Godot 4 Haxe bindings...
Generating binding classes for Godot Engine v4.2.beta.custom_build (float_64)...
Targeting "D:/godot4/squash-the-creeps-3d-hxgodot/bindings"
(unknown) : Unexpected ;
Done.```
alexeychikk commented 1 year ago

For me it fails with:

Do you want to generate Godot 4 64bit bindings to use with the sample project? [y/N] y
Generating Godot 4 Haxe bindings...
Generating binding classes for Godot Engine v4.2.beta.custom_build (float_64)...
Targeting "D:/git/haxe-godot-colyseus/bindings"
(unknown) : Unexpected ;
Called from ? line 1
Called from RunMain.hx line 162
Called from RunMain.hx line 285
Called from RunMain.hx line 246
Called from C:\Users\progg\AppData\Roaming/haxe/versions/4.2.5/std/neko/_std/sys/io/File.hx line 37
Called from C:\Users\progg\AppData\Roaming/haxe/versions/4.2.5/std/neko/_std/sys/io/File.hx line 53
Uncaught exception - [file_open,D:/git/haxe-godot-colyseus/bindings/.gdignore]

What's notable is that I don't even have progg user (C:\Users\progg), and the installed haxe version is 4.3.3, not 4.2.5 as printed in logs.

dazKind commented 1 year ago

Hi there,

Yes, that's the same error. I will soon look into this.

Btw, these absolute paths are compiled into the neko script from my build machine.

TheHENOOB commented 11 months ago

For me it fails with:

Do you want to generate Godot 4 64bit bindings to use with the sample project? [y/N] y
Generating Godot 4 Haxe bindings...
Generating binding classes for Godot Engine v4.2.beta.custom_build (float_64)...
Targeting "D:/git/haxe-godot-colyseus/bindings"
(unknown) : Unexpected ;
Called from ? line 1
Called from RunMain.hx line 162
Called from RunMain.hx line 285
Called from RunMain.hx line 246
Called from C:\Users\progg\AppData\Roaming/haxe/versions/4.2.5/std/neko/_std/sys/io/File.hx line 37
Called from C:\Users\progg\AppData\Roaming/haxe/versions/4.2.5/std/neko/_std/sys/io/File.hx line 53
Uncaught exception - [file_open,D:/git/haxe-godot-colyseus/bindings/.gdignore]

What's notable is that I don't even have progg user (C:\Users\progg), and the installed haxe version is 4.3.3, not 4.2.5 as printed in logs.

hen@mintnoob:~/Documents/rl$ haxelib run hxgodot generate_bindings
HxGodot (1.0.0-beta)
Do you want to generate Godot 4 64bit bindings in the current directory? (/home/hen/Documents/rl) [y/N] y
Generating Godot 4 Haxe bindings...
Generating binding classes for Godot Engine v4.2.beta.custom_build (float_64)...
Targeting "/home/hen/Documents/rl/bindings"
(unknown) : Unexpected ;
Done.

I recompiled the CLI (which is localized on tools/run/) the problem with the hardcoded windows path from the dev's computer was solved, I don't know if it's because of '-D neko-v1' on compile.hxml although I am also interested on knowing why this define is there out of curiosity.

But the same problem that the dev opened the issue about still persists as seen above (my Linux Mint machine).

TheHENOOB commented 11 months ago

From what I have seen, the roots of the issue is around here: https://github.com/HxGodot/hxgodot/blob/main/src/godot/macros/ClassGenMacros.hx

since generate_bindings calls the haxe compiler to use a macro function named api() coming from this class.

I believe the misplaced ';' is from the macro functions written in this class (and since I am new to haxe macros I can't tell)

dazKind commented 11 months ago

@TheHENOOB @alexeychikk Haxe 4.3.3 works and the bindings generate successfully, now.