Skip to content

Commit

Permalink
Move configuration of generator modules to precompiled script plugin (#3
Browse files Browse the repository at this point in the history
)
  • Loading branch information
illarionov authored Jan 13, 2024
1 parent 8ed2059 commit 6db8234
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 101 deletions.
21 changes: 1 addition & 20 deletions activity/generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,8 @@
*/

plugins {
id("ru.pixnews.anvil.codegen.build-logic.project.kotlin.library")
id("ru.pixnews.anvil.codegen.build-logic.project.test")
id("ru.pixnews.anvil.codegen.build-logic.project.publish")
kotlin("kapt")
id("ru.pixnews.anvil.codegen.build-logic.project.generator")
}

group = "ru.pixnews.anvil.codegen.activity.generator"
version = "0.1-SNAPSHOT"

dependencies {
api(libs.anvil.compiler.api)
implementation(libs.anvil.compiler.utils)
implementation(libs.kotlinpoet) { exclude(module = "kotlin-reflect") }
implementation(projects.common)

compileOnly(libs.auto.service.annotations)
kapt(libs.auto.service.compiler)

testImplementation(libs.anvil.annotations.optional)
testImplementation(libs.assertk)
testImplementation(libs.dagger)
testImplementation(projects.testUtils)
testImplementation(testFixtures(libs.anvil.compiler.utils))
}
21 changes: 1 addition & 20 deletions experiment/generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,8 @@
*/

plugins {
id("ru.pixnews.anvil.codegen.build-logic.project.kotlin.library")
id("ru.pixnews.anvil.codegen.build-logic.project.test")
id("ru.pixnews.anvil.codegen.build-logic.project.publish")
kotlin("kapt")
id("ru.pixnews.anvil.codegen.build-logic.project.generator")
}

group = "ru.pixnews.anvil.codegen.experiment.generator"
version = "0.1-SNAPSHOT"

dependencies {
api(libs.anvil.compiler.api)
implementation(libs.anvil.compiler.utils)
implementation(libs.kotlinpoet) { exclude(module = "kotlin-reflect") }
implementation(projects.common)

compileOnly(libs.auto.service.annotations)
kapt(libs.auto.service.compiler)

testImplementation(libs.anvil.annotations.optional)
testImplementation(libs.assertk)
testImplementation(libs.dagger)
testImplementation(projects.testUtils)
testImplementation(testFixtures(libs.anvil.compiler.utils))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024, the pixnews-anvil-codegen project authors and contributors.
* Please see the AUTHORS file for details.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/

import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin

/**
* Convention plugin that adds Auto-Service
*/
plugins {
`java-library`
kotlin("kapt")
}

plugins.withType<KotlinBasePlugin> {
dependencies {
val libs = versionCatalogs.named("libs")
compileOnly(libs.findLibrary("auto.service.annotations").get())
add("kapt", libs.findLibrary("auto.service.compiler").get())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2024, the pixnews-anvil-codegen project authors and contributors.
* Please see the AUTHORS file for details.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/

import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo

/**
* Convention plugin for use in kotlin generator modules
*/
plugins {
id("ru.pixnews.anvil.codegen.build-logic.project.auto.service")
id("ru.pixnews.anvil.codegen.build-logic.project.kotlin.library")
id("ru.pixnews.anvil.codegen.build-logic.project.publish")
id("ru.pixnews.anvil.codegen.build-logic.project.test")
}

dependencies {
val libs = versionCatalogs.named("libs")

api(libs.findLibrary("anvil.compiler.api").get())
addDependencyTo<ModuleDependency>(
this,
"implementation",
libs.findLibrary("kotlinpoet").get().get(),
) {
exclude(module = "kotlin-reflect")
}
implementation(project(":common"))

testImplementation(libs.findLibrary("anvil.annotations.optional").get())
testImplementation(libs.findLibrary("assertk").get())
testImplementation(libs.findLibrary("dagger").get())
testImplementation(project(":test-utils"))
testImplementation(testFixtures(libs.findLibrary("anvil.compiler.utils").get()))
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright (c) 2024, the pixnews-anvil-codegen project authors and contributors.
* Please see the AUTHORS file for details.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/

import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ testing {
"assertk",
"junit.jupiter.api",
"junit.jupiter.params",
"kotlin.compile.testing",
).forEach {
implementation(libs.findLibrary(it).get())
}
Expand Down
5 changes: 5 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@
<pgp value="719F7C29985A8E95F58F47194D8159D6A1159B69"/>
</artifact>
</component>
<component group="io.github.classgraph" name="classgraph" version="4.8.161">
<artifact name="classgraph-4.8.161.jar">
<pgp value="1F47744C9B6E14F2049C2857F1F111AF65925306"/>
</artifact>
</component>
<component group="io.github.classgraph" name="classgraph" version="4.8.162">
<artifact name="classgraph-4.8.162.jar">
<pgp value="1F47744C9B6E14F2049C2857F1F111AF65925306"/>
Expand Down
21 changes: 1 addition & 20 deletions initializer/generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,8 @@
*/

plugins {
id("ru.pixnews.anvil.codegen.build-logic.project.kotlin.library")
id("ru.pixnews.anvil.codegen.build-logic.project.test")
id("ru.pixnews.anvil.codegen.build-logic.project.publish")
kotlin("kapt")
id("ru.pixnews.anvil.codegen.build-logic.project.generator")
}

group = "ru.pixnews.anvil.codegen.initializer.generator"
version = "0.1-SNAPSHOT"

dependencies {
api(libs.anvil.compiler.api)
implementation(libs.anvil.compiler.utils)
implementation(libs.kotlinpoet) { exclude(module = "kotlin-reflect") }
implementation(projects.common)

compileOnly(libs.auto.service.annotations)
kapt(libs.auto.service.compiler)

testImplementation(libs.anvil.annotations.optional)
testImplementation(libs.assertk)
testImplementation(libs.dagger)
testImplementation(projects.testUtils)
testImplementation(testFixtures(libs.anvil.compiler.utils))
}
21 changes: 1 addition & 20 deletions viewmodel/generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,8 @@
*/

plugins {
id("ru.pixnews.anvil.codegen.build-logic.project.kotlin.library")
id("ru.pixnews.anvil.codegen.build-logic.project.test")
id("ru.pixnews.anvil.codegen.build-logic.project.publish")
kotlin("kapt")
id("ru.pixnews.anvil.codegen.build-logic.project.generator")
}

group = "ru.pixnews.anvil.codegen.viewmodel.generator"
version = "0.1-SNAPSHOT"

dependencies {
api(libs.anvil.compiler.api)
implementation(libs.anvil.compiler.utils)
implementation(libs.kotlinpoet) { exclude(module = "kotlin-reflect") }
implementation(projects.common)

compileOnly(libs.auto.service.annotations)
kapt(libs.auto.service.compiler)

testImplementation(libs.anvil.annotations.optional)
testImplementation(libs.assertk)
testImplementation(libs.dagger)
testImplementation(projects.testUtils)
testImplementation(testFixtures(libs.anvil.compiler.utils))
}
21 changes: 1 addition & 20 deletions workmanager/generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,8 @@
*/

plugins {
id("ru.pixnews.anvil.codegen.build-logic.project.kotlin.library")
id("ru.pixnews.anvil.codegen.build-logic.project.test")
id("ru.pixnews.anvil.codegen.build-logic.project.publish")
kotlin("kapt")
id("ru.pixnews.anvil.codegen.build-logic.project.generator")
}

group = "ru.pixnews.anvil.codegen.workamanger.generator"
version = "0.1-SNAPSHOT"

dependencies {
api(libs.anvil.compiler.api)
implementation(libs.anvil.compiler.utils)
implementation(libs.kotlinpoet) { exclude(module = "kotlin-reflect") }
implementation(projects.common)

compileOnly(libs.auto.service.annotations)
kapt(libs.auto.service.compiler)

testImplementation(libs.anvil.annotations.optional)
testImplementation(libs.assertk)
testImplementation(libs.dagger)
testImplementation(projects.testUtils)
testImplementation(testFixtures(libs.anvil.compiler.utils))
}

0 comments on commit 6db8234

Please sign in to comment.