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
This commit is contained in:
Luca Stefani
2024-10-12 17:55:31 +02:00
committed by SkyMinus
parent 3f71bc7084
commit 73a17f04e0
4 changed files with 93 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ func init() {
func registerJavaPluginBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("java_plugin", PluginFactory)
ctx.RegisterModuleType("kotlin_plugin", KotlinPluginFactory)
}
func PluginFactory() android.Module {
@@ -37,6 +38,16 @@ func PluginFactory() android.Module {
return module
}
func KotlinPluginFactory() android.Module {
module := &KotlinPlugin{}
module.addHostProperties()
InitJavaModule(module, android.HostSupported)
return module
}
// Plugin describes a java_plugin module, a host java library that will be used by javac as an annotation processor.
type Plugin struct {
Library
@@ -53,3 +64,8 @@ type PluginProperties struct {
// parallelism and cause more recompilation for modules that depend on modules that use this plugin.
Generates_api *bool
}
// Plugin describes a kotlin_plugin module, a host java/kotlin library that will be used by kotlinc as a compiler plugin.
type KotlinPlugin struct {
Library
}