summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2020-05-28 11:09:31 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-05-28 11:09:31 +0000
commitf455d1fb0a1d732ce9c0e29485c6c9c39c728e2d (patch)
tree6665cb41b036c955d2269d10992385c4ac3a1a6b /java/java_test.go
parent9a37d4a60236221ed30a65cc9eddb9d27bc7fedc (diff)
parent932cdfeb062032b98e237a005a634446a23acd19 (diff)
Merge "Add default_to_stubs option to java_sdk_library"
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 9266d295d..8ea34d975 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1465,6 +1465,33 @@ func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
`)
}
+func TestJavaSdkLibrary_DefaultToStubs(t *testing.T) {
+ ctx, _ := testJava(t, `
+ java_sdk_library {
+ name: "foo",
+ srcs: ["a.java"],
+ system: {
+ enabled: true,
+ },
+ default_to_stubs: true,
+ }
+
+ java_library {
+ name: "baz",
+ srcs: ["a.java"],
+ libs: ["foo"],
+ // does not have sdk_version set, should fallback to module,
+ // which will then fallback to system because the module scope
+ // is not enabled.
+ }
+ `)
+ // The baz library should depend on the system stubs jar.
+ bazLibrary := ctx.ModuleForTests("baz", "android_common").Rule("javac")
+ if expected, actual := `^-classpath .*:/[^:]*/turbine-combined/foo\.stubs.system\.jar$`, bazLibrary.Args["classpath"]; !regexp.MustCompile(expected).MatchString(actual) {
+ t.Errorf("expected %q, found %#q", expected, actual)
+ }
+}
+
var compilerFlagsTestCases = []struct {
in string
out bool