gradle / kotlin-dsl-samples

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

Cannot apply external plugin in precompiled script plugin #1376

Closed gildor closed 5 years ago

gildor commented 5 years ago

Precompiled scrip plugins now support plugins DSL and type-safe accessors: https://github.com/gradle/kotlin-dsl/issues/673

Accessors work properly if I add a plugin to depenencies of buildSrc/build.gradle, but if I try to define plugin like plugins{ id("some.plugin") version "1.0" } I'm getting error Plugin with id 'some.plugin' not found

It looks that version is ignored and Gradle tries to apply it without version, just as some existing plugin.

If you add this plugin to buildSrc/build.gradle dependencies everything work as expected

Expected Behavior

It should be possible to define external plugin with version in precompiled script plugin using plugins dsl

Current Behavior

You cannot apply external plugin to precompiled script plugins using plugins dsl, you still should use buildSrc dependencies for that

Steps to Reproduce (for bugs)

Apply any third party plugin to precompiled script plugin plugins dsl using plugin id and version Run ./gradlew tasks

Your Environment

Gradle 5.4

eskatos commented 5 years ago

This is working as intended, precompiled script plugins cannot declare plugin versions in their plugins block. The fact that it is ignored is a bug, it should be enforced that there's no version declaration.

Also see https://github.com/gradle/kotlin-dsl/issues/430 that will allow using plugin coordinates to declare the dependencies to plugins.

eskatos commented 5 years ago

Thanks for the report @gildor, I opened https://github.com/gradle/kotlin-dsl/issues/1378 and will close this one.