Skip to content

Commit

Permalink
Fix the isolated project violation
Browse files Browse the repository at this point in the history
`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

Closes #4570

RELNOTES=Fix project isolation violation when checking that Hilt libraries are applied along the Gradle plugin.
PiperOrigin-RevId: 714428280
  • Loading branch information
ansman authored and Dagger Team committed Jan 11, 2025
1 parent 347cfe1 commit 91450da
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ExternalDependency
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
import org.gradle.api.attributes.Attribute
import org.gradle.api.provider.ProviderFactory
Expand Down Expand Up @@ -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<ExternalDependency>().map { dependency ->
dependency.group to dependency.name
}
}
.toSet()
fun getMissingDepMsg(depCoordinate: String): String =
Expand Down

0 comments on commit 91450da

Please sign in to comment.