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:
@@ -61,6 +61,7 @@ func init() {
|
||||
AddNeverAllowRules(createJavaExcludeStaticLibsRule())
|
||||
AddNeverAllowRules(createProhibitHeaderOnlyRule())
|
||||
AddNeverAllowRules(createLimitNdkExportRule()...)
|
||||
AddNeverAllowRules(createKotlinPluginRule()...)
|
||||
}
|
||||
|
||||
// Add a NeverAllow rule to the set of rules to apply.
|
||||
@@ -284,6 +285,22 @@ func createLimitNdkExportRule() []Rule {
|
||||
}
|
||||
}
|
||||
|
||||
func createKotlinPluginRule() []Rule {
|
||||
kotlinPluginProjectsAllowedList := []string{
|
||||
// TODO: Migrate compose plugin to the bundled compiler plugin
|
||||
// Actual path prebuilts/sdk/current/androidx/m2repository/androidx/compose/compiler/compiler-hosted
|
||||
"prebuilts/sdk/current/androidx",
|
||||
"external/kotlinc",
|
||||
}
|
||||
|
||||
return []Rule{
|
||||
NeverAllow().
|
||||
NotIn(kotlinPluginProjectsAllowedList...).
|
||||
ModuleType("kotlin_plugin").
|
||||
Because("kotlin_plugin can only be used in allowed projects"),
|
||||
}
|
||||
}
|
||||
|
||||
func neverallowMutator(ctx BottomUpMutatorContext) {
|
||||
m, ok := ctx.Module().(Module)
|
||||
if !ok {
|
||||
|
Reference in New Issue
Block a user