Hi, is there a way to add ksp argument to all subp...
# ksp
b
Hi, is there a way to add ksp argument to all subprojects applied ksp plugin?
Copy code
project.plugins.withType(com.google.devtools.ksp.gradle.KspGradleSubplugin).whenPluginAdded {
   ksp {
      arg("key", "value")
   }
}
doesn't work, because it can't find a plugin with that type. But it's there - I tried to find it without
withType
filtering (e.g.
project.plugins.whenPluginAdded { println(it) })
it works this ugly way
Copy code
project.plugins.whenPluginAdded {
    if (it.toString().contains("com.google.devtools.ksp.gradle.KspGradleSubplugin")) {
        ksp {
            arg("key", "value")
        }
    }
}
But I don't like it
z
Copy code
project.plugins.withId("com.google.devtools.ksp") {
  // this is your callback
}
🙏 1
b
It works, thanks Zac!
e
Also:
Copy code
project.pluginManager.withPlugin("com.google.devtools.ksp") {
  // same as above
}
Using the
pluginManager
is recommended by Gradle vs the plugin container directly https://docs.gradle.org/current/dsl/org.gradle.api.plugins.PluginAware.html#org.gradle.api.plugins.PluginAware:plugins
👍 2