MetaBuild

open class MetaBuild(val baseFolder: File)

MetaBuild is the top-level object, which has one or more Projects.

Usage

Create a subclass of MetaBuild.

Call rootProject e.g. :

val root = rootProject().apply {

    application( "mypackage.MyApplication" )

    kotlin().apply {
        implementation( ... )
        implementation( core ) // See note below.
    }

    defaultTasks( "installDist" )

}

If your project has subprojects, create a project for each of them. e.g. :

val core = subProject( "core" ).apply {
    kotlin().apply {
        implementation( ... )
    }
}

NOTE. In this example, the root project has a dependency on the core subproject. Therefore, core must be declared before root.

Finally, build the gradle scripts using buildGradleScripts.

Examples

Take a look at Example's source code, or metabuild.feather in this project's root folder.

Inheritors

Constructors

Link copied to clipboard
constructor()

Gradle scripts will be created in the current directory.

constructor(baseFolder: File)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Builds build.gradle.kts for each Project, as well as a single gradle.properties file and a single settings.gradle.kts file.

Link copied to clipboard

If your project already contains a gradle wrapper, then this updates it to the default version of gradle. Otherwise, it adds the gradle wrapper (The command gradle must be on your path).

fun installGradle(version: String)

If your project already contains a gradle wrapper, then this updates it to the specified version of gradle. Otherwise, it adds the gradle wrapper (The command gradle must be on your path).

Link copied to clipboard
fun jvmArgs(args: String)

Command line arguments for the jvm used by gradle. Adds a property org.gradle.jvmargs to gradle.properties.

Link copied to clipboard

fun kotlinVersion(version: String)

Specifies which version of the Kotlin plugin to use by all projects. Note, if you prefer, you can set this on a per-project basis using Project.kotlinVersion.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun project(projectName: String): Project
Link copied to clipboard
fun property(name: String, value: String)

Adds a property to gradle.properties.

Link copied to clipboard
fun publish(group: String, version: String)

Stores meta-data used by Project.publishing.

Link copied to clipboard
fun repositories(vararg repositories: Repository)

fun repositories(repositories: List<Repository>)

Define which repositories to use for all projects.

Link copied to clipboard

Declare the root project.

Link copied to clipboard
fun subProject(projectName: String): Project

Declares a subproject.

Link copied to clipboard
fun toolChain(version: Int)

Sets the JVM toolChain version for all projects. If this is omitted, then defaultToolChain is used.