Kode / khamake

Kha's build tool.
http://kha.tech
15 stars 45 forks source link

Add onFailure callback #253

Closed MoritzBrueckner closed 2 years ago

MoritzBrueckner commented 2 years ago

There's currently no way to react to build failures from within the Khafile, but if (for example) the pre/post Haxe compilation callbacks are used and there is a compilation error, it can be important to do some cleanup that would otherwise be called in the post compilation callback. This PR adds a new callback onFailure (please suggest a better name if it doesn't fit well) that is called in most cases in which the Khamake process exits with code 1.


Btw (just for your information), running tsc in the project root to generate the .js files will also generate three seemingly unrelated lines of code, two of those were just removed in https://github.com/Kode/khamake/commit/27cf0b1bea74c6573d146b6f26bfaaf8cd11631f. I'm not sure if they should be included or not. They aren't related to my changes, so they are not part of this PR (and discarding them doesn't lead to problems).

Those lines are exports.HaxeCompiler = void 0; in HaxeCompiler.js exports.close = exports.run = exports.api = void 0; in main.js exports.Options = void 0; in Options.js