@@ -129,6 +129,7 @@ import java.time.LocalDate
129
129
import java.time.LocalDateTime
130
130
import java.time.format.DateTimeFormatter
131
131
import java.util.*
132
+ import kotlin.io.path.exists
132
133
133
134
abstract class IntelliJPlugin : Plugin <Project > {
134
135
@@ -907,6 +908,7 @@ abstract class IntelliJPlugin : Plugin<Project> {
907
908
) {
908
909
val taskContext = logCategory()
909
910
val prepareSandboxTaskProvider = project.tasks.named<PrepareSandboxTask >(prepareSandBoxTaskName)
911
+ val initializeIntelliJPluginTaskProvider = project.tasks.named<InitializeIntelliJPluginTask >(INITIALIZE_INTELLIJ_PLUGIN_TASK_NAME )
910
912
val pluginIds = sourcePluginXmlFiles(project).mapNotNull { parsePluginXml(it, taskContext)?.id }
911
913
912
914
ideDir.convention(ideaDependencyProvider.map {
@@ -939,6 +941,9 @@ abstract class IntelliJPlugin : Plugin<Project> {
939
941
ideDir = ideDir.orNull,
940
942
).toString()
941
943
})
944
+ coroutinesJavaAgentPath.convention(initializeIntelliJPluginTaskProvider.flatMap {
945
+ it.coroutinesJavaAgentPath
946
+ })
942
947
}
943
948
944
949
private fun configureJarSearchableOptionsTask (project : Project ) {
@@ -1177,6 +1182,10 @@ abstract class IntelliJPlugin : Plugin<Project> {
1177
1182
val instrumentedTestCodeOutputsProvider = project.provider {
1178
1183
project.files(instrumentedTestCodeTaskProvider.map { it.outputDir.asFile })
1179
1184
}
1185
+ val initializeIntellijPluginTaskProvider = project.tasks.named<InitializeIntelliJPluginTask >(INITIALIZE_INTELLIJ_PLUGIN_TASK_NAME )
1186
+ val coroutinesJavaAgentPathProvider = initializeIntellijPluginTaskProvider.flatMap {
1187
+ it.coroutinesJavaAgentPath
1188
+ }
1180
1189
1181
1190
val testTasks = project.tasks.withType<Test >()
1182
1191
val pluginIds = sourcePluginXmlFiles(project).mapNotNull { parsePluginXml(it, context)?.id }
@@ -1263,7 +1272,7 @@ abstract class IntelliJPlugin : Plugin<Project> {
1263
1272
1264
1273
classpath = instrumentedCodeOutputsProvider.get() + instrumentedTestCodeOutputsProvider.get() + classpath
1265
1274
testClassesDirs = instrumentedTestCodeOutputsProvider.get() + testClassesDirs
1266
- jvmArgumentProviders.add(IntelliJPlatformArgumentProvider (ideDirProvider.get(), this ))
1275
+ jvmArgumentProviders.add(IntelliJPlatformArgumentProvider (ideDirProvider.get(), coroutinesJavaAgentPathProvider.get(), this ))
1267
1276
1268
1277
doFirst {
1269
1278
classpath + = ideaDependencyLibrariesProvider.get() +
@@ -1413,7 +1422,7 @@ abstract class IntelliJPlugin : Plugin<Project> {
1413
1422
)
1414
1423
1415
1424
onlyIf {
1416
- // Workaround for Gradle 7.x to don't fail on "An input file was expected to be present but it doesn't exist."
1425
+ // Workaround for Gradle 7.x to don't fail on "An input file was expected to be present, but it doesn't exist."
1417
1426
inputArchiveFile.isSpecified
1418
1427
}
1419
1428
dependsOn(SIGN_PLUGIN_TASK_NAME )
@@ -1544,6 +1553,7 @@ abstract class IntelliJPlugin : Plugin<Project> {
1544
1553
}
1545
1554
}
1546
1555
1556
+ @Suppress(" UnstableApiUsage" )
1547
1557
private fun configureProcessResources (project : Project ) {
1548
1558
info(context, " Configuring resources task" )
1549
1559
val patchPluginXmlTaskProvider = project.tasks.named<PatchPluginXmlTask >(PATCH_PLUGIN_XML_TASK_NAME )
@@ -1565,12 +1575,15 @@ abstract class IntelliJPlugin : Plugin<Project> {
1565
1575
selfUpdateCheck.convention(project.provider {
1566
1576
project.isBuildFeatureEnabled(SELF_UPDATE_CHECK )
1567
1577
})
1568
- lockFile.convention(project.provider {
1569
- temporaryDir.resolve(LocalDate .now().toString())
1578
+ selfUpdateLockPath.convention(project.provider {
1579
+ temporaryDir.toPath().resolve(LocalDate .now().toString())
1580
+ })
1581
+ coroutinesJavaAgentPath.convention(project.provider {
1582
+ temporaryDir.toPath().resolve(" coroutines-javaagent.jar" )
1570
1583
})
1571
1584
1572
1585
onlyIf {
1573
- ! lockFile .get().exists()
1586
+ ! selfUpdateLockPath.get().exists() || ! coroutinesJavaAgentPath .get().exists()
1574
1587
}
1575
1588
}
1576
1589
}
0 commit comments