ANTLR plugin directory issues, gradle >= 2.7

This is a follow on topic to two other topics:

We successfully use the antlr plugin to compile ANTLR4 grammars, but when I upgraded us to any gradle version >= 2.7 we got the following output:

user@dev:/srv/myproj_src$ ./gradlew test
error(7):  cannot find or open file: ../../antlr/myproj/sqlparser/SQL.g4
error(7):  cannot find or open file: ../../antlr/myproj/sqlparser/SQL.g4
:generateGrammarSource FAILED

After many hours of troubleshooting, I was able to come up with a workaround for this regression…I moved the file from src/antlr/myproj/sqlparser/SQL.g4 -> src/main/antlr/SQL.g4 and made the same trivial pathing change in my SourceSets block.

-        antlr { srcDir 'src/antlr' }
+        antlr { srcDir 'src/main/antlr' }

Hopefully someone smarter than I can use this information to determine how the directory finding stuff got FUBAR’d for ANTLR4 in gradle 2.7 as well as offer a workaround in the meantime. Perhaps its time for some test cases which use directories other than “src/main” to test pathing?

I tried it with Gradle 2.14 today and the same issue is still there. Not even forcing it with generateGrammarSource.source=file('foo') works. Problem is not limited to Antlr4 either.