nikolaymetchev
11/28/2017, 2:17 PMHasImplicitReceiver
annotation works on the Action
interface but it seems to workin build.gradle.kts and doesn't seem to work in *.kt files in buildSrc. I have to explicitly cast to the receiver: private fun KotlinBuildScript.setupIvyRepository() {
plugins.apply("org.gradle.ivy-publish")
val conf: org.gradle.api.publish.PublishingExtension.() -> Unit = {
repositories {
this as RepositoryHandler
ivy {
this as IvyArtifactRepository
url = URI("file:////C:/Temp/ivy.local")
layout("pattern") {
this as IvyPatternRepositoryLayout
ivy("[module]/[revision]/ivy.xml")
artifact("[module]/[revision]/[artifact]-[type].[ext]")
}
}
}
}
extensions.configure("publishing", conf)
}
bamboo
11/28/2017, 4:06 PMHasImplicitReceiver
has to be enabled with a Kotlin compiler plugin, the kotlin-dsl
plugin does that but there’s a bug preventing in IntelliJ from handling the buildSrc
case properly (https://github.com/gradle/kotlin-dsl/issues/413)nikolaymetchev
11/28/2017, 4:50 PM