Skip to content

Instantly share code, notes, and snippets.

@tbroyer
Last active August 29, 2015 14:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tbroyer/d8174f5eb99bdb7f291b to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# I'd expect the following to fail, but it works because javac will implicitly load A.java from the A_as_resource.jar.
# That wouldn't happen if javac was called with a -sourcepath.
# Proof by example: uncomment the `-sourcepath :` compiler argument and run `gradle clean build` again
#
mkdir -p A_as_resource/src/main/resources/foo/bar B_only/src/main/java/foo/bar
echo '
include "A_as_resource"
include "B_only"
' > settings.gradle
echo '
apply plugin: "java"
' > A_as_resource/build.gradle;
echo '
package foo.bar;
abstract class A {
}
' > A_as_resource/src/main/resources/foo/bar/A.java;
echo '
apply plugin: "java"
dependencies {
compile project(":A_as_resource")
}
// Uncomment to workaround bug:
// compileJava.options.compilerArgs += [ "-sourcepath", ":" ]
' > B_only/build.gradle;
echo '
package foo.bar;
class B extends A {
}
' > B_only/src/main/java/foo/bar/B.java;
gradle build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment