[Gradle, JS] Install dukat only if there is dependency with generateExternals
^KT-46178 fixed
This commit is contained in:
committed by
TeamCityServer
parent
dab693b075
commit
c73dadbcdf
+30
@@ -5,10 +5,14 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import com.google.gson.Gson
|
||||
import org.gradle.api.logging.configuration.WarningMode
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dukat.ExternalsOutputFormat
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.PackageJson
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class DukatIntegrationIT : BaseGradleIT() {
|
||||
@@ -397,6 +401,32 @@ class DukatIntegrationIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testWithoutGenerateExternals() {
|
||||
val projectName = "without-generate-externals"
|
||||
val project = Project(
|
||||
projectName = projectName,
|
||||
directoryPrefix = "dukat-integration"
|
||||
)
|
||||
project.setupWorkingDir()
|
||||
|
||||
project.gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||
|
||||
project.build("assemble", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
|
||||
assertSuccessful()
|
||||
|
||||
assertTasksNotExecuted(":generateExternalsIntegrated")
|
||||
|
||||
assertFalse("Dukat don't need to be dependency for thus project") {
|
||||
fileInWorkingDir("build/js/packages/without-generate-externals")
|
||||
.resolve(NpmProject.PACKAGE_JSON)
|
||||
.let {
|
||||
Gson().fromJson(it.readText(), PackageJson::class.java)
|
||||
}.dependencies.containsKey("dukat")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun projectName(
|
||||
dslType: DslType,
|
||||
dependenciesLocation: DependenciesLocation
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
plugins {
|
||||
kotlin("js") version "<pluginMarkerVersion>"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib-js"))
|
||||
implementation(npm("left-pad", "1.3.0"))
|
||||
implementation(npm("decamelize", "4.0.0"))
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
useCommonJs()
|
||||
nodejs()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user