[Gradle] Remove applyToConfiguration
After removing scoped metadata configurations method GranularMetadataTransformation.applyToConfiguration is no longer used. ^KT-49933
This commit is contained in:
committed by
Space Team
parent
7290947fe8
commit
84287557d7
+1
-27
@@ -382,33 +382,7 @@ class KotlinMetadataTargetConfigurator :
|
|||||||
).forEach { configurationName ->
|
).forEach { configurationName ->
|
||||||
val configuration = project.configurations.getByName(configurationName)
|
val configuration = project.configurations.getByName(configurationName)
|
||||||
configuration.extendsFrom(sourceSet.resolvableMetadataConfiguration)
|
configuration.extendsFrom(sourceSet.resolvableMetadataConfiguration)
|
||||||
granularMetadataTransformation.applyToConfiguration(configuration)
|
configuration.shouldResolveConsistentlyWith(sourceSet.resolvableMetadataConfiguration)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Ensure that the [configuration] excludes the dependencies that are classified by this [GranularMetadataTransformation] as
|
|
||||||
* [MetadataDependencyResolution.Exclude], and uses exactly the same versions as were resolved for the requested
|
|
||||||
* dependencies during the transformation. */
|
|
||||||
private fun GranularMetadataTransformation.applyToConfiguration(configuration: Configuration) {
|
|
||||||
// Run this action immediately before the configuration first takes part in dependency resolution:
|
|
||||||
configuration.withDependencies {
|
|
||||||
val (unrequested, requested) = metadataDependencyResolutions
|
|
||||||
.partition { it is MetadataDependencyResolution.Exclude }
|
|
||||||
|
|
||||||
unrequested.forEach {
|
|
||||||
val (group, name) = it.projectDependency(project)?.run {
|
|
||||||
/** Note: the project dependency notation here should be exactly this, group:name,
|
|
||||||
* not from [ModuleIds.fromProjectPathDependency], as `exclude` checks it against the project's group:name */
|
|
||||||
ModuleDependencyIdentifier(group.toString(), name)
|
|
||||||
} ?: ModuleIds.fromComponent(project, it.dependency)
|
|
||||||
configuration.exclude(mapOf("group" to group, "module" to name))
|
|
||||||
}
|
|
||||||
|
|
||||||
requested.filter { it.dependency.currentBuildProjectIdOrNull == null }.forEach {
|
|
||||||
val (group, name) = ModuleIds.fromComponent(project, it.dependency)
|
|
||||||
val notation = listOfNotNull(group.orEmpty(), name, it.dependency.moduleVersion?.version).joinToString(":")
|
|
||||||
configuration.resolutionStrategy.force(notation)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user