Start migrating Anvil KSP to Metro
This commit is contained in:
parent
d4d57b1e21
commit
b76a71ebf5
703 changed files with 3523 additions and 2820 deletions
|
|
@ -10,6 +10,7 @@ plugins {
|
|||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
|
@ -23,6 +24,7 @@ dependencies {
|
|||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
|
||||
implementation(libs.autonomousapps.dependencyanalysis.plugin)
|
||||
implementation(libs.anvil.gradle.plugin)
|
||||
implementation(libs.metro.gradle.plugin)
|
||||
implementation(libs.ksp.gradle.plugin)
|
||||
implementation(libs.compose.compiler.plugin)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ rootProject.name = "ElementX_plugins"
|
|||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
versionCatalogs {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
package extension
|
||||
|
||||
import com.squareup.anvil.plugin.AnvilExtension
|
||||
import dev.zacsweers.metro.gradle.MetroPluginExtension
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
|
|
@ -28,30 +28,40 @@ fun Project.setupAnvil(
|
|||
) {
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
// Add dagger dependency, needed for generated code
|
||||
dependencies.implementation(libs.dagger)
|
||||
// // Add dagger dependency, needed for generated code
|
||||
// dependencies.implementation(libs.dagger)
|
||||
|
||||
// Apply Anvil plugin and configure it
|
||||
applyPluginIfNeeded(libs.plugins.anvil)
|
||||
applyPluginIfNeeded(libs.plugins.metro)
|
||||
applyPluginIfNeeded(libs.plugins.ksp)
|
||||
|
||||
project.pluginManager.withPlugin(libs.plugins.anvil.get().pluginId) {
|
||||
// project.pluginManager.withPlugin(libs.plugins.anvil.get().pluginId) {
|
||||
// // Setup extension
|
||||
// extensions.configure(AnvilExtension::class.java) {
|
||||
// this.generateDaggerFactories.set(generateDaggerFactoriesUsingAnvil)
|
||||
// this.disableComponentMerging.set(componentMergingStrategy == ComponentMergingStrategy.NONE)
|
||||
//
|
||||
// useKsp(
|
||||
// contributesAndFactoryGeneration = true,
|
||||
// componentMerging = componentMergingStrategy == ComponentMergingStrategy.KSP,
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (generateDaggerCode) {
|
||||
// // Needed at the top level since dagger code should be generated at a single point for performance reasons
|
||||
// dependencies.add("ksp", libs.dagger.compiler)
|
||||
// }
|
||||
|
||||
project.pluginManager.withPlugin(libs.plugins.metro.get().pluginId) {
|
||||
// Setup extension
|
||||
extensions.configure(AnvilExtension::class.java) {
|
||||
this.generateDaggerFactories.set(generateDaggerFactoriesUsingAnvil)
|
||||
this.disableComponentMerging.set(componentMergingStrategy == ComponentMergingStrategy.NONE)
|
||||
|
||||
useKsp(
|
||||
contributesAndFactoryGeneration = true,
|
||||
componentMerging = componentMergingStrategy == ComponentMergingStrategy.KSP,
|
||||
)
|
||||
extensions.configure(MetroPluginExtension::class.java) {
|
||||
// debug.set(true)
|
||||
// generateAssistedFactories.set(true)
|
||||
// this.generateAssistedFactories.set(generateDaggerFactoriesUsingAnvil)
|
||||
}
|
||||
}
|
||||
|
||||
if (generateDaggerCode) {
|
||||
// Needed at the top level since dagger code should be generated at a single point for performance reasons
|
||||
dependencies.add("ksp", libs.dagger.compiler)
|
||||
}
|
||||
|
||||
// These dependencies are only needed for compose library or application modules
|
||||
if (project.pluginManager.hasPlugin("io.element.android-compose-library")
|
||||
|| project.pluginManager.hasPlugin("io.element.android-compose-application")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue