Skip to content

Avoid implicitly compiling sources from the classpath #149

@cpovirk

Description

@cpovirk

You can see some internal discussion on CL 198652081, but in short:

  • Truth depends on guava-gwt.
  • The guava-gwt jar contains .java files.
  • Truth has a test that uses Compile-Testing, and it compiles not just the file we give it but also (automatically and undesired by us) those .java files.
  • This used to work, but because Truth uses guava-android but guava-gwt uses guava-jre, Maven puts guava-android on the classpath when guava-gwt needs guava-jre and its dependencies. So now the compilation fails.

We're going to work around this by:

  • Making Truth pass -sourcepath '' to Compile-Testing.
  • Adding an explicit dependency from guava-gwt to some dependencies that it uses directly but currently gets transitively through guava-jre.

But maybe Compile-Testing should be setting -sourcepath '' internally automatically? (Or maybe there's something else similar it should be doing; I've heard that all this is surprisingly complex.)

On the other hand, probably few people will be affected by this: They won't have .java files on their classpath, and even if they do, the files will compile fine because the dependencies will be there. Still, I wonder if they will see unexpected warnings or other output in some cases. (Maybe I've seen some reports of weird Compile-Testing behavior before in AutoValue or something? I'll see if I can dig anything up.) And presumably it's at least a little wasteful to compile files that we don't need.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions