From 1573f0250a2646c3559ea497b07bea77d0c2d6dc Mon Sep 17 00:00:00 2001 From: Sebastian Sellmair Date: Thu, 6 Apr 2023 16:19:57 +0200 Subject: [PATCH] [Gradle][Minor] Add documentation on 'runSafe' to provide guidance on when to use it KTIJ-24976 --- .../kotlin/gradle/plugin/KotlinCompilerArgumentsProducer.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinCompilerArgumentsProducer.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinCompilerArgumentsProducer.kt index 2922f3628f9..4206b334c80 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinCompilerArgumentsProducer.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinCompilerArgumentsProducer.kt @@ -39,6 +39,11 @@ interface KotlinCompilerArgumentsProducer { } interface ContributeCompilerArgumentsContext { + /** + * This method shall be used for any [action] used to build arguments, that could potentially throw an exception + * (like resolving dependencies). There are some scenarios (like IDE import), where we want to be lenient + * and provide arguments on a 'best effort bases'. + */ fun runSafe(action: () -> T): T? fun primitive(contribution: (args: T) -> Unit) fun pluginClasspath(contribution: (args: T) -> Unit)