Hotswapping

Jan Polák  —  4 months, 1 week ago [Edited 0 minutes later]
Many projects, and especially games (I know, in Java, *gasp*, don't throw stones at me, please), can benefit greatly from the ability to hotswap code of the running application. Unfortunately, I have not been able to find any existing build systems that support it. I know that IntelliJ IDEA does, but only for code compiled and launched through it, which is often not possible to do correctly when the project is using a build system - which is true for almost all projects, at least for me.

Therefore, I have had a hotswap plugin for Wemi on my roadmap for quite some time now, and I have finally got to implementing it. The plugin itself was not that hard, as I have already created such plugin for SBT. The harder part was designing a minimalistic plugin API. Initially, I didn't want to have any API at all (and I still want to keep it minimal), as all the functionality that a plugin has, should be available to standard build scripts as well. The only reason Wemi has an one-interface, optional, plugin API, is because without it, it was impossible to inject default implementations of keys added by the plugin into the predefined Archetypes.

Long story short, it is now possible for libraries/plugins to say "hey, Wemi, when you add me to the classpath of build script, make sure to call this method so I can initialize myself and add some extra functionality to user's project". And it works pretty well.

Next up, I have been rewriting and simplifying some internal classes and keys. Also, build-script dependencies (such as aforementioned plugins) were previously added by "comment" directives, but those were not checked by the compiler and IDE didn't understand them as anything special, so I have rewritten them to use Kotlin's file-annotations. Oh and bugs, many tiny bugs were squashed in the last few days.

Before the release of 0.4, I still want to fix some bugs found in the command line argument parsing, and improve some introspection commands. But that shouldn't take too long.

If you have read this far, thanks! Feel free to let me know what you think - even though I am still doing this mostly for myself, I'd be happy to hear your opinion. And help, if you decide to try it!
Log in to comment