codeoverflow-org / chatoverflow

What if you could combine the power of chat bots, streamer support sites and social media? This is chat overflow.
http://codeoverflow.org
Eclipse Public License 2.0
57 stars 12 forks source link

GUI build system rework #160

Closed hlxid closed 4 years ago

hlxid commented 4 years ago

Description

We currently manage the gui build with custom sbt tasks and sbt is unaware of the gui project.

If we also add a custom publish task for #161 I feel like we are re-implementing all tasks of sbt instead of reusing their default implementations. Whats only different from a normal java/scala project is the installation of dependencies and compiling. Packaging is the same, but we want to move everything to the /chatoverflow-gui/ directory, this is where the GUIServlet looks for it and it always has been in that directory.

So instead I would propose that we handle the gui as a sbt project by adding a build.sbt to it, setting the class directory to dist/ and implementing compile and, if we can't reuse the original package task by prefixing everything with the directory name, package. We get all other tasks like publish and so on because they most of them depend on these fundamental tasks and we output a directory of files for the classpath and jar just as a normal scala project would do. The framework then depends on the sbt gui project.

sbt would handle executing the overwritten compile/package tasks at the same time when the framework gets compiled. Also as a little side effect this compiles the gui in parallel to all other components which decreases rebuild times from about 50 seconds to about 35 seconds, which is a nice bonus.

@sebinside you've disabled the gui build in the simple configuration with 062b80985cfe50878b98cbb0fdeac8a9807dba67 and 29b8257e79127fa57b99f8a5c3340b76abe72c49 when the gui was firstly added to the build system. This was probably due the very poor performance it had because sbt was restarting for every task, right? With this change the gui would also be built with the simple configuration, but because at the time it checks if it has to recompile, the framework, api and all plugins do it too, it shouldn't increase the build times by much. If it had another reason I think we can also configure it to only compile the gui with an advanced build, if you want to.

sebinside commented 4 years ago

Yes this is right. Since the simple task ist only for plug in and simple framework changes, a gui rebuild was to costly. But of course, it could be included if the overhead is small enough. Good idea 👍

hlxid commented 4 years ago

Finally this finished after some extensive testing.

Note to all running develop: you need to execute fetch and (if not automatically prompted) reload the project in IntelliJ to get the GUI working for the first time because the plugins.sbt now also contains the gui project. New setups don't have this problem because the plugins.sbt file gets generated with the gui project right away.