diff options
author | Colin Cross <ccross@android.com> | 2020-04-22 11:44:34 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2020-04-22 20:43:37 -0700 |
commit | 5a11686e64d7c6665589458a94f183d0823dc833 (patch) | |
tree | 5150006a20ea968879aecb7dc02a90f222ed206b /java/kotlin_test.go | |
parent | ff550f3e13ea87e4759898ef1a82590ca57a955b (diff) |
Repeat kapt processor argument for multiple processors
kapt claims to support a comma separated list of annotation
processors, but it errors if multiple annotation processors
are given. Surrounding the the list with {} does not error,
but it also doesn't even warn if the second element in the
list is garbage, so it may not be running the second
processor. Repeat the processor argument for each
annotation processor class instead.
Bug: 154736649
Test: TestKapt
Test: m checkbuild
Change-Id: I4c7c161dbf867d7fba1aaf16fd5e502647e3f682
Diffstat (limited to 'java/kotlin_test.go')
-rw-r--r-- | java/kotlin_test.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/java/kotlin_test.go b/java/kotlin_test.go index 5c6d45f45..60ca1c476 100644 --- a/java/kotlin_test.go +++ b/java/kotlin_test.go @@ -88,7 +88,7 @@ func TestKapt(t *testing.T) { java_library { name: "foo", srcs: ["a.java", "b.kt"], - plugins: ["bar"], + plugins: ["bar", "baz"], } java_plugin { @@ -96,6 +96,12 @@ func TestKapt(t *testing.T) { processor_class: "com.bar", srcs: ["b.java"], } + + java_plugin { + name: "baz", + processor_class: "com.baz", + srcs: ["b.java"], + } `) buildOS := android.BuildOs.String() @@ -105,6 +111,7 @@ func TestKapt(t *testing.T) { javac := ctx.ModuleForTests("foo", "android_common").Rule("javac") bar := ctx.ModuleForTests("bar", buildOS+"_common").Rule("javac").Output.String() + baz := ctx.ModuleForTests("baz", buildOS+"_common").Rule("javac").Output.String() // Test that the kotlin and java sources are passed to kapt and kotlinc if len(kapt.Inputs) != 2 || kapt.Inputs[0].String() != "a.java" || kapt.Inputs[1].String() != "b.kt" { @@ -136,11 +143,12 @@ func TestKapt(t *testing.T) { } // Test that the processors are passed to kapt - expectedProcessorPath := "-P plugin:org.jetbrains.kotlin.kapt3:apclasspath=" + bar + expectedProcessorPath := "-P plugin:org.jetbrains.kotlin.kapt3:apclasspath=" + bar + + " -P plugin:org.jetbrains.kotlin.kapt3:apclasspath=" + baz if kapt.Args["kaptProcessorPath"] != expectedProcessorPath { t.Errorf("expected kaptProcessorPath %q, got %q", expectedProcessorPath, kapt.Args["kaptProcessorPath"]) } - expectedProcessor := "-P plugin:org.jetbrains.kotlin.kapt3:processors=com.bar" + expectedProcessor := "-P plugin:org.jetbrains.kotlin.kapt3:processors=com.bar -P plugin:org.jetbrains.kotlin.kapt3:processors=com.baz" if kapt.Args["kaptProcessor"] != expectedProcessor { t.Errorf("expected kaptProcessor %q, got %q", expectedProcessor, kapt.Args["kaptProcessor"]) } |