[Gradle, JS] Add isMpp property
#KT-38592 fixed
This commit is contained in:
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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
|
||||
@@ -180,8 +180,7 @@ abstract class AbstractKotlinTarget(
|
||||
return result
|
||||
}
|
||||
|
||||
// TODO[Ilya Goncharov] fix internal on public when we remove legacy js
|
||||
internal fun createUsageContexts(
|
||||
internal open fun createUsageContexts(
|
||||
producingCompilation: KotlinCompilation<*>
|
||||
): Set<DefaultKotlinUsageContext> {
|
||||
// Here, the Java Usage values are used intentionally as Gradle needs this for
|
||||
|
||||
+14
@@ -80,6 +80,16 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun createUsageContexts(producingCompilation: KotlinCompilation<*>): Set<DefaultKotlinUsageContext> {
|
||||
return super.createUsageContexts(producingCompilation) +
|
||||
DefaultKotlinUsageContext(
|
||||
compilation = compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME),
|
||||
usage = project.usageByName("java-api-jars"),
|
||||
dependencyConfigurationName = apiElementsConfigurationName,
|
||||
overrideConfigurationArtifacts = emptySet()
|
||||
)
|
||||
}
|
||||
|
||||
override fun createKotlinVariant(
|
||||
componentName: String,
|
||||
compilation: KotlinCompilation<*>,
|
||||
@@ -99,6 +109,10 @@ constructor(
|
||||
.get()
|
||||
|
||||
var irTarget: KotlinJsIrTarget? = null
|
||||
internal set
|
||||
|
||||
open var isMpp: Boolean? = null
|
||||
internal set
|
||||
|
||||
val testTaskName get() = testRuns.getByName(KotlinTargetWithTests.DEFAULT_TEST_RUN_NAME).testTaskName
|
||||
val testTask: TaskProvider<KotlinTestReport>
|
||||
|
||||
+7
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,9 @@ open class KotlinJsTargetPreset(
|
||||
var irPreset: KotlinJsIrTargetPreset? = null
|
||||
internal set
|
||||
|
||||
open val isMpp: Boolean
|
||||
get() = true
|
||||
|
||||
override val platformType: KotlinPlatformType
|
||||
get() = KotlinPlatformType.js
|
||||
|
||||
@@ -40,6 +43,7 @@ open class KotlinJsTargetPreset(
|
||||
KotlinJsCompilerType.IR.lowerName
|
||||
)
|
||||
)
|
||||
this.isMpp = this@KotlinJsTargetPreset.isMpp
|
||||
|
||||
project.whenEvaluated {
|
||||
if (!isBrowserConfigured && !isNodejsConfigured) {
|
||||
@@ -88,6 +92,8 @@ class KotlinJsSingleTargetPreset(
|
||||
project,
|
||||
kotlinPluginVersion
|
||||
) {
|
||||
override val isMpp: Boolean
|
||||
get() = false
|
||||
|
||||
override fun useDisambiguitionClassifierAsSourcesetNamePreffix() = false
|
||||
|
||||
|
||||
+3
@@ -36,6 +36,9 @@ constructor(
|
||||
override lateinit var testRuns: NamedDomainObjectContainer<KotlinJsReportAggregatingTestRun>
|
||||
internal set
|
||||
|
||||
open var isMpp: Boolean? = null
|
||||
internal set
|
||||
|
||||
override var moduleName: String? = null
|
||||
set(value) {
|
||||
check(!isBrowserConfigured && !isNodejsConfigured) {
|
||||
|
||||
+8
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
@@ -21,11 +21,15 @@ open class KotlinJsIrTargetPreset(
|
||||
) {
|
||||
internal var mixedMode: Boolean? = null
|
||||
|
||||
open val isMpp: Boolean
|
||||
get() = true
|
||||
|
||||
override val platformType: KotlinPlatformType
|
||||
get() = KotlinPlatformType.js
|
||||
|
||||
override fun instantiateTarget(name: String): KotlinJsIrTarget {
|
||||
return project.objects.newInstance(KotlinJsIrTarget::class.java, project, platformType, mixedMode).apply {
|
||||
this.isMpp = this@KotlinJsIrTargetPreset.isMpp
|
||||
if (!mixedMode) {
|
||||
project.whenEvaluated {
|
||||
if (!isBrowserConfigured && !isNodejsConfigured) {
|
||||
@@ -74,6 +78,9 @@ class KotlinJsIrSingleTargetPreset(
|
||||
project,
|
||||
kotlinPluginVersion
|
||||
) {
|
||||
override val isMpp: Boolean
|
||||
get() = false
|
||||
|
||||
// In a Kotlin/JS single-platform project, we don't need any disambiguation suffixes or prefixes in the names:
|
||||
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsIrCompilation>): String? {
|
||||
return if (mixedMode!!) {
|
||||
|
||||
Reference in New Issue
Block a user