[Gradle, JS] KT-36784 Add tests on local npm dependencies in composite
#KT-32466 fixed #KT-36784 fixed #KT-36864 fixed
This commit is contained in:
+15
@@ -2,6 +2,9 @@ package org.jetbrains.kotlin.gradle
|
|||||||
|
|
||||||
import org.gradle.api.logging.LogLevel
|
import org.gradle.api.logging.LogLevel
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
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_INCREMENTAL_COMPILATION_MESSAGE
|
||||||
import org.jetbrains.kotlin.gradle.tasks.USING_JS_IR_BACKEND_MESSAGE
|
import org.jetbrains.kotlin.gradle.tasks.USING_JS_IR_BACKEND_MESSAGE
|
||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
@@ -570,9 +573,21 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
|
|||||||
|
|
||||||
libProject.projectDir.copyRecursively(appProject.projectDir.resolve(libProject.projectDir.name))
|
libProject.projectDir.copyRecursively(appProject.projectDir.resolve(libProject.projectDir.name))
|
||||||
|
|
||||||
|
fun Project.asyncVersion(rootModulePath: String, moduleName: String): String =
|
||||||
|
NpmProjectModules(projectDir.resolve(rootModulePath))
|
||||||
|
.require(moduleName)
|
||||||
|
.let { File(it).parentFile.parentFile.resolve(NpmProject.PACKAGE_JSON) }
|
||||||
|
.let { fromSrcPackageJson(it) }
|
||||||
|
.let { it!!.version }
|
||||||
|
|
||||||
with(appProject) {
|
with(appProject) {
|
||||||
build("build") {
|
build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
val appAsyncVersion = asyncVersion("build/js/node_modules/app", "async")
|
||||||
|
assertEquals("3.2.0", appAsyncVersion)
|
||||||
|
|
||||||
|
val libAsyncVersion = asyncVersion("build/js/node_modules/lib2", "async")
|
||||||
|
assertEquals("2.6.2", libAsyncVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -16,4 +16,5 @@ kotlin.js {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib-js"))
|
implementation(kotlin("stdlib-js"))
|
||||||
implementation("com.example:lib2")
|
implementation("com.example:lib2")
|
||||||
|
implementation(npm("async", "3.2.0"))
|
||||||
}
|
}
|
||||||
+1
@@ -14,4 +14,5 @@ kotlin.target.nodejs()
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib-js"))
|
implementation(kotlin("stdlib-js"))
|
||||||
|
implementation(npm("async", "2.6.2"))
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user