gradle / kotlin-dsl-samples

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

precompiled-script-plugin sample is not recognized as Kotlin project in IDEA #1375

Closed gildor closed 5 years ago

gildor commented 5 years ago

precompiled-script-plugin sample is not properly imported in IDEA. If you open this sample in IDEA 2019.1, you will see that plugins src/main is not marked as source set in IDE, even worse, that also static accessors are not resolve by IDE, but work if you run plugin task

image

Expected Behavior

plugin/src/main/kotlin should be marked as source set. Typesafe accessors should have syntax highlighting and navigation

Current Behavior

src is not source set, no IDE support for any type-safe accessor

Steps to Reproduce (for bugs)

Checkout https://github.com/gradle/kotlin-dsl Open samples/precompiled-script-plugin in IDEA Add plugins block to my-plugin.gradle.kts apply plugin java try to use tasks.jar accessor or java extension

Your Environment

Gradle 5.2.1, same with Gradle 5.0 IDEA 2019.1.1

eskatos commented 5 years ago

Thanks for the report @gildor,

This sample has three builds:

When you open samples/precompiled-script-plugin in IDEA, the IDE doesn't know about the other two builds. That's why plugin/src/main/kotlin isn't exposed as a Kotlin source set to the IDE. You can open each build separately.

This setup could be changed to use composite builds in order to allow the IDE to have the context for all three builds.

As for your second observation that type-safe accessors should have syntax highlighting and navigation, yes, but support landed in Gradle 5.3, it can't work with Gradle 5.2.1. We missed to update the master branch with Gradle 5.3 wrappers. See https://github.com/gradle/kotlin-dsl/pull/1377 that will update them to 5.4.

gildor commented 5 years ago

@eskatos Sorry, I tried with 5.4, in my report I accidentally wrote 5.0 insted of 5.4, I will try again

gildor commented 5 years ago

I see now, all 3 plugins are not related, each of them is own plugin, I just now realized this, it was just a bit confusing because looked as standard multi-module gradle project

So the issue should be closed, thanks!

eskatos commented 5 years ago

Thanks @gildor! Closing