[Gradle][Minor] Move KotlinCommonPlugin into separate source file
KT-54312
This commit is contained in:
committed by
Space Team
parent
cd86cd7c0d
commit
9cf00c6b9c
+3
@@ -5,6 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Deprecated("Rebasing Artifact. Will be removed later", replaceWith = ReplaceWith("KotlinCommonCompilerOptionsDefault"))
|
||||
internal typealias CompilerCommonOptionsDefault = KotlinCommonCompilerOptionsDefault
|
||||
|
||||
internal abstract class KotlinCommonCompilerOptionsDefault @javax.inject.Inject constructor(
|
||||
objectFactory: org.gradle.api.model.ObjectFactory
|
||||
) : org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerToolOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions {
|
||||
|
||||
+3
@@ -5,6 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Deprecated("Rebasing Artifact. Will be removed later", replaceWith = ReplaceWith("KotlinCommonCompilerToolOptionsDefault"))
|
||||
internal typealias CompilerCommonToolOptionsDefault = KotlinCommonCompilerToolOptionsDefault
|
||||
|
||||
internal abstract class KotlinCommonCompilerToolOptionsDefault @javax.inject.Inject constructor(
|
||||
objectFactory: org.gradle.api.model.ObjectFactory
|
||||
) : org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerToolOptions {
|
||||
|
||||
+3
@@ -5,6 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Deprecated("Rebasing Artifact. Will be removed later", replaceWith = ReplaceWith("KotlinJsCompilerOptionsDefault"))
|
||||
internal typealias CompilerJsOptionsDefault = KotlinJsCompilerOptionsDefault
|
||||
|
||||
internal abstract class KotlinJsCompilerOptionsDefault @javax.inject.Inject constructor(
|
||||
objectFactory: org.gradle.api.model.ObjectFactory
|
||||
) : org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.KotlinJsCompilerOptions {
|
||||
|
||||
+3
@@ -5,6 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Deprecated("Rebasing Artifact. Will be removed later", replaceWith = ReplaceWith("KotlinJsDceCompilerToolOptionsDefault"))
|
||||
internal typealias CompilerJsDceOptionsDefault = KotlinJsDceCompilerToolOptionsDefault
|
||||
|
||||
internal abstract class KotlinJsDceCompilerToolOptionsDefault @javax.inject.Inject constructor(
|
||||
objectFactory: org.gradle.api.model.ObjectFactory
|
||||
) : org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.KotlinJsDceCompilerToolOptions {
|
||||
|
||||
+3
@@ -5,6 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Deprecated("Rebasing Artifact. Will be removed later", replaceWith = ReplaceWith("KotlinJvmCompilerOptionsDefault"))
|
||||
internal typealias CompilerJvmOptionsDefault = KotlinJvmCompilerOptionsDefault
|
||||
|
||||
internal abstract class KotlinJvmCompilerOptionsDefault @javax.inject.Inject constructor(
|
||||
objectFactory: org.gradle.api.model.ObjectFactory
|
||||
) : org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions {
|
||||
|
||||
+3
@@ -5,6 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.dsl
|
||||
|
||||
@Deprecated("Rebasing Artifact. Will be removed later", replaceWith = ReplaceWith("KotlinMultiplatformCommonCompilerOptionsDefault"))
|
||||
internal typealias CompilerMultiplatformCommonOptionsDefault = KotlinMultiplatformCommonCompilerOptionsDefault
|
||||
|
||||
internal abstract class KotlinMultiplatformCommonCompilerOptionsDefault @javax.inject.Inject constructor(
|
||||
objectFactory: org.gradle.api.model.ObjectFactory
|
||||
) : org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptionsDefault(objectFactory), org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformCommonCompilerOptions {
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.plugin
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
||||
import org.jetbrains.kotlin.gradle.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinCompilation
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinWithJavaTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinTasksProvider
|
||||
|
||||
internal open class KotlinCommonPlugin(
|
||||
registry: ToolingModelBuilderRegistry
|
||||
) : AbstractKotlinPlugin(KotlinTasksProvider(), registry) {
|
||||
|
||||
companion object {
|
||||
private const val targetName = "common"
|
||||
}
|
||||
|
||||
override fun buildSourceSetProcessor(
|
||||
project: Project,
|
||||
compilation: AbstractKotlinCompilation<*>
|
||||
): KotlinSourceSetProcessor<*> =
|
||||
KotlinCommonSourceSetProcessor(compilation, tasksProvider)
|
||||
|
||||
override fun apply(project: Project) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val target = project.objects.newInstance(
|
||||
KotlinWithJavaTarget::class.java,
|
||||
project,
|
||||
KotlinPlatformType.common,
|
||||
targetName,
|
||||
{
|
||||
object : HasCompilerOptions<CompilerMultiplatformCommonOptions> {
|
||||
override val options: CompilerMultiplatformCommonOptions =
|
||||
project.objects.newInstance(CompilerMultiplatformCommonOptionsDefault::class.java)
|
||||
}
|
||||
},
|
||||
{ compilerOptions: CompilerMultiplatformCommonOptions ->
|
||||
object : KotlinMultiplatformCommonOptions {
|
||||
override val options: CompilerMultiplatformCommonOptions
|
||||
get() = compilerOptions
|
||||
}
|
||||
}
|
||||
) as KotlinWithJavaTarget<KotlinMultiplatformCommonOptions, CompilerMultiplatformCommonOptions>
|
||||
(project.kotlinExtension as KotlinCommonProjectExtension).target = target
|
||||
|
||||
super.apply(project)
|
||||
}
|
||||
}
|
||||
-40
@@ -80,46 +80,6 @@ internal open class KotlinPlugin(
|
||||
}
|
||||
}
|
||||
|
||||
internal open class KotlinCommonPlugin(
|
||||
registry: ToolingModelBuilderRegistry
|
||||
) : AbstractKotlinPlugin(KotlinTasksProvider(), registry) {
|
||||
|
||||
companion object {
|
||||
private const val targetName = "common"
|
||||
}
|
||||
|
||||
override fun buildSourceSetProcessor(
|
||||
project: Project,
|
||||
compilation: AbstractKotlinCompilation<*>
|
||||
): KotlinSourceSetProcessor<*> =
|
||||
KotlinCommonSourceSetProcessor(compilation, tasksProvider)
|
||||
|
||||
override fun apply(project: Project) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val target = project.objects.newInstance(
|
||||
KotlinWithJavaTarget::class.java,
|
||||
project,
|
||||
KotlinPlatformType.common,
|
||||
targetName,
|
||||
{
|
||||
object : HasCompilerOptions<KotlinMultiplatformCommonCompilerOptions> {
|
||||
override val options: KotlinMultiplatformCommonCompilerOptions =
|
||||
project.objects.newInstance(KotlinMultiplatformCommonCompilerOptionsDefault::class.java)
|
||||
}
|
||||
},
|
||||
{ compilerOptions: KotlinMultiplatformCommonCompilerOptions ->
|
||||
object : KotlinMultiplatformCommonOptions {
|
||||
override val options: KotlinMultiplatformCommonCompilerOptions
|
||||
get() = compilerOptions
|
||||
}
|
||||
}
|
||||
) as KotlinWithJavaTarget<KotlinMultiplatformCommonOptions, KotlinMultiplatformCommonCompilerOptions>
|
||||
(project.kotlinExtension as KotlinCommonProjectExtension).target = target
|
||||
|
||||
super.apply(project)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated(
|
||||
message = "Should be removed with Js platform plugin",
|
||||
level = DeprecationLevel.ERROR
|
||||
|
||||
Reference in New Issue
Block a user