[Gradle] Implement KotlinProjectSetupAction extensionPoint
KT-61634
This commit is contained in:
committed by
Space Team
parent
43929398da
commit
ff6b883cb4
+2
@@ -263,6 +263,8 @@ abstract class KotlinBasePluginWrapper : DefaultKotlinBasePlugin() {
|
|||||||
|
|
||||||
plugin.apply(project)
|
plugin.apply(project)
|
||||||
|
|
||||||
|
project.runKotlinProjectSetupActions()
|
||||||
|
|
||||||
project.addNpmDependencyExtension()
|
project.addNpmDependencyExtension()
|
||||||
|
|
||||||
project.registerBuildKotlinToolingMetadataTask()
|
project.registerBuildKotlinToolingMetadataTask()
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package org.jetbrains.kotlin.gradle.plugin
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic action to configure/set up a Kotlin Gradle Project.
|
||||||
|
* Will be invoked after the KotlinPluginWrapper applied the underlying Kotlin Gradle Plugin
|
||||||
|
*/
|
||||||
|
internal fun interface KotlinProjectSetupAction {
|
||||||
|
fun Project.invoke()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val extensionPoint = KotlinGradlePluginExtensionPoint<KotlinProjectSetupAction>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun Project.runKotlinProjectSetupActions() {
|
||||||
|
KotlinProjectSetupAction.extensionPoint[this].forEach { action ->
|
||||||
|
with(action) { invoke() }
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
@@ -31,6 +31,10 @@ import org.jetbrains.kotlin.gradle.plugin.diagnostics.checkers.WasmSourceSetsNot
|
|||||||
* Active Extensions (using the [KotlinGradlePluginExtensionPoint] infrastructure) will be registered here by the Kotlin Gradle Plugin.
|
* Active Extensions (using the [KotlinGradlePluginExtensionPoint] infrastructure) will be registered here by the Kotlin Gradle Plugin.
|
||||||
*/
|
*/
|
||||||
internal fun Project.registerKotlinPluginExtensions() {
|
internal fun Project.registerKotlinPluginExtensions() {
|
||||||
|
|
||||||
|
KotlinProjectSetupAction.extensionPoint.apply {
|
||||||
|
}
|
||||||
|
|
||||||
KotlinGradleProjectChecker.extensionPoint.apply {
|
KotlinGradleProjectChecker.extensionPoint.apply {
|
||||||
register(project, CommonMainOrTestWithDependsOnChecker)
|
register(project, CommonMainOrTestWithDependsOnChecker)
|
||||||
register(project, DeprecatedKotlinNativeTargetsChecker)
|
register(project, DeprecatedKotlinNativeTargetsChecker)
|
||||||
|
|||||||
Reference in New Issue
Block a user