haxe-sublime-bundle icon indicating copy to clipboard operation
haxe-sublime-bundle copied to clipboard

Incorrect parsing of --macro in HXML

Open nadako opened this issue 10 years ago • 8 comments

Things like --macro addMetadata("@:nativeChildren", "unityengine.MonoBehaviour") are parsed incorrectly by the plugin (because of splitting by " "). I guess --macro needs special handling.

nadako avatar Aug 29 '14 20:08 nadako

Actually it may make sense to do split(" ", 1) here for everything: https://github.com/clemos/haxe-sublime-bundle/blob/master/HaxeComplete.py#L822

nadako avatar Aug 29 '14 20:08 nadako

should be fixed, please confirm ;)

clemos avatar Aug 30 '14 11:08 clemos

Hm, it seems not to use --macro for completion and ctrl+enter builds. Also, another problem is that ctrl+enter doesn't add classes specified in hxml. For example:

build.hxml for a unity project

--macro addMetadata("@:nativeChildren", "unityengine.MonoBehaviour")
-cs out
-D dll
-D net-ver=40
-net-lib G:\Unity\Data\Managed\UnityEngine.dll
Main

ctrl+enter run: haxe -D dll -D net-ver=40 -net-lib G:\Unity\Data\Managed\UnityEngine.dll -cp F:\Code\playground --connect 6001 --cwd F:\Code\playground -cs out

completion run: haxe -D dll -D net-ver=40 -net-lib G:\Unity\Data\Managed\UnityEngine.dll -cp F:\Code\playground --connect 6001 --cwd F:\Code\playground -D st_display --display F:\Code\playground\Main.hx@95 --no-output -cs out

nadako avatar Aug 30 '14 11:08 nadako

The --macro problem seems to be related to that it's checked as -macro, like -cmd when it should have double dash.

nadako avatar Aug 30 '14 12:08 nadako

Ok I corrected --macro. As for the other problem, I wasn't aware you could just add Main like this. Is it documented somewhere ? How is it different from adding -main ?

clemos avatar Aug 30 '14 13:08 clemos

--main specifies a class with the main static function. when you use it, haxe generates a call to that function. however, when you simply specify modules by their dot-path, it just compiles them, which is useful for compiling pluggable libraries. i believe it's mentioned in haxe command line help :wink:

nadako avatar Aug 30 '14 13:08 nadako

You can try for yourself by doing haxe -main Main -js test.js vs haxe Main -js test.js and looking at the output.

nadako avatar Aug 30 '14 13:08 nadako

Ok, I'll see if I can implement that ;)

clemos avatar Sep 05 '14 07:09 clemos