![][gradlePluginPortal] ![][travisCi]
- Gradle >= 4.9
- Kotlin and JVM projects
Edit the build.gradle(.kts) file of the project where you want to add a BuildConfig.kt
:
plugins {
id("io.pixeloutlaw.gradle.buildconfigkt") version "1.0.4"
}
The plugin will automatically configure itself based on your project to generate a BuildConfig.kt
. This can be
configured using the buildConfigKt
extension.
Using automatic configuration, below is a sample output from this plugin.
// build.gradle.kts
plugins {
kotlin("jvm")
id("io.pixeloutlaw.gradle.buildconfigkt") version "1.0.4"
}
project.group = "simple.example"
project.version = "0.0.1"
// settings.gradle.kts
rootProject.name = "example"
// build/generated/source/buildConfigKt/simple/example/BuildConfig.kt
package simple.example
import kotlin.String
object BuildConfig {
const val NAME: String = "example"
const val VERSION: String = "0.0.1"
}
Using all of the fields available in the extension, here is the output from this plugin.
// build.gradle.kts
plugins {
kotlin("jvm")
id("io.pixeloutlaw.gradle.buildconfigkt") version "1.0.4"
}
project.group = "simple.example"
project.version = "0.0.1"
buildConfigKt {
appName = "StarWars"
packageName = "galaxy.far.far.away"
version = "2.0.19"
className = "Kenobi"
}
// settings.gradle.kts
rootProject.name = "example"
// build/generated/source/buildConfigKt/galaxy/far/far/away/Kenobi.kt
package galaxy.far.far.away
import kotlin.String
object Kenobi {
const val NAME: String = "StarWars"
const val VERSION: String = "2.0.19"
}