Improve HaxeDevelop/FlashDevelop integration
Yes, it does generate hxproj files, but I'd prefer having proper Kha platform template. I already partially made it with a batch wrapper monstrosity, but without few changes/additions in khamake itself, proper support is impossible. What I'm talking about:
- Add either
--displayflag ordisplayplatform target, which prints hxml file with paths relative tokhafile.js(not frombuildfolder) to stdout.
Current workaround: Printing it frombuild/project-<target>.hxmland adding-D kha_output=build\<platform>\dummyin order to fix asset macro errors. (It have broken-cp <target>-build/Sourcespath, but it's empty anyway in regards of Haxe code) - Make it possible to do
--runwithout forced compilation.
It is required, as "Test Project" in FD for such frameworks works in 2 passes, first it run build command (--compile) and then run command (--run), and currently khamake have now way of making run command without compilation. Current workaround: For windows doing direct launch ofbuild/<target>/<Projectname>.exe, for other platforms - still uses forced compilation. - (optional, but preferable) Add
--cleancommand that would clean up build directory from target files.
Current workaround: Just plain delete those files manually.
What is wrong with current generated hxproj approach? A lot, actually.
- They are not in root folder and because of that
Projectpanel is completely messed up with build folders being shown always and actual sources hidden inReferences. - Each call of khamake regenerates said file.
- Windows proj file in Test Project tries to run
run_windows.bat, which does not exists. - Compilation directly from FD is problematic (for example I can't compile it at all as my OS have Haxe4-preview2 installed as main haxe which FD uses for compilation)
- It generates it's own hxproj for each and every target. FD have a support for several targets (right next to Release/Debug build dropdown), which renders that generation pretty redundant.
Benefits from making proper template? As noted above - one hxproj file, guaranteed compilation (as long as it works for khamake), guaranteed launch, haxe completion, compilation and running managed directly by khamake.
ok, let's take it step by step. Today's agenda: Compilation directly from FD. That actually shouldn't be a problem, the generated projects point to Kha's Haxe via the preferredSDK option. So that nonetheless tries to use your globally configured Haxe path?
No, it refers to Kha's Haxe, yet compilation fails with common.ml error:
Running process: E:\Program\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\_work\2017\khatest\build\Khatest-windows.hxproj" -ipc 4af93ebb-a494-4290-ab6e-743cb05b710f -version "0.0" -compiler "E:\HaxeToolkit\kha\Tools\haxe" -notrace -library "E:\Program\FlashDevelop\Library"
Building Khatest-windows
haxe --connect 6000 -cp E:/HaxeToolkit/kha/Sources -cp E:/HaxeToolkit/kha/Backends/Kore -cp ../Sources -cpp C:/_work/2017/khatest/build/windows-build/Sources -main Main -D no-compilation -D sys_windows -D sys_kore -D sys_g1 -D sys_g2 -D sys_g3 -D sys_g4 -D sys_a1 -D sys_a2 -D kha_cpp -D kha_windows -D kha_windows_cpp -D kha_default -D kha_kore -D kha_g1 -D kha_g2 -D kha_g3 -D kha_g4 -D kha_a1 -D kha_a2 -D kha -D kha_version=1611 -D kha_output="C:\_work\2017\khatest\build\windows-build\Sources" -debug
File "src/context/common.ml", line 834, characters 21-27: Assertion failed
Build halted with errors (haxe.exe).
Done(1)
It does compile and run properly if I use kha --compile, as well as my own Kha template (welp, it does run kha --compile, so no surprise).
A workaround for a root level project file i use, is to simply create an hxml based FD project and forward to build/project-flash.hxml:
--cwd build
project-flash.hxml
Can you verify which haxe.exe is actually used for example by renaming the executables? For me it uses Kha's Haxe like it should. Also please test using one of the samples ala https://github.com/Kha-Samples/Empty so we can make sure the issue is not in Khatest-windows.
Confirming. Even after adding Kha's Haxe to SDK list and selecting it - building via FD does not work. Both with my (actually pretty much same empty) project and empty repo. Both with recursive cloning and with external kha repo. Same goes to any target. Do not I use development builds of FD, because stable lacks features a lot. (Plus usability fixes since recently)