[Gradle] Move configureMDConfigurations to resolvableMetadataConfiguration
This commit is contained in:
committed by
Space Team
parent
25f6b4c922
commit
96ba03a708
+22
@@ -68,9 +68,31 @@ internal val InternalKotlinSourceSet.resolvableMetadataConfiguration: Configurat
|
||||
configuration.shouldResolveConsistentlyWith(allCompileMetadataConfiguration)
|
||||
copyAttributes(allCompileMetadataConfiguration.attributes, configuration.attributes)
|
||||
|
||||
configureMetadataDependenciesConfigurations(configuration)
|
||||
|
||||
configuration
|
||||
}
|
||||
|
||||
/**
|
||||
Older IDEs still rely on resolving the metadata configurations explicitly.
|
||||
Dependencies will be coming from extending the newer 'resolvableMetadataConfiguration'.
|
||||
|
||||
the intransitiveMetadataConfigurationName will not extend this mechanism, since it only
|
||||
relies on dependencies being added explicitly by the Kotlin Gradle Plugin
|
||||
*/
|
||||
private fun InternalKotlinSourceSet.configureMetadataDependenciesConfigurations(resolvableMetadataConfiguration: Configuration) {
|
||||
@Suppress("DEPRECATION")
|
||||
listOf(
|
||||
apiMetadataConfigurationName,
|
||||
implementationMetadataConfigurationName,
|
||||
compileOnlyMetadataConfigurationName
|
||||
).forEach { configurationName ->
|
||||
val configuration = project.configurations.getByName(configurationName)
|
||||
configuration.extendsFrom(resolvableMetadataConfiguration)
|
||||
configuration.shouldResolveConsistentlyWith(resolvableMetadataConfiguration)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration containing all compile dependencies from *all* source sets.
|
||||
* This configuration is used to provide a dependency 'consistency scope' for
|
||||
|
||||
+4
-21
@@ -163,7 +163,10 @@ class KotlinMetadataTargetConfigurator :
|
||||
private fun configureMetadataDependenciesConfigurationsForCommonSourceSets(target: KotlinMetadataTarget) {
|
||||
target.project.whenEvaluated {
|
||||
kotlinExtension.sourceSets.all { sourceSet ->
|
||||
configureMetadataDependenciesConfigurations(target.project, sourceSet.internal)
|
||||
// Resolvable metadata configuration must be initialized for all source sets
|
||||
// As it configures legacy metadata configurations that is used by older IDE Import
|
||||
// And it also configures platform source sets for the same reason
|
||||
sourceSet.internal.resolvableMetadataConfiguration
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,26 +353,6 @@ class KotlinMetadataTargetConfigurator :
|
||||
}
|
||||
}
|
||||
|
||||
private fun configureMetadataDependenciesConfigurations(project: Project, sourceSet: InternalKotlinSourceSet) {
|
||||
/*
|
||||
Older IDEs still rely on resolving the metadata configurations explicitly.
|
||||
Dependencies will be coming from extending the newer 'resolvableMetadataConfiguration'.
|
||||
|
||||
the intransitiveMetadataConfigurationName will not extend this mechanism, since it only
|
||||
relies on dependencies being added explicitly by the Kotlin Gradle Plugin
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
listOf(
|
||||
sourceSet.apiMetadataConfigurationName,
|
||||
sourceSet.implementationMetadataConfigurationName,
|
||||
sourceSet.compileOnlyMetadataConfigurationName
|
||||
).forEach { configurationName ->
|
||||
val configuration = project.configurations.getByName(configurationName)
|
||||
configuration.extendsFrom(sourceSet.resolvableMetadataConfiguration)
|
||||
configuration.shouldResolveConsistentlyWith(sourceSet.resolvableMetadataConfiguration)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createCommonMainElementsConfiguration(target: KotlinMetadataTarget) {
|
||||
val project = target.project
|
||||
project.configurations.create(COMMON_MAIN_ELEMENTS_CONFIGURATION_NAME).apply {
|
||||
|
||||
Reference in New Issue
Block a user