[Gradle][Minor] Move MetadataCompilationDetails into separate source file
KT-54312
This commit is contained in:
committed by
Space Team
parent
12e4dfd5bc
commit
d08bd626a6
-31
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.gradle.plugin.mpp
|
|||||||
|
|
||||||
import org.gradle.api.Action
|
import org.gradle.api.Action
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.file.FileCollection
|
|
||||||
import org.jetbrains.kotlin.gradle.dsl.*
|
import org.jetbrains.kotlin.gradle.dsl.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.*
|
import org.jetbrains.kotlin.gradle.plugin.*
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.*
|
||||||
@@ -56,36 +55,6 @@ internal val CompilationDetails<*>.associateCompilationsClosure: Iterable<Compil
|
|||||||
get() = closure { it.associateCompilations }
|
get() = closure { it.associateCompilations }
|
||||||
|
|
||||||
|
|
||||||
internal class MetadataCompilationDetails(
|
|
||||||
target: KotlinTarget,
|
|
||||||
name: String,
|
|
||||||
defaultSourceSet: KotlinSourceSet,
|
|
||||||
) : DefaultCompilationDetails<KotlinMultiplatformCommonOptions, KotlinMultiplatformCommonCompilerOptions>(
|
|
||||||
target,
|
|
||||||
name,
|
|
||||||
defaultSourceSet,
|
|
||||||
{
|
|
||||||
object : HasCompilerOptions<KotlinMultiplatformCommonCompilerOptions> {
|
|
||||||
override val options: KotlinMultiplatformCommonCompilerOptions =
|
|
||||||
target.project.objects.newInstance(KotlinMultiplatformCommonCompilerOptionsDefault::class.java)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
object : KotlinMultiplatformCommonOptions {
|
|
||||||
override val options: KotlinMultiplatformCommonCompilerOptions
|
|
||||||
get() = compilerOptions.options
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
|
|
||||||
override val friendArtifacts: FileCollection
|
|
||||||
get() = super.friendArtifacts.plus(run {
|
|
||||||
val project = target.project
|
|
||||||
val friendSourceSets = getVisibleSourceSetsFromAssociateCompilations(defaultSourceSet)
|
|
||||||
project.files(friendSourceSets.mapNotNull { target.compilations.findByName(it.name)?.output?.classesDirs })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
internal open class JsCompilationDetails(
|
internal open class JsCompilationDetails(
|
||||||
target: KotlinTarget,
|
target: KotlinTarget,
|
||||||
compilationPurpose: String,
|
compilationPurpose: String,
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.mpp
|
||||||
|
|
||||||
|
import org.gradle.api.file.FileCollection
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.CompilerMultiplatformCommonOptions
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.CompilerMultiplatformCommonOptionsDefault
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformCommonOptions
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.HasCompilerOptions
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.sources.getVisibleSourceSetsFromAssociateCompilations
|
||||||
|
|
||||||
|
internal class MetadataCompilationDetails(
|
||||||
|
target: KotlinTarget,
|
||||||
|
name: String,
|
||||||
|
defaultSourceSet: KotlinSourceSet,
|
||||||
|
) : DefaultCompilationDetails<KotlinMultiplatformCommonOptions, CompilerMultiplatformCommonOptions>(
|
||||||
|
target,
|
||||||
|
name,
|
||||||
|
defaultSourceSet,
|
||||||
|
{
|
||||||
|
object : HasCompilerOptions<CompilerMultiplatformCommonOptions> {
|
||||||
|
override val options: CompilerMultiplatformCommonOptions =
|
||||||
|
target.project.objects.newInstance(CompilerMultiplatformCommonOptionsDefault::class.java)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
object : KotlinMultiplatformCommonOptions {
|
||||||
|
override val options: CompilerMultiplatformCommonOptions
|
||||||
|
get() = compilerOptions.options
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
|
||||||
|
override val friendArtifacts: FileCollection
|
||||||
|
get() = super.friendArtifacts.plus(run {
|
||||||
|
val project = target.project
|
||||||
|
val friendSourceSets = getVisibleSourceSetsFromAssociateCompilations(defaultSourceSet)
|
||||||
|
project.files(friendSourceSets.mapNotNull { target.compilations.findByName(it.name)?.output?.classesDirs })
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user