So, I’m working on Atom Defold IDE. Been using it a bit and I’ve been finding myself pressing Cmd-R and Cmd-B while in Atom quite a lot. Is there/will there be a way to trigger hot reloading and/or rebuilding programmatically in the current editor or in Editor2?
You can build and run from the command line using bob and dmengine, but that’s about it. I’m not aware of any way of interfacing with the editor to trigger a build or hot reload of content. @Erik_Angelin and @Ragnar_Svensson, would that be possible using the new editor?
The only way to build (which is also needed for hot-reload) programmatically is through bob. For the hot-reload, the Editor simply tells the engine to reload via HTTP, so this could be done from somewhere else. We have no plans to be able to control Editor1/Editor2 programmatically yet, sorry. It would be quite some time before we would look into that.
That’s cool. I took a look with Wireshark and noticed that you do a POST to localhost:8001/post/@resource/reload
with \n<path_len><path_to_compiled_file>
. I managed to trigger a hot reload with curl this way, but I had to run bob
to compile the file beforehand. I’m not sure though if bob
does a full compilation or is incremental, as it seemed to be just slightly slower than from within the editor. I’ll implement this in Defold IDE, thanks.
bob is incremental, unless you do a clean first.
It’s also slower, partly because it needs to start the JVM every time.
I tried running it with Drip. Didn’t help by much. I suspect it’s all the stat()
-ing it needs to do before it figures out which files need recompilation and which don’t. I’m not aiming for a perfect replacement anyway.
@dapetcu21 Is this something like this?
curl -d "\n\022/main/main.scriptc" -X POST localhost:49757/post/@resource/reload
Hmm. this doesn’t work.
Can you manage to trigger Hot reloading @dapetcu21 ? But I cound’t find a way to trigger with curl. Am I missing something?
Defold post looks like this.
They probably changed the way it gets triggered.
This code has practically not changed for a couple of years. You’re supposed to send a protobuf message consisting of the resource path to reload (as a string), I suppose encoded like this: https://developers.google.com/protocol-buffers/docs/encoding#strings
I.e. prefixed by length. Not sure about the type + field number, would have guessed there should be a leading 0x02. Note that all of this is subject to change, but, well, probably not soon