Idea module generatedSourceDirs broken for multiple projects

Hello there, I’m trying to using protobuf with gradle and Intellij IDEA.

Java compilation works fine, but I cannot use autocompletion features from IDEA as the generated sources are not picked up by the IDE.

The following snippet works fine:

idea {
    module {
        sourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
    }
}

while the following do not:

idea {
    module {
        generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
    }
}

To make the first works I had to change the generated folder outside of the project.buildDir as it and all of it’s subfolders are excluded from IDEA.

I’ll create a sample project if you need, but you may already know the cause of the problem.

Thank you in advance for your help :blush:

sw version
Intellij IDEA Ultimate 2016.2.5
Gradle 2.13

TODO: support markdown tables <3