Create a gist now

Instantly share code, notes, and snippets.

#!/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: copy the javac command from the output and add `-sourcepath :`
#
mkdir -p src/foo/bar
echo '
[java]
src_roots = /src/
' > .buckconfig
echo '
package foo.bar;
abstract class A {
}
' > src/foo/bar/A.java;
echo '
package foo.bar;
class B extends A {
}
' > src/foo/bar/B.java;
echo '
java_library(
name = "A_as_resource",
resources = ["A.java"],
)
java_library(
name = "B_only",
srcs = ["B.java"],
deps = [
":A_as_resource",
],
)
' > src/foo/bar/BUCK;
buck build -v 10 //src/foo/bar:B_only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment