[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.
|
* 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
|
package org.jetbrains.kotlin.gradle.plugin.mpp
|
||||||
@@ -180,8 +180,7 @@ abstract class AbstractKotlinTarget(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO[Ilya Goncharov] fix internal on public when we remove legacy js
|
internal open fun createUsageContexts(
|
||||||
internal fun createUsageContexts(
|
|
||||||
producingCompilation: KotlinCompilation<*>
|
producingCompilation: KotlinCompilation<*>
|
||||||
): Set<DefaultKotlinUsageContext> {
|
): Set<DefaultKotlinUsageContext> {
|
||||||
// Here, the Java Usage values are used intentionally as Gradle needs this for
|
// 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(
|
override fun createKotlinVariant(
|
||||||
componentName: String,
|
componentName: String,
|
||||||
compilation: KotlinCompilation<*>,
|
compilation: KotlinCompilation<*>,
|
||||||
@@ -99,6 +109,10 @@ constructor(
|
|||||||
.get()
|
.get()
|
||||||
|
|
||||||
var irTarget: KotlinJsIrTarget? = null
|
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 testTaskName get() = testRuns.getByName(KotlinTargetWithTests.DEFAULT_TEST_RUN_NAME).testTaskName
|
||||||
val testTask: TaskProvider<KotlinTestReport>
|
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.
|
* 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
|
var irPreset: KotlinJsIrTargetPreset? = null
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
|
open val isMpp: Boolean
|
||||||
|
get() = true
|
||||||
|
|
||||||
override val platformType: KotlinPlatformType
|
override val platformType: KotlinPlatformType
|
||||||
get() = KotlinPlatformType.js
|
get() = KotlinPlatformType.js
|
||||||
|
|
||||||
@@ -40,6 +43,7 @@ open class KotlinJsTargetPreset(
|
|||||||
KotlinJsCompilerType.IR.lowerName
|
KotlinJsCompilerType.IR.lowerName
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
this.isMpp = this@KotlinJsTargetPreset.isMpp
|
||||||
|
|
||||||
project.whenEvaluated {
|
project.whenEvaluated {
|
||||||
if (!isBrowserConfigured && !isNodejsConfigured) {
|
if (!isBrowserConfigured && !isNodejsConfigured) {
|
||||||
@@ -88,6 +92,8 @@ class KotlinJsSingleTargetPreset(
|
|||||||
project,
|
project,
|
||||||
kotlinPluginVersion
|
kotlinPluginVersion
|
||||||
) {
|
) {
|
||||||
|
override val isMpp: Boolean
|
||||||
|
get() = false
|
||||||
|
|
||||||
override fun useDisambiguitionClassifierAsSourcesetNamePreffix() = false
|
override fun useDisambiguitionClassifierAsSourcesetNamePreffix() = false
|
||||||
|
|
||||||
|
|||||||
+3
@@ -36,6 +36,9 @@ constructor(
|
|||||||
override lateinit var testRuns: NamedDomainObjectContainer<KotlinJsReportAggregatingTestRun>
|
override lateinit var testRuns: NamedDomainObjectContainer<KotlinJsReportAggregatingTestRun>
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
|
open var isMpp: Boolean? = null
|
||||||
|
internal set
|
||||||
|
|
||||||
override var moduleName: String? = null
|
override var moduleName: String? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
check(!isBrowserConfigured && !isNodejsConfigured) {
|
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.
|
* 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
|
internal var mixedMode: Boolean? = null
|
||||||
|
|
||||||
|
open val isMpp: Boolean
|
||||||
|
get() = true
|
||||||
|
|
||||||
override val platformType: KotlinPlatformType
|
override val platformType: KotlinPlatformType
|
||||||
get() = KotlinPlatformType.js
|
get() = KotlinPlatformType.js
|
||||||
|
|
||||||
override fun instantiateTarget(name: String): KotlinJsIrTarget {
|
override fun instantiateTarget(name: String): KotlinJsIrTarget {
|
||||||
return project.objects.newInstance(KotlinJsIrTarget::class.java, project, platformType, mixedMode).apply {
|
return project.objects.newInstance(KotlinJsIrTarget::class.java, project, platformType, mixedMode).apply {
|
||||||
|
this.isMpp = this@KotlinJsIrTargetPreset.isMpp
|
||||||
if (!mixedMode) {
|
if (!mixedMode) {
|
||||||
project.whenEvaluated {
|
project.whenEvaluated {
|
||||||
if (!isBrowserConfigured && !isNodejsConfigured) {
|
if (!isBrowserConfigured && !isNodejsConfigured) {
|
||||||
@@ -74,6 +78,9 @@ class KotlinJsIrSingleTargetPreset(
|
|||||||
project,
|
project,
|
||||||
kotlinPluginVersion
|
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:
|
// 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? {
|
override fun provideTargetDisambiguationClassifier(target: KotlinOnlyTarget<KotlinJsIrCompilation>): String? {
|
||||||
return if (mixedMode!!) {
|
return if (mixedMode!!) {
|
||||||
|
|||||||
Reference in New Issue
Block a user