Include Dukat generated sources into generic 'sourcesJar' output.
Gradle 7 complains that "sourcesJar" task uses inputs from Dukat generate task outputs directory, but this tasks does not have explicit dependency. ^KT-46006 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
a097a58edf
commit
4f352950d9
+23
@@ -5,9 +5,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.junit.Test
|
||||
import java.util.zip.ZipFile
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
class KotlinJsIrLibraryGradlePluginIT : BaseGradleIT() {
|
||||
override val defaultGradleVersion = GradleVersionRequired.AtLeast("6.1")
|
||||
@@ -64,4 +67,24 @@ class KotlinJsIrLibraryGradlePluginIT : BaseGradleIT() {
|
||||
assertFileExists("build/distributions/js-library.js")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPublishSourcesJarTaskShouldAlsoIncludeDukatTaskOutputs() {
|
||||
with(
|
||||
Project(
|
||||
"js-library-ir",
|
||||
minLogLevel = LogLevel.INFO
|
||||
)
|
||||
) {
|
||||
setupWorkingDir()
|
||||
build("sourcesJar") {
|
||||
assertSuccessful()
|
||||
val sourcesJarFilePath = "build/libs/js-library-ir-kotlin-sources.jar"
|
||||
assertFileExists(sourcesJarFilePath)
|
||||
ZipFile(projectDir.resolve(sourcesJarFilePath)).use {
|
||||
assertNotNull(it.getEntry("jsMain/index.module_decamelize.kt"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js(IR) {
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
cssSupport.enabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"jsMainImplementation"(npm("decamelize", "4.0.0", generateExternals = true))
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.multiplatform") version "${extra["kotlin_version"]}"
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package example
|
||||
|
||||
fun main() {
|
||||
println("Hello there!")
|
||||
}
|
||||
+10
-4
@@ -225,10 +225,16 @@ abstract class AbstractKotlinTarget(
|
||||
.disambiguateName(
|
||||
DukatCompilationResolverPlugin.GENERATE_EXTERNALS_INTEGRATED_TASK_SIMPLE_NAME
|
||||
)
|
||||
producingCompilation.target.project.afterEvaluate {
|
||||
sourcesJarTask.dependsOn(
|
||||
producingCompilation.target.project.tasks.named(dukatGenerateExternalsTaskName)
|
||||
)
|
||||
|
||||
with(producingCompilation.target.project) {
|
||||
val dukatTask = tasks.named(dukatGenerateExternalsTaskName)
|
||||
sourcesJarTask.dependsOn(dukatTask)
|
||||
|
||||
plugins.withId("maven-publish") {
|
||||
tasks
|
||||
.matching { it.name == "sourcesJar" }
|
||||
.configureEach { it.dependsOn(dukatTask) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user