Fix wrong commits picked for master: restore changes from KOTLIN-CR-2817
This commit is contained in:
+1
-1
@@ -360,7 +360,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||
assertSuccessful()
|
||||
|
||||
assertTasksExecuted(
|
||||
":compileKotlin", ":compileTestKotlin", ":compileBenchmarkKotlin",
|
||||
":compileKotlinJs", ":compileTestKotlinJs", ":compileBenchmarkKotlinJs",
|
||||
":runDceKotlin", ":runDceBenchmarkKotlin"
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -13,13 +13,13 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin.sourceSets {
|
||||
main {
|
||||
getByName("main") {
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlinx:kotlinx-html-js:0.6.10")
|
||||
implementation(kotlin("stdlib-js"))
|
||||
}
|
||||
}
|
||||
test {
|
||||
getByName("test") {
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
@@ -37,7 +37,7 @@ kotlin.target.compilations.create("benchmark") {
|
||||
publishing {
|
||||
publications {
|
||||
create("default", MavenPublication::class.java) {
|
||||
from(kotlin.target.components.single())
|
||||
from(components.getByName("kotlin"))
|
||||
artifact(tasks.getByName("kotlinSourcesJar"))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ val runBenchmark by tasks.registering(JavaExec::class) {
|
||||
publishing {
|
||||
publications {
|
||||
create("default", MavenPublication::class) {
|
||||
from(kotlin.target.components.single())
|
||||
from(components.getByName("kotlin"))
|
||||
artifact(tasks.getByName("kotlinSourcesJar"))
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -30,10 +30,7 @@ import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptionsImpl
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinSingleJavaTargetExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.internal.KaptVariantData
|
||||
import org.jetbrains.kotlin.gradle.internal.checkAndroidAnnotationProcessorDependencyUsage
|
||||
@@ -43,6 +40,7 @@ import org.jetbrains.kotlin.gradle.model.builder.KotlinModelBuilder
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.*
|
||||
import org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.tasks.*
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.utils.*
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
||||
+3
-3
@@ -84,7 +84,7 @@ class KotlinMultiplatformPlugin(
|
||||
)
|
||||
configurePublishingWithMavenPublish(project)
|
||||
|
||||
targetsContainer.all { applyUserDefinedAttributes(it) }
|
||||
targetsContainer.withType(AbstractKotlinTarget::class.java).all { applyUserDefinedAttributes(it) }
|
||||
|
||||
// propagate compiler plugin options to the source set language settings
|
||||
setupCompilerPluginOptions(project)
|
||||
@@ -242,7 +242,7 @@ class KotlinMultiplatformPlugin(
|
||||
* 1. Output configurations of each target need the corresponding compilation's attributes (and, indirectly, the target's attributes)
|
||||
* 2. Resolvable configurations of each compilation need the compilation's attributes
|
||||
*/
|
||||
internal fun applyUserDefinedAttributes(target: KotlinTarget) {
|
||||
internal fun applyUserDefinedAttributes(target: AbstractKotlinTarget) {
|
||||
val project = target.project
|
||||
|
||||
project.whenEvaluated {
|
||||
@@ -257,7 +257,7 @@ internal fun applyUserDefinedAttributes(target: KotlinTarget) {
|
||||
// To copy the attributes to the output configurations, find those output configurations and their producing compilations
|
||||
// based on the target's components:
|
||||
val outputConfigurationsWithCompilations =
|
||||
target.components.filterIsInstance<KotlinVariant>().flatMap { kotlinVariant ->
|
||||
target.kotlinComponents.filterIsInstance<KotlinVariant>().flatMap { kotlinVariant ->
|
||||
kotlinVariant.usages.filterIsInstance<KotlinUsageContext>().mapNotNull { usageContext ->
|
||||
project.configurations.findByName(usageContext.dependencyConfigurationName)?.let { configuration ->
|
||||
configuration to usageContext.compilation
|
||||
|
||||
+7
-2
@@ -32,6 +32,8 @@ import org.jetbrains.kotlin.gradle.utils.dashSeparatedName
|
||||
import org.jetbrains.kotlin.gradle.utils.isGradleVersionAtLeast
|
||||
import org.jetbrains.kotlin.gradle.utils.lowerCamelCaseName
|
||||
|
||||
internal const val PRIMARY_SINGLE_COMPONENT_NAME = "kotlin"
|
||||
|
||||
abstract class AbstractKotlinTarget(
|
||||
final override val project: Project
|
||||
) : KotlinTarget {
|
||||
@@ -60,7 +62,10 @@ abstract class AbstractKotlinTarget(
|
||||
val mainCompilation = compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
|
||||
val usageContexts = createUsageContexts(mainCompilation)
|
||||
|
||||
val componentName = mainCompilation.target.name
|
||||
val componentName =
|
||||
if (project.kotlinExtension is KotlinMultiplatformExtension)
|
||||
targetName
|
||||
else PRIMARY_SINGLE_COMPONENT_NAME
|
||||
|
||||
val result = if (isGradleVersionAtLeast(4, 7)) {
|
||||
createKotlinVariant(componentName, mainCompilation, usageContexts)
|
||||
@@ -72,7 +77,7 @@ abstract class AbstractKotlinTarget(
|
||||
sourcesJarArtifact(mainCompilation, componentName, dashSeparatedName(targetName.toLowerCase()))
|
||||
)
|
||||
|
||||
setOf(result).also { project.components.addAll(it) }
|
||||
setOf(result)
|
||||
}
|
||||
|
||||
override val components: Set<SoftwareComponent> by lazy {
|
||||
|
||||
-1
@@ -90,7 +90,6 @@ open class KotlinAndroidTarget(
|
||||
checkPublishLibraryVariantsExist()
|
||||
|
||||
KotlinAndroidPlugin.androidTargetHandler(project.getKotlinPluginVersion()!!, this).doCreateComponents()
|
||||
.also { project.components.addAll(it) }
|
||||
}
|
||||
|
||||
// Capture the type parameter T for `AbstractAndroidProjectHandler`
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ open class KotlinJsPlugin(
|
||||
val kotlinExtension = project.kotlinExtension as KotlinJsProjectExtension
|
||||
configureDefaultVersionsResolutionStrategy(project, kotlinPluginVersion)
|
||||
|
||||
val target = KotlinJsSingleTargetPreset(project, kotlinPluginVersion).createTarget("kotlin")
|
||||
val target = KotlinJsSingleTargetPreset(project, kotlinPluginVersion).createTarget("Js")
|
||||
|
||||
kotlinExtension.target = target
|
||||
|
||||
|
||||
Reference in New Issue
Block a user