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) { if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
allprojects { allprojects {
apply(mapOf("plugin" to "idea")) apply(mapOf("plugin" to "idea"))
// Make Idea import embedded configuration as transitive dependency for some configurations
afterEvaluate { afterEvaluate {
// Make Idea import embedded configuration as transitive dependency listOf(
configurations.findByName("embedded")?.let { embedded -> "testCompile",
configurations.findByName("runtime")?.extendsFrom(embedded) "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"))
}
}
} }
} }
} }