gradle / kotlin-dsl-samples

Samples builds using the Gradle Kotlin DSL
https://gradle.org/kotlin/
Other
3.71k stars 433 forks source link

Adding a plugin on `buildSrc` compile classpath causes unexpected exception #1363

Closed melix closed 5 years ago

melix commented 5 years ago

Expected Behavior

buildSrc should compile.

Current Behavior

Build fails with an exception:

Caused by: java.lang.IllegalStateException: implementationClass must not be null
        at org.gradle.kotlin.dsl.codegen.PluginIdExtensionsKt$pluginEntriesFrom$1$2.invoke(PluginIdExtensions.kt:256)
        at org.gradle.kotlin.dsl.codegen.PluginIdExtensionsKt$pluginEntriesFrom$1$2.invoke(PluginIdExtensions.kt)
        at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:172)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:698)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:728)
        at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:719)
        at org.gradle.kotlin.dsl.codegen.PluginIdExtensionsKt.pluginEntriesFrom(PluginIdExtensions.kt:257)
        at org.gradle.kotlin.dsl.accessors.PluginAccessorsClassPathKt$pluginSpecsFrom$2.invoke(PluginAccessorsClassPath.kt:374)
        at org.gradle.kotlin.dsl.accessors.PluginAccessorsClassPathKt$pluginSpecsFrom$2.invoke(PluginAccessorsClassPath.kt)
        at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:277)
        at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:265)
        at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:176)
        at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:698)
        at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:728)
        at kotlin.sequences.SequencesKt___SequencesKt$sortedWith$1.iterator(_Sequences.kt:563)
        at org.gradle.kotlin.dsl.accessors.PluginTree$Companion.of(PluginTree.kt:65)
        at org.gradle.kotlin.dsl.accessors.PluginAccessorsClassPathKt.buildPluginAccessorsFor(PluginAccessorsClassPath.kt:107)
        at org.gradle.kotlin.dsl.accessors.PluginAccessorsClassPathKt$$special$$inlined$getOrCreateProperty$lambda$1.invoke(PluginAccessorsClassPath.kt:86)
        at org.gradle.kotlin.dsl.accessors.PluginAccessorsClassPathKt$$special$$inlined$getOrCreateProperty$lambda$1.invoke(PluginAccessorsClassPath.kt)
        at org.gradle.kotlin.dsl.accessors.AccessorsClassPathKt$cachedAccessorsClassPathFor$cacheDir$1.invoke(AccessorsClassPath.kt:102)
        at org.gradle.kotlin.dsl.accessors.AccessorsClassPathKt$cachedAccessorsClassPathFor$cacheDir$1.invoke(AccessorsClassPath.kt)

Context

I'm building a plugin in buildSrc which needs to apply other plugins. But as soon as I add this plugin dependency, build fails:

compile("com.github.jruby-gradle:jruby-gradle-plugin:1.4.0")

Steps to Reproduce (for bugs)

$ touch build.gradle.kts
$ mkdir buildSrc
$ cat << EOF >> buildSrc/build.gradle.kts

plugins {
    `kotlin-dsl`
}

repositories {
    jcenter()
}

dependencies {
    compile("com.github.jruby-gradle:jruby-gradle-plugin:1.4.0")
}
EOF
$ gradle help