I am not exactly sure how `HasImplicitReceiver` an...
# gradle
n
I am not exactly sure how
HasImplicitReceiver
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:
Copy code
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)
}
b
The
HasImplicitReceiver
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)
n
Thank you @bamboo