summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Luca Stefani <luca.stefani.ge1@gmail.com> 2024-10-12 17:55:31 +0200
committer Luca Stefani <luca.stefani.ge1@gmail.com> 2024-10-17 21:01:28 +0200
commit50098f775360a2b49ac981685dffb45366722b97 (patch)
treee9d86852f738baae570b1bdfbdcfa7b4c917b354 /java/base.go
parent991d11df34cc11d0dd71c8e4334fc3fc9e28e054 (diff)
Add support for kotlin plugins
Use the already existing hooks used by the compose compiler plugin to support kotlin plugins bundled alongside the compiler such as kotlin-serialize-compiler Test: m, sample app with kotlin-serialize-compiler Change-Id: I4d5fa6cd42acfc90ef437222e9e07f61c259d565
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/java/base.go b/java/base.go
index a9399cbd3..19f6c5d09 100644
--- a/java/base.go
+++ b/java/base.go
@@ -113,6 +113,9 @@ type CommonProperties struct {
// List of modules to use as annotation processors
Plugins []string
+ // List of modules to use as kotlin plugin
+ Kotlin_plugins []string
+
// List of modules to export to libraries that directly depend on this library as annotation
// processors. Note that if the plugins set generates_api: true this will disable the turbine
// optimization on modules that depend on this module, which will reduce parallelism and cause
@@ -872,6 +875,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
}
ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), pluginTag, j.properties.Plugins...)
+ ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), kotlinPluginTag, j.properties.Kotlin_plugins...)
ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), errorpronePluginTag, j.properties.Errorprone.Extra_check_modules...)
ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), exportedPluginTag, j.properties.Exported_plugins...)
@@ -904,7 +908,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if j.useCompose(ctx) {
ctx.AddVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), kotlinPluginTag,
- "androidx.compose.compiler_compiler-hosted")
+ "androidx.compose.compiler_compiler-hosted-plugin")
}
}
@@ -2499,7 +2503,11 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
ctx.PropertyErrorf("exported_plugins", "%q is not a java_plugin module", otherName)
}
case kotlinPluginTag:
- deps.kotlinPlugins = append(deps.kotlinPlugins, dep.ImplementationAndResourcesJars...)
+ if _, ok := module.(*KotlinPlugin); ok {
+ deps.kotlinPlugins = append(deps.kotlinPlugins, dep.ImplementationAndResourcesJars...)
+ } else {
+ ctx.PropertyErrorf("kotlin_plugins", "%q is not a kotlin_plugin module", otherName)
+ }
case syspropPublicStubDepTag:
// This is a sysprop implementation library, forward the JavaInfoProvider from
// the corresponding sysprop public stub library as SyspropPublicStubInfoProvider.