Advanced Builds

Using a multi-project build can be very useful for separating code destined for the store from code that you're still working on, or sharing a repository with other developers. The Gradle plugin provides some tools to support this configuration.

Each module with source code or resources needs to have the Gradle plugin applied. You can apply the plugin to all subprojects using the subprojects or the allprojects block:

subprojects {
    apply<JavaPlugin>()
    apply<RuneMatePlugin>()
}

Launching RuneMate

The runClient task is added to all projects with the plugin applied. If you run this task from the Gradle tool window in IDEA (or by failing to specify the project in the command line) then a client will be launched for every project. To change this behaviour, you can disable the task in each of your subprojects:

subprojects {
    tasks.runClient {
        enabled = false
    }
}

Bundling Modules

The client may fail to find manifests, bot classes or resources. You can assist it by building a JAR that contains all of your source code, manifests and resources by adding the following task to your root Gradle buildscript:

val uberJar by tasks.registering(Jar::class) {
    group = "runemate"
    dependsOn(subprojects.map { it.tasks.assemble })
    archiveBaseName.set("runemate-bots")
    subprojects.forEach {
        from(it.sourceSets.main.get().output)
        from(it.layout.buildDirectory.dir("runemate/sources/.runemate"))
    }
}

tasks.runClient {
    dependsOn(uberJar)
}

Excluding Modules

Individual modules can be excluded from the bot store submission using the excludeFromSubmission element of the runemate configuration block:

runemate {
    // ... other configuration
    excludeFromSubmission = true
}

This is useful when you want to separate code that you're currently working on from code that you are ready to publish to the store.

Last updated