I am trying to translate all groovy-scripts in a gradle project to kotlin. The only problem I currently still have is translating the file settings.gradle
in the root directory of my project. In the groovy-script there is an if-condition if(project.hasProperty("someProperty"))
. Unfortunately, when trying to translate it to kotlin, the project
keyword is not recognized anymore. Furthermore, in the same folder I have a build.gradle.kts
, which is written in kotlin and in which I can use the project
keyword in an if-condition as described before without any problem. It just doesn't seem to work, when I want to translate the groovy-script in settings.gradle
to kotlin in settings.gradle.kts
.
The project is a gradle project and the settings.gradle
looks as follows:
include ':subproject-a',
':subproject-b'
if (project.hasProperty("someProperty")) {
include ':subproject-c'
}
I would like to translate this to kotlin like so:
include(":subproject-a",
":subproject-b")
if (project.hasProperty("someProperty")) {
include(":subproject-c")
}
However, when I do that, project
is not recognized. Even though, as mentioned before, it worked just like that in build.gradle.kts
(which is written in kotlin, translated from groovy), which is in the same folder.