-
-
Save tbroyer/d8174f5eb99bdb7f291b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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