This message was deleted.
# plugin-development
s
This message was deleted.
g
For some things idea plugin gets it itself. If it's not the case I'd suggest to react to idea plugin using
pluginManager.withPlugin("idea") { .. }
and configure required source sets. One caveat that I found is that some of their newer APIs that use `FileCollection`/`FileTree` are ignored and you have to use older ones.
b
I've tried that, nothing seems to work
Copy code
pluginManager.withPlugin("idea") {
      extensions.configure(IdeaModel::class.java) { im ->
        im.module.sourceDirs = im.module.sourceDirs + extension.sourceSets.flatMap { it.sources }
        im.module.testSourceDirs = im.module.testSourceDirs + extension.sourceSets.flatMap { it.sources }
      }
    }
Unless I'm missing something here
g
You can try
it.sources.sourceDirectories
in the lambdas. Another thing is to check if you need allSources instead of sources. Also check if the result type of `flatMap`s is done collection supported by the idea plugin
b
Verified that flatMap indeed contains my directory and is of the correct type. Still no highlighting unfortunately. Do you have any examples of OSS project that does this succesfully?
g
I use it for functionalTest sourceSet since IDEA doesn't mark it as tests automatically: https://github.com/grossws/private-repo/blob/main/build-logic/src/main/kotlin/plugin-conventions.gradle.kts#L61-L69
b
Hmm, but you have luxury of having java plugin applied. My context is plain npn-java gradle scope
g
somewhere I had similar thing for generated sources but iirc it's not in the open source
yeah, it mostly with java/java-base in my case
Another thing to try is to invalidate idea caches since sometimes idea just loses it
b
I do have directories present on init. I've tried invalidating caches, but no luck 😕
g
if you have a reproducer I can try to open it in idea and look if it's the same but otherwise I've exhausted pool of ideads(