diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2017-03-03 11:03:08 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2017-03-06 09:43:57 +0000 |
commit | 7b295d34f3a4f42c13aafc1cc8afba3cb4aa2985 (patch) | |
tree | 7fceaeedcb83832be01178b9676b2029c8a5b018 /src/test | |
parent | 2697dd3e7f3b66918a2a3aa5a74144cf0c5a61f0 (diff) |
Pass through -sourcepath to the JavaBuilder
Fix #2606.
--
PiperOrigin-RevId: 149096656
MOS_MIGRATED_REVID=149096656
Diffstat (limited to 'src/test')
-rwxr-xr-x | src/test/shell/bazel/bazel_java_test.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/shell/bazel/bazel_java_test.sh b/src/test/shell/bazel/bazel_java_test.sh index 1ce5184edd..df5eae4ec9 100755 --- a/src/test/shell/bazel/bazel_java_test.sh +++ b/src/test/shell/bazel/bazel_java_test.sh @@ -105,6 +105,45 @@ function test_build_hello_world() { bazel build //java/main:main &> $TEST_log || fail "build failed" } +# Regression test for #2606: support for passing -sourcepath +# TODO(#2606): Update when a final solution is found for #2606. +function test_build_with_sourcepath() { + mkdir -p g + cat >g/A.java <<'EOF' +package g; +public class A { + public A() { + new B(); + } +} +EOF + + cat >g/B.java <<'EOF' +package g; +public class B { + public B() { + } +} +EOF + + cat >g/BUILD <<'EOF' +genrule( + name = "stub", + srcs = ["B.java"], + outs = ["B.jar"], + cmd = "zip $@ $(SRCS)", +) + +java_library( + name = "test", + srcs = ["A.java"], + javacopts = ["-sourcepath $(GENDIR)/$(location :stub)", "-implicit:none"], + deps = [":stub"] +) +EOF + bazel build //g:test >$TEST_log || fail "Failed to build //g:test" +} + # Runfiles is disabled by default on Windows, but we can test it on Unix by # adding flag --experimental_enable_runfiles=0 function test_build_and_run_hello_world_without_runfiles() { |