Exclude common parts of kotlin-test from platform source sets
See details in linked issue. Tests are on the intellij-side ^KT-47570 Fixed
This commit is contained in:
committed by
teamcity
parent
0805916564
commit
46ab972cb1
+10
-8
@@ -44,7 +44,7 @@ internal fun customizeKotlinDependencies(project: Project) {
|
|||||||
configureKotlinTestDependency(project)
|
configureKotlinTestDependency(project)
|
||||||
}
|
}
|
||||||
configureDefaultVersionsResolutionStrategy(project)
|
configureDefaultVersionsResolutionStrategy(project)
|
||||||
excludeStdlibCommonFromPlatformCompilations(project)
|
excludeStdlibAndKotlinTestCommonFromPlatformCompilations(project)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun configureDefaultVersionsResolutionStrategy(project: Project) {
|
private fun configureDefaultVersionsResolutionStrategy(project: Project) {
|
||||||
@@ -59,18 +59,17 @@ private fun configureDefaultVersionsResolutionStrategy(project: Project) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//region stdlib
|
private fun excludeStdlibAndKotlinTestCommonFromPlatformCompilations(project: Project) {
|
||||||
private fun excludeStdlibCommonFromPlatformCompilations(project: Project) {
|
|
||||||
val multiplatformExtension = project.multiplatformExtensionOrNull ?: return
|
val multiplatformExtension = project.multiplatformExtensionOrNull ?: return
|
||||||
|
|
||||||
multiplatformExtension.targets.matching { it !is KotlinMetadataTarget }.all {
|
multiplatformExtension.targets.matching { it !is KotlinMetadataTarget }.all {
|
||||||
it.excludeStdlibCommonFromPlatformCompilations()
|
it.excludeStdlibAndKotlinTestCommonFromPlatformCompilations()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// there several JVM-like targets, like KotlinWithJava, or KotlinAndroid, and they don't have common supertype
|
// there several JVM-like targets, like KotlinWithJava, or KotlinAndroid, and they don't have common supertype
|
||||||
// aside from KotlinTarget
|
// aside from KotlinTarget
|
||||||
private fun KotlinTarget.excludeStdlibCommonFromPlatformCompilations() {
|
private fun KotlinTarget.excludeStdlibAndKotlinTestCommonFromPlatformCompilations() {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
it.compileDependencyConfigurationName,
|
it.compileDependencyConfigurationName,
|
||||||
@@ -81,13 +80,16 @@ private fun KotlinTarget.excludeStdlibCommonFromPlatformCompilations() {
|
|||||||
// Additional configurations for (old) jvmWithJava-preset. Remove it when we drop it completely
|
// Additional configurations for (old) jvmWithJava-preset. Remove it when we drop it completely
|
||||||
(it as? KotlinWithJavaCompilation<*>)?.apiConfigurationName
|
(it as? KotlinWithJavaCompilation<*>)?.apiConfigurationName
|
||||||
).forEach { configurationName ->
|
).forEach { configurationName ->
|
||||||
project.configurations.getByName(configurationName).exclude(
|
project.configurations.getByName(configurationName).apply {
|
||||||
mapOf("group" to "org.jetbrains.kotlin", "module" to "kotlin-stdlib-common")
|
exclude(mapOf("group" to "org.jetbrains.kotlin", "module" to "kotlin-stdlib-common"))
|
||||||
)
|
exclude(mapOf("group" to "org.jetbrains.kotlin", "module" to "kotlin-test-common"))
|
||||||
|
exclude(mapOf("group" to "org.jetbrains.kotlin", "module" to "kotlin-test-annotations-common"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//region stdlib
|
||||||
internal fun configureStdlibDefaultDependency(project: Project) = with(project) {
|
internal fun configureStdlibDefaultDependency(project: Project) = with(project) {
|
||||||
if (!PropertiesProvider(project).stdlibDefaultDependency)
|
if (!PropertiesProvider(project).stdlibDefaultDependency)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user