Large Kotlin build - how to structure

For Kuberig (https://github.com/teyckmans/kuberig) which is a Gradle plugin to define/deploy to kubernetes/openshift using a Kotlin DSL to define your resources.

I have created an other Gradle plugin kuberig-dsl (https://github.com/teyckmans/kuberig-dsl) to generate a Kotlin DSL based on the kubernetes/openshift api specifications.

I am using the kuberig-dsl plugin to generate these DSLs for all vanilla kubernetes/openshift versions that have a swagger api specification in the following projects:

Both of there repositories have the same setup. In the buildSrc there is a task that is able to add new sub-modules based on upstream tags.

These projects are becoming really large and there builds are talking too long and I am no longer sure this is the best way to structure the build. Always adding new sub-modules does not look like a good way to scale this case.

Considering that for every Kubernetes version the kuberig-dsl generates around 5 MB of Kotlin sources. This is just a really CPU intensive build. I am not sure there is any other option but to have a separate Gitlab pipeline for each (sub-)module.

Additionally:

  • I need to be able to release new versions of new (sub-)modules for the current kuberig-dsl plugin version, best case automatically without manually doing a bintrayUpload. I am now doing this manually for every newly created sub-module.
  • I need to be able to release all (sub-)modules in case there is a new kuberig-dsl plugin version. This now easy since it is just a full build now that they are sub-modules.

Questions I am wondering about:

  • How to make the build faster? CI pipeline by (sub-)module? I am currently using Gitlab CI but it does not look to have a lot of monorepo support to deal with this easily.
  • Is monorepo the way to go at all in this case? If not, I need to automate the creation/management of Github repos/Gitlab CI pipelines (and the sync repo) which sounds like overkill.

Any advice/experience with a similar build scenario would be great.