https://kotlinlang.org logo
Title
k

Kirill Zhukov

03/03/2023, 9:28 PM
Any way to make property delegation work for getting source sets in custom Gradle build logic plugin?
got these imports but doesn’t seem to work:
import org.gradle.kotlin.dsl.getting
import org.gradle.kotlin.dsl.provideDelegate
d

Derek Ellis

03/03/2023, 9:47 PM
Do you have the
{}
?
val iosMain by getting {}
k

Kirill Zhukov

03/03/2023, 9:53 PM
{}
is n’t necessary if I just wanna get a source set
Adding
import org.gradle.kotlin.dsl.getValue
import works 🤪
😛inched_fingers:
a

Adam S

03/04/2023, 8:33 AM
I find often it's easier just to add a wildcard import to avoid weirdness like that
import org.gradle.kotlin.dsl.*
You can tell the IntelliJ formatter to wildcard import that package by default
k

Konstantin Tskhovrebov

03/06/2023, 11:56 AM
If your gradle build scripts are red highlighted but work fine than try to change Gradle JDK in the dialog and reimport project: