From be2d6b99f6b9c0999e6157fddefdcad63211d028 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Fri, 26 Jun 2020 12:50:04 +0300 Subject: [PATCH] [Gradle, JS] Add test on changing of default value for generating externals --- .../kotlin/gradle/DukatIntegrationIT.kt | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt index 218d2b36632..85d4be6dd0b 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/DukatIntegrationIT.kt @@ -179,6 +179,69 @@ class DukatIntegrationIT : BaseGradleIT() { } } + @Test + fun testIntegratedDukatWithFalseDefaultKotlinDslRootDependencies() { + testIntegratedDukatWithFalseDefault( + DslType.KOTLIN, + DependenciesLocation.ROOT + ) + } + + @Test + fun testIntegratedDukatWithFalseDefaultKotlinDslExtDependencies() { + testIntegratedDukatWithFalseDefault( + DslType.KOTLIN, + DependenciesLocation.EXTENSION + ) + } + + @Test + fun testIntegratedDukatWithFalseDefaultGroovyDslRootDependencies() { + testIntegratedDukatWithFalseDefault( + DslType.GROOVY, + DependenciesLocation.ROOT + ) + } + + @Test + fun testIntegratedDukatWithFalseDefaultGroovyDslExtDependencies() { + testIntegratedDukatWithFalseDefault( + DslType.GROOVY, + DependenciesLocation.EXTENSION + ) + } + + private fun testIntegratedDukatWithFalseDefault( + dslType: DslType, + dependenciesLocation: DependenciesLocation + ) { + val projectName = projectName(dslType, dependenciesLocation) + val project = Project( + projectName = projectName, + directoryPrefix = "dukat-integration" + ) + project.setupWorkingDir() + project.gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl) + project.gradleProperties().modify { + "kotlin.js.generate.externals=true" + } + + project.gradleBuildScript().modify { buildScript -> + buildScript + .replace( + """implementation(npm("decamelize", "4.0.0", true))""", + """implementation(npm("decamelize", "4.0.0", false))""" + ) + } + + val externalSrcs = "build/externals/$projectName/src" + project.build("generateExternalsIntegrated") { + assertSuccessful() + + assertSingleFileExists(externalSrcs, "index.module_left-pad.kt") + } + } + private fun projectName( dslType: DslType, dependenciesLocation: DependenciesLocation