summaryrefslogtreecommitdiff
path: root/java/kotlin_test.go
AgeCommit message (Collapse)Author
2022-10-18Treat kotlin-annotations the same as kotlin-stdlibColin Cross
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 (cherry picked from commit 063544747e414f66a0bcc14ec55a3232aff1ed0d) Merged-In: Ifc33a32b121c1b9a9d1911bdec332264b78b571c
2022-05-03Add missing dependency on compose plugin in kapt rulesColin Cross
The kapt rule uses kotlincFlags but was not using kotlincDeps, causing the rule to get the -Xplugin argument on the compose compiler plugin jar, but not have a dependency on it. Bug: 231222079 Test: TestKotlinCompose Change-Id: I4c2cf30fb7d8cad4eededa29f67f4ffd459caa41 (cherry picked from commit 08b0a1cd795a3a30d45ef8ff9f52f6b58fc45304) Merged-In: I4c2cf30fb7d8cad4eededa29f67f4ffd459caa41
2022-04-06Revert "Use kapt stubs for kotlin header jar for javac"Isaac Chiou
This reverts commit c6ef4853704080b1340170c5c30046cc4dacd418. Reason for revert: Multiple systemui presubmits are broken due to this change Bug: 228262695 Change-Id: I1efed519c49d8d0583815c7bf2b3801bf0ba12fa
2022-04-04Use kapt stubs for kotlin header jar for javacColin Cross
When compling kotlin code with annotation processors we are generating java stubs for the kotlin sources using kapt, and parsing them in turbine when running the annotation processors. Passing --output to turbine will also compile the stubs into a header jar that can be used as a dependency to javac, allowing the javac and kotlinc rules to run in parallel. The turbine-apt header jar can't be used as the header jar for downstream modules as it doesn't contain the kotlin metadata needed by kotlinc rules, so the kotlinc gen-jvm-abi plugin output is still used for the module's final header jar. Test: TestKapt Bug: 222095735 Change-Id: I82d0900f3dc30f3e3ebd7cab0693dfe741d9b955
2022-04-04Enable kotlin's jvm-abi-gen plugin to generate header jarsColin Cross
Kotlin's jvm-abi-gen plugin can generate header jars similar to the turbine output for java sources, which can be used to avoid recompiling downstream modules when the ABI hasn't changed. Unlike turbine, the plugin runs as part of the main kotlinc invocation, so it doesn't allow the downstream modules to start compiling any sooner. A future possible optimization is to use turbine to compile the kapt stubs, at least for the kotlin+annotation processor modules that already generate them, which would allow compiling downstream modules before invoking kotlinc or javac, as well as invoking kotlinc and javac in parallel with each other. Bug: 222095735 Test: TestKotlin Test: m SystemUI Change-Id: Ib1bb2ecea47c851a108a26f9ed4f827f289d1321
2022-03-25Use turbine instead of kapt for kotlin annotation processorsColin Cross
Follow Bazel by using turbine instead of kapt to run annotation processors. This still requires using kapt to generate java stubs of kotlin soruces, then uses turbine to run annotation processors on the java stubs and any java sources to generate sources and resources, and passes the annotation processor generated sources to kotlinc and javac. Bug: 225013372 Test: m checkbuild Test: TestKapt Change-Id: I9c6fc496a9fba64658bb062538bc5f7b9478b07a
2021-09-20Enable compose kotlinc plugin when depending on the compose runtimeColin Cross
When a module depends on the compose runtime add a -Xplugin argument to the kotlinc flags that enables the compose compiler plugin. Bug: 196351110 Test: TestKotlinCompose Change-Id: I423a3c4d12df42804a24b672a40a165bc8dd165f
2021-07-20Replace android.BuildOs with Config.BuildOSColin Cross
Replace the android.BuildOs constant with Config.BuildOS so that it can vary based on the product config. Bug: 190084016 Test: all Soong tests Change-Id: Ia67f872d8b2ab788747a22e3a9659dc21c9775cd
2021-06-14Add a build flag to always enable errorprone per-targetCole Faust
Currently, errorprone is only run if the RUN_ERROR_PRONE enviornment variable is true. Add a flag that individual modules can use to always enable errorprone. In a followup cl, I plan to add another flag that will force all errorprone checks to be errors, so that modules can be confident that they're not ignoring any errorprone checks. Bug: 190944875 Test: New unit test and manually Change-Id: Iab0c81642ed22a736add054147829e91a891d179
2021-03-24Remove uses of buildDir from java/kotlin_test.goPaul Duffin
Remove any uses, either direct (or indirect via testJavaConfig or similar methods), of the package level buildDir variable from this file. Bug: 182885307 Test: m nothing Change-Id: Id1d449d55fe992ebc3d7bad38a76bb1652844f52
2020-11-19Support extra checks for ErrorProne in a dedicated propertyColin Cross
Previous extra checks for ErrorProne were added using the plugins proeprty to get them into the -processorpath argument. This works fine for java-only modules, but fails for mixed java+kotlin modules because the processorpath is given to kapt and not javac. Add a dedicated errorprone.extra_check_modules property (mirroring the lint.extra_check_modules property), and add that to a separate processorpath that is used only for errorprone rules and not cleared when kotlin is used. Test: TestKapt/errorprone Change-Id: Id6ef02ce758532d1df8b8d969fad83bb44fe93ab
2020-10-09Revert "Make lots of tests run in parallel"Colin Cross
This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-06Make lots of tests run in parallelColin Cross
Putting t.Parallel() in each test makes them run in parallel. Additional t.Parallel() could be added to each subtest, although that requires making a local copy of the loop variable for table driven tests. Test: m checkbuild Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-04-22Repeat kapt processor argument for multiple processorsColin Cross
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
2019-07-17Java test code clean-upJaewoong Jung
Remove unused parameters and make testJava return the config. Test: Ran all java tests. Change-Id: Iaa123f3fd93188e2f55452b887e1d340429cc710
2019-01-24Remove annotation_processors propertyColin Cross
Now that there are no uses left of annotation_processors remove the property. If there are no annotation processor classes for javac for a module, due to an empty "plugins" property or using kapt for annotation processors, pass -proc:none to javac to ensure it does not try to run any annotation processors found in the classpath. Bug: 77284273 Test: plugin_test.go, kotlin_test.go Change-Id: I3823d9fec8d3d07d2e49b1d97839f7fcbdd35647
2019-01-23Fix kotlin annotation processing after java_pluginColin Cross
I37c1e80eba71ae2d6a06199fb102194a51994989 broke kotlin annotation processing with a typo in the processors flag to kapt and by passing -processor to javac with an empty processorpath. Bug: 77284273 Bug: 122251693 Test: kotlin_test.go Test: m checkbuild Change-Id: I17c45d5b3f9df089231af5d2930646ad0e6bf9be
2019-01-23Replace annotation_processors with pluginsColin Cross
Follow bazel's modules for annotation processors by introducing a java_plugin module type that can contain extra metadata about the annotation processor, the processor class and a flag to specify if the annotation processor is compatible with the turbine optimization. Deprecate the annotation_processors property, which took a list of java_library_host modules, in favor of the plugins property, which takes a list of java_plugin modules. The annotation_processors property will be removed once all uses have been replaced with plugins. Bug: 77284273 Test: plugin_test.go Test: m caliper Change-Id: I37c1e80eba71ae2d6a06199fb102194a51994989
2019-01-22Pass annotation processors to kotlincColin Cross
Enable the kotlin-annotation-processing plugin and pass annotation processors to it. Bug: 122251693 Test: m checkbuild Test: TestKapt in kotlin_test.go Change-Id: I841df454beaaa7edd263eea714ca0d958a03c9de
2019-01-22Move kotlin to it's own fileColin Cross
kapt is going to make kotlin a little more complicated, move the rules and tests to their own files. Bug: 122251693 Test: m checkbuild Change-Id: Ieed78b97995ced210b710bd50c357514cc8e3bc6