Thanks for the reply.
How about defaulting to an empty sourcepath with the ability to ‘null’ it out and revert to javac’s default behavior?
Something like ‘CompileOptions.sourcepath’ defaulting to either the empty string or ‘File.pathSeparator’ or an empty ‘FileCollection’, and allowing people to set it to ‘null’ or ‘task.classpath’ to revert to the “no sourcepath” or “sourcepath == classpath” behavior.
Alternatively, defining a ‘CompileOptions.sourcepath’ property, even defaulting to null, to make it easier to change the sourcepath (rather than adding to ‘compilerArgs’), would be a welcome addition.
But honestly, with such a “high-level” tool like Gradle, I can’t imagine any reason why you’d want the “sourcepath == classpath” behavior: with dependency management that also resolves transitive dependencies, people don’t really check what’s in their classpath (bad practice but we can’t blame them, we all just throw a bunch of “dependencies.compile ‘somelib:somelib’” in our build scripts without running ‘./gradlew dependencies’ and checking the content of the JARs, and/or setting up a blessed repo manager where only verified dependencies are ever deployed); the “principle of least surprise” would dictate that the build fails if compiled sources reference anything not in ‘.class’ form in the classpath.
Following that principle, you’d at least use ‘-implicit:none’ to avoid getting ‘.class’ files for sources implicitly recompiled from your classpath.