Build: Fix embedded configuration import in jps build

Should affect only test configurations
This commit is contained in:
Vyacheslav Gerasimov
2019-06-20 02:50:31 +03:00
parent ca37cb0028
commit 0e7de4df41
+17 -3
View File
@@ -37,10 +37,24 @@ fun JUnit.configureForKotlin() {
if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
allprojects {
apply(mapOf("plugin" to "idea"))
// Make Idea import embedded configuration as transitive dependency for some configurations
afterEvaluate {
// Make Idea import embedded configuration as transitive dependency
configurations.findByName("embedded")?.let { embedded ->
configurations.findByName("runtime")?.extendsFrom(embedded)
listOf(
"testCompile",
"testCompileOnly",
"testRuntime",
"testRuntimeOnly"
).forEach { configurationName ->
val dependencyProjects = configurations
.findByName(configurationName)
?.dependencies
?.mapNotNull { (it as? ProjectDependency)?.dependencyProject }
dependencies {
dependencyProjects?.forEach {dependencyProject ->
add(configurationName, project(dependencyProject.path, configuration = "embedded"))
}
}
}
}
}