Skip to content

Commit

Permalink
Move all third-party support into a separate directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ansman committed Apr 12, 2024
1 parent d4160bc commit 3f39b57
Show file tree
Hide file tree
Showing 61 changed files with 34 additions and 24 deletions.
6 changes: 3 additions & 3 deletions compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ plugins {

dependencies {
implementation(projects.core)
implementation(projects.retrofit)
implementation(projects.androidx.room)
implementation(projects.android.testing)
implementation(projects.thirdParty.retrofit)
implementation(projects.thirdParty.androidx.room)
implementation(projects.thirdParty.android.testing)
testFixturesApi(projects.compiler.common.testUtils)
}
4 changes: 3 additions & 1 deletion gradle-plugin/src/main/kotlin/library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ pluginManager.withPlugin("com.android.base") {
minSdk = libs.versions.android.minSdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
namespace = (rootProject.group as String) + project.path.replace(':', '.')
namespace = (rootProject.group as String) + project.path
.removePrefix(":third-party")
.replace(':', '.')
buildFeatures {
buildConfig = false
resValues = false
Expand Down
28 changes: 18 additions & 10 deletions gradle-plugin/src/main/kotlin/library.publishing.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.internal.scope.ProjectInfo.Companion.getBaseName
import com.github.jengelman.gradle.plugins.shadow.ShadowExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
Expand All @@ -18,7 +19,10 @@ plugins {

val libs = the<LibrariesForLibs>()

archivesName.set(project.path.removePrefix(":").replace(':', '-'))
archivesName.set(project.path
.removePrefix(":third-party")
.removePrefix(":")
.replace(':', '-'))

val gitCommit = cachedProvider {
project.execWithOutput {
Expand Down Expand Up @@ -107,15 +111,19 @@ val sourcesJar by tasks.registering(Jar::class) {

val publication = publishing.publications.register<MavenPublication>("autoDagger") {
groupId = rootProject.group as String
artifactId = project.path.removePrefix(":").replace(':', '-')
artifactId = project.path
.removePrefix(":third-party")
.removePrefix(":")
.replace(':', '-')
version = providers.gradleProperty("version").get()
artifact(sourcesJar)
artifact(javadocJar)
pom {
val moduleName = project.path
.removePrefix(":third-party")
.removePrefix(":")
.splitToSequence(":")
.joinToString { it.replaceFirstChar(Char::uppercaseChar) }
.joinToString(" ") { it.replaceFirstChar(Char::uppercaseChar) }

name.set("Auto Dagger $moduleName")
description.set("Automatic Dagger setup using Hilt")
Expand Down Expand Up @@ -205,12 +213,12 @@ afterEvaluate {
dependsOn("classes")
from(project.extensions.getByType<SourceSetContainer>().getByName("main").allSource)
}
if (pluginManager.hasPlugin("java-test-fixture")) {
// Disables publishing test fixtures:
// https://docs.gradle.org/current/userguide/java_testing.html#ex-disable-publishing-of-test-fixtures-variants
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["testFixturesApiElements"]) { skip() }
javaComponent.withVariantsFromConfiguration(configurations["testFixturesRuntimeElements"]) { skip() }
}
}
}
pluginManager.withPlugin("org.gradle.java-test-fixtures") {
// Disables publishing test fixtures:
// https://docs.gradle.org/current/userguide/java_testing.html#ex-disable-publishing-of-test-fixtures-variants
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["testFixturesApiElements"]) { skip() }
javaComponent.withVariantsFromConfiguration(configurations["testFixturesRuntimeElements"]) { skip() }
}
10 changes: 5 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ includeBuild("gradle-plugin")
rootProject.name = "auto-dagger"

include(":core")
include(":android")
include(":android:testing")
include(":compiler")
include(":compiler:common")
include(":compiler:common:test-utils")
include(":retrofit")
include(":androidx:viewmodel")
include(":androidx:room")
include(":third-party:android")
include(":third-party:android:testing")
include(":third-party:retrofit")
include(":third-party:androidx:viewmodel")
include(":third-party:androidx:room")
include(":tests")
10 changes: 5 additions & 5 deletions tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ androidComponents {
}

dependencies {
implementation(projects.android)
implementation(projects.androidx.viewmodel)
implementation(projects.androidx.room)
implementation(projects.retrofit)
implementation(libs.retrofit.moshi)
implementation(projects.android.testing)
implementation(libs.dagger.hilt.android)
"kaptJava"(projects.compiler)
"kspKotlin"(projects.compiler)
Expand All @@ -55,6 +50,11 @@ dependencies {
"kspKotlin"(libs.dagger.hilt.compiler)

// Third party
implementation(projects.thirdParty.android.testing)
implementation(projects.thirdParty.android)
implementation(projects.thirdParty.androidx.viewmodel)
implementation(projects.thirdParty.androidx.room)
implementation(projects.thirdParty.retrofit)
implementation(libs.retrofit)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.room)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3f39b57

Please sign in to comment.