Explicitly empty sourcepath regression

Pepper Lebeck-Jobe pepper at gradle.com
Fri Jun 16 04:07:54 UTC 2017


I'll start with a question, and then give an opinion.

*Question*
Why must the source files which make up a module be on the source path for
the module to be compiled?

*Opinion*
Build tools, especially Gradle, attempt to make reproducible builds a
reality. One thing these tools offer is fine-grained control over the set
of java files which will be passed to javac for compilation. Historically,
we have even explicitly set the `-sourcepath` to be empty to tell the
compiler not to look for source files on the classpath or in the current
working directory. Combining this with an exact specification of which java
files should be compiled supports a few important use cases:

   1. You can exclude experimental sources (not yet ready to compile)
   easily to unblock local development without fear that they will break the
   build.
   2. You can set up build logic to dynamically include or exclude specific
   files without having to copy those files around to various directories
   which are or are not on the source path, so that you can produce different
   variations of a library from the original sources.

We feel that having to isolate the files which make up a module into
directories on the `-sourcepath` would limit the flexibility of the build
system, and, possibly hurt reproducibility of the builds.

*Reproduction*
In case anyone on the list doesn't understand what I mean when I say that
module source files are required to be on the source path, I've created a
tiny GitHub repo <https://github.com/eljobe/modules/blob/master/README.md>,
with instructions on reproducing what I'm seeing.

Thanks for your consideration,
Pepper

[image: Email-Signature at 2x.png]

Pepper Lebeck-Jobe

Principal Engineer

Gradle Inc.

P. +1 (919) 439-7557 <(919)%20439-7557>

W. gradle.com <https://www.gradle.com/>

Gradle Summit is now open

Click HERE to register <https://summit.gradle.com/>


More information about the jigsaw-dev mailing list