[Gradle, JS] Add intregration test on browser pipeline with transitive dependencies

This commit is contained in:
Ilya Goncharov
2019-11-18 19:42:38 +03:00
parent c87961dcad
commit d246d12093
9 changed files with 138 additions and 0 deletions
@@ -500,4 +500,33 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
assertSuccessful()
}
}
@Test
fun testBrowserDistribution() = with(Project("kotlin-js-browser-project", GradleVersionRequired.AtLeast("4.10.2"))) {
setupWorkingDir()
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
build("build") {
assertSuccessful()
assertTasksExecuted(
":app:processDceKotlinJs",
":app:browserProductionWebpack"
)
assertFileExists("build/js/packages/kotlin-js-browser-base")
assertFileExists("build/js/packages/kotlin-js-browser-lib")
assertFileExists("build/js/packages/kotlin-js-browser-app")
assertFileExists("build/js/packages/kotlin-js-browser-app/kotlin-dce")
assertFileExists("build/js/packages/kotlin-js-browser-app/kotlin-dce/kotlin.js")
assertFileExists("build/js/packages/kotlin-js-browser-app/kotlin-dce/kotlin-js-browser-app.js")
assertFileExists("build/js/packages/kotlin-js-browser-app/kotlin-dce/kotlin-js-browser-lib.js")
assertFileExists("build/js/packages/kotlin-js-browser-app/kotlin-dce/kotlin-js-browser-base.js")
assertFileExists("app/build/distributions/app.js")
assertFileExists("app/build/distributions/app.js.map")
}
}
}
@@ -0,0 +1,15 @@
plugins {
kotlin("js")
}
dependencies {
implementation(kotlin("stdlib-js"))
implementation(project(":lib"))
}
kotlin {
target {
browser {
}
}
}
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2019 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 com.example
fun main() {
println("Sheldon: ${sheldon()}")
}
@@ -0,0 +1,15 @@
plugins {
kotlin("js")
}
dependencies {
implementation(kotlin("stdlib-js"))
}
kotlin {
target {
browser {
useCommonJs()
}
}
}
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2019 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 com.example
fun best(): Int {
return 42
}
fun simpleBest(): Int {
return 73
}
@@ -0,0 +1,13 @@
plugins {
kotlin("js").version("<pluginMarkerVersion>")
}
group = "com.example"
version = "1.0"
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
@@ -0,0 +1,16 @@
plugins {
kotlin("js")
}
dependencies {
implementation(kotlin("stdlib-js"))
implementation(project(":base"))
}
kotlin {
target {
browser {
useCommonJs()
}
}
}
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2019 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 com.example
fun answer(): Int {
return best()
}
fun sheldon(): Int {
return simpleBest()
}
@@ -0,0 +1,12 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "kotlin-js-browser"
include("base")
include("lib")
include("app")