Search code examples
gradlekotlinpropertiesgradle-kotlin-dsl

How to read a dotted Gradle property in Kotlin DSL?


I can read from gradle.properties with val myProperty by settings, and that's nice! But what if the property name contains dots? Consider the next gradle.properties file:

kotlin.incremental=true
kotlin.incremental.js=true
kotlin.incremental.multiplatform=true

How can I read those properties above in a settings.gradle.kts script?


Solution

  • Here is what I found:

    val myProperty: Boolean 
        get() = settings.extra["kotlin.incremental"]?.toString()?.toBoolean() ?: false