works perfectly in gradle 4.9, but in 4.10 rc1 and 4.10rc2 gives the following error:
Line 5: java.sourceSets["main"].java {
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val Project.sourceSets: SourceSetContainer defined in org.gradle.kotlin.dsl
Has this changed? If so, is there any doco on the change?
The source set container can now be accessed using project.sourceSets , or just sourceSets . Previously it was located at project.java.sourceSets , or just java.sourceSets .
But perseverance that comes from the confidence of you post helps.
Strangely - switch back to gradle wrapper to use the new version… and i get the error
But using just 'sourceSets[“main”] yeilds
and project.sourceSets[“main”] also yields Script compilation error:
Line XX: project.sourceSets["main"].java {
^ Unresolved reference: sourceSets
1 error
However, then I launch the build directly, rather than click the ‘reload’ when a change is detected…and then the build passes!
Seems it takes Intellij an extra run to ripple through the changes? Still highlights as an error, but works after first run.
First try, the new source is not actually brought into the project. No highlighting as a source folder. Modify to do a dummy change, rebuild and it does work. Source folder shown, app builds.
There must still be some adjustment to get all correct as source syntax highlighting still shows as an error.
Thanks again. Wonder how I get the syntax highlight to play nice,
I believe that that IDEA needs to update to be able to get the new script context from Gradle to be able to appropriately suggest auto-completion. This means the script needs to be compilable.
The sourceSets piece gets generated based on applied plugins in plugins {}. If IDEA refresh or auto-refresh doesn’t work, sometimes I need to go nuclear and run the Invalidate and Restart to completely flush IDEA.
If you have a good way to reproduce it, I would suggest opening an issue.