Fix dependency resolution for plugins in buildSrc

This commit is contained in:
Tad Fisher
2020-04-27 17:42:58 -07:00
parent 23cb225ccf
commit dd5d60e835
16 changed files with 761 additions and 331 deletions

View File

@@ -52,12 +52,12 @@ internal class ConfigurationResolver(
private val ivy = Ivy.newInstance(ivySettings)
fun resolve(configuration: Configuration): List<DefaultArtifact> {
val resolved = configuration.resolvedConfiguration
val resolved = configuration.resolvedConfiguration.lenientConfiguration
val topLevelMetadata = resolved.firstLevelModuleDependencies
.flatMap { resolveMetadata(it.moduleGroup, it.moduleName, it.moduleVersion) }
val allArtifacts = resolved.resolvedArtifacts
val allArtifacts = resolved.artifacts
.filter { it.id.componentIdentifier is ModuleComponentIdentifier }
.flatMap(::resolve)
@@ -205,7 +205,7 @@ internal class ConfigurationResolver(
val seen = mutableSetOf<ComponentArtifactIdentifier>()
return generateSequence(listOf(this)) { descs ->
val parents = descs.flatMap { it.parentDescriptors(seen) }
seen.addAll(parents.map(ResolvedArtifactResult::id))
seen.addAll(parents.map(ResolvedArtifactResult::getId))
parents.takeUnless { it.isEmpty() }
}.flatten().distinct().toList()
}

View File

@@ -10,8 +10,9 @@ internal open class PluginResolver @Inject constructor(
) {
private val configurations = pluginDependencyResolutionServices.configurationContainer
private val resolver = ConfigurationResolverFactory(pluginDependencyResolutionServices.resolveRepositoryHandler)
.create(pluginDependencyResolutionServices.dependencyHandler)
private val resolver = ConfigurationResolverFactory(
pluginDependencyResolutionServices.resolveRepositoryHandler
).create(pluginDependencyResolutionServices.dependencyHandler)
fun resolve(pluginRequests: List<PluginRequest>): List<DefaultArtifact> {
val markerDependencies = pluginRequests.map {