Fix ConcurrentModificationException iterating over tasks (KT-29971)
Issue #KT-29971 Fixed
This commit is contained in:
+8
@@ -815,4 +815,12 @@ class KotlinGradleIT : BaseGradleIT() {
|
||||
assertContains("Kotlin build report is written to")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testKt29971() = with(Project("kt-29971", GradleVersionRequired.AtLeast("5.0"))) {
|
||||
build("jvm-app:build") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":jvm-app:compileKotlin")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.jvm"
|
||||
}
|
||||
|
||||
group = "com.example.jvm"
|
||||
version = "1.0"
|
||||
+1
@@ -0,0 +1 @@
|
||||
fun main() = Unit
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// While this plugin seems not to do anything in this setup, IT IS needed to reproduce KT-29971
|
||||
apply plugin: "application"
|
||||
mainClassName = "foo"
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
enableFeaturePreview('GRADLE_METADATA')
|
||||
|
||||
include(":mpp-lib", ":jvm-app")
|
||||
+5
-3
@@ -31,13 +31,15 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.daemon.client.CompileServiceSession
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||
import org.jetbrains.kotlin.gradle.plugin.internal.state.TaskLoggers
|
||||
import org.jetbrains.kotlin.gradle.logging.kotlinDebug
|
||||
import org.jetbrains.kotlin.gradle.plugin.internal.state.TaskLoggers
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.tasks.*
|
||||
import org.jetbrains.kotlin.gradle.utils.newTmpFile
|
||||
import org.jetbrains.kotlin.gradle.utils.relativeToRoot
|
||||
import org.jetbrains.kotlin.incremental.*
|
||||
import org.jetbrains.kotlin.incremental.classpathAsList
|
||||
import org.jetbrains.kotlin.incremental.destinationAsFile
|
||||
import org.jetbrains.kotlin.incremental.makeModuleFile
|
||||
import java.io.File
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
@@ -194,7 +196,7 @@ internal open class GradleCompilerRunner(protected val task: Task) {
|
||||
val jarToModule = HashMap<File, IncrementalModuleEntry>()
|
||||
|
||||
for (project in gradle.rootProject.allprojects) {
|
||||
project.tasks.withType(AbstractKotlinCompile::class.java).forEach { task ->
|
||||
project.tasks.withType(AbstractKotlinCompile::class.java).toList().forEach { task ->
|
||||
val module = IncrementalModuleEntry(project.path, task.moduleName, project.buildDir, task.buildHistoryFile)
|
||||
dirToModule[task.destinationDir] = module
|
||||
task.javaOutputDir?.let { dirToModule[it] = module }
|
||||
|
||||
Reference in New Issue
Block a user