From 5ae1756e47ac97d5ea476cfe0d7d0d09985e2f09 Mon Sep 17 00:00:00 2001 From: Nicklas Ansman Date: Fri, 10 Jan 2025 12:32:33 -0500 Subject: [PATCH] Fix the isolated project violation Dependency.group would be accessed which, for project dependencies, would cause an isolated project violation. Now project dependencies are filtered out. This partially fixes #4423 --- .../kotlin/dagger/hilt/android/plugin/HiltGradlePlugin.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/dagger/hilt/android/plugin/main/src/main/kotlin/dagger/hilt/android/plugin/HiltGradlePlugin.kt b/java/dagger/hilt/android/plugin/main/src/main/kotlin/dagger/hilt/android/plugin/HiltGradlePlugin.kt index 34a80d1f5eb..56ade4ee276 100644 --- a/java/dagger/hilt/android/plugin/main/src/main/kotlin/dagger/hilt/android/plugin/HiltGradlePlugin.kt +++ b/java/dagger/hilt/android/plugin/main/src/main/kotlin/dagger/hilt/android/plugin/HiltGradlePlugin.kt @@ -52,6 +52,7 @@ import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.component.ProjectComponentIdentifier +import org.gradle.api.artifacts.ExternalDependency import org.gradle.api.attributes.Attribute import org.gradle.api.provider.ProviderFactory import org.gradle.api.tasks.compile.JavaCompile @@ -421,7 +422,9 @@ class HiltGradlePlugin @Inject constructor(private val providers: ProviderFactor it.name.startsWith("hiltAnnotationProcessor") || it.name.startsWith("hiltCompileOnly") } .flatMap { configuration -> - configuration.dependencies.map { dependency -> dependency.group to dependency.name } + configuration.dependencies + .filterIsInstance() + .map { dependency -> dependency.group to dependency.name } } .toSet() fun getMissingDepMsg(depCoordinate: String): String =