From 063544747e414f66a0bcc14ec55a3232aff1ed0d Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 3 May 2022 14:20:24 -0700 Subject: Treat kotlin-annotations the same as kotlin-stdlib Upgrading dagger uncovers an issue where java-only modules with kotlin-containing dependencies may see org.jetbrains.annotations.NotNull annotations. Include the kotlin-annotations in the output jar the same way kotlin-stdlib is included. Bug: 227669740 Test: TestKotlin Change-Id: Ifc33a32b121c1b9a9d1911bdec332264b78b571c --- java/kotlin_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'java/kotlin_test.go') diff --git a/java/kotlin_test.go b/java/kotlin_test.go index 435d78294..491ce2939 100644 --- a/java/kotlin_test.go +++ b/java/kotlin_test.go @@ -42,6 +42,11 @@ func TestKotlin(t *testing.T) { } `) + kotlinStdlib := ctx.ModuleForTests("kotlin-stdlib", "android_common"). + Output("turbine-combined/kotlin-stdlib.jar").Output + kotlinAnnotations := ctx.ModuleForTests("kotlin-annotations", "android_common"). + Output("turbine-combined/kotlin-annotations.jar").Output + fooKotlinc := ctx.ModuleForTests("foo", "android_common").Rule("kotlinc") fooJavac := ctx.ModuleForTests("foo", "android_common").Rule("javac") fooJar := ctx.ModuleForTests("foo", "android_common").Output("combined/foo.jar") @@ -69,6 +74,16 @@ func TestKotlin(t *testing.T) { fooJar.Inputs.Strings(), fooKotlincClasses.String()) } + if !inList(kotlinStdlib.String(), fooJar.Inputs.Strings()) { + t.Errorf("foo jar inputs %v does not contain %v", + fooJar.Inputs.Strings(), kotlinStdlib.String()) + } + + if !inList(kotlinAnnotations.String(), fooJar.Inputs.Strings()) { + t.Errorf("foo jar inputs %v does not contain %v", + fooJar.Inputs.Strings(), kotlinAnnotations.String()) + } + if !inList(fooKotlincHeaderClasses.String(), fooHeaderJar.Inputs.Strings()) { t.Errorf("foo header jar inputs %v does not contain %q", fooHeaderJar.Inputs.Strings(), fooKotlincHeaderClasses.String()) -- cgit v1.2.3-59-g8ed1b