[Gradle, JS] Add tests on Separate Dukat integration
This commit is contained in:
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProject
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.NpmProjectModules
|
||||
import org.jetbrains.kotlin.gradle.targets.js.npm.fromSrcPackageJson
|
||||
import org.jetbrains.kotlin.gradle.tasks.USING_JS_INCREMENTAL_COMPILATION_MESSAGE
|
||||
import org.jetbrains.kotlin.gradle.tasks.USING_JS_IR_BACKEND_MESSAGE
|
||||
import org.jetbrains.kotlin.gradle.util.*
|
||||
import org.junit.Assume.assumeFalse
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
import java.util.zip.ZipFile
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class DukatIntegrationIT : BaseGradleIT() {
|
||||
@Test
|
||||
fun testSeparateDukatKotlinDslRootDependencies() {
|
||||
testSeparateDukat(
|
||||
DslType.KOTLIN,
|
||||
DependenciesLocation.ROOT
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSeparateDukatKotlinDslExtDependencies() {
|
||||
testSeparateDukat(
|
||||
DslType.KOTLIN,
|
||||
DependenciesLocation.EXTENSION
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSeparateDukatGroovyDslRootDependencies() {
|
||||
testSeparateDukat(
|
||||
DslType.GROOVY,
|
||||
DependenciesLocation.ROOT
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSeparateDukatGroovyDslExtDependencies() {
|
||||
testSeparateDukat(
|
||||
DslType.GROOVY,
|
||||
DependenciesLocation.EXTENSION
|
||||
)
|
||||
}
|
||||
|
||||
private fun testSeparateDukat(
|
||||
dslType: DslType,
|
||||
dependenciesLocation: DependenciesLocation
|
||||
) {
|
||||
val project = Project(
|
||||
projectName = "${dslType.value}-${dependenciesLocation.value}",
|
||||
directoryPrefix = "dukat-integration"
|
||||
)
|
||||
project.setupWorkingDir()
|
||||
project.gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||
|
||||
project.build("generateExternals") {
|
||||
assertSuccessful()
|
||||
}
|
||||
}
|
||||
|
||||
private enum class DslType(
|
||||
val value: String
|
||||
) {
|
||||
KOTLIN("kotlin-dsl"),
|
||||
GROOVY("groovy-dsl")
|
||||
}
|
||||
|
||||
private enum class DependenciesLocation(
|
||||
val value: String
|
||||
) {
|
||||
ROOT("root"),
|
||||
EXTENSION("ext")
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.js") version "<pluginMarkerVersion>"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
nodejs()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
|
||||
implementation(npm("left-pad", "1.3.0", false))
|
||||
implementation(npm("decamelize", "4.0.0"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.js") version "<pluginMarkerVersion>"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
|
||||
implementation(npm("left-pad", "1.3.0", false))
|
||||
implementation(npm("decamelize", "4.0.0"))
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
nodejs()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
plugins {
|
||||
kotlin("js") version "<pluginMarkerVersion>"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
nodejs()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val main by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib-js"))
|
||||
implementation(npm("left-pad", "1.3.0", false))
|
||||
implementation(npm("decamelize", "4.0.0"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
plugins {
|
||||
kotlin("js") version "<pluginMarkerVersion>"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib-js"))
|
||||
implementation(npm("left-pad", "1.3.0", false))
|
||||
implementation(npm("decamelize", "4.0.0"))
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
nodejs()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user