[Gradle] Add useCompilerVersion to Kotlin extension

It allows to override default Kotlin compiler version that is used to run compilation via the build tools api
#KT-57397 In Progress
This commit is contained in:
Alexander.Likhachev
2023-03-17 17:35:00 +01:00
committed by Space Team
parent 22720f62f6
commit bb635d1bdb
@@ -142,6 +142,17 @@ abstract class KotlinTopLevelExtension(internal val project: Project) : KotlinTo
}
}
}
/**
* Allows to use a different version of the Kotlin Build Tools API implementation and effectively a different version of the compiler.
*
* By default, the Kotlin Build Tools API implementation of the same version as the KGP is used.
*
* Currently only has an effect if the `kotlin.compiler.runViaBuildToolsApi` Gradle property is set to `true`.
*/
fun useCompilerVersion(version: String) {
project.dependencies.add(BUILD_TOOLS_API_CLASSPATH_CONFIGURATION_NAME, "$KOTLIN_MODULE_GROUP:$KOTLIN_BUILD_TOOLS_API_IMPL:$version")
}
}
open class KotlinProjectExtension @Inject constructor(project: Project) : KotlinTopLevelExtension(project), KotlinSourceSetContainer {