8

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?

sedovav
  • 1,986
  • 1
  • 17
  • 28

2 Answers2

11

Here is what I found:

val myProperty: Boolean 
    get() = settings.extra["kotlin.incremental"]?.toString()?.toBoolean() ?: false
sedovav
  • 1,986
  • 1
  • 17
  • 28
1

Besides the extra hack of your own answer, you can use

providers.gradleProperty("kotlin.incremental").get()

since Gradle 6.2.

Vampire
  • 35,631
  • 4
  • 76
  • 102