[Gradle, JS] Add test on resolution of js project with directory dependency

^KT-43668 fixed
This commit is contained in:
Ilya Goncharov
2020-11-30 19:12:57 +03:00
parent 2fdc2dfaaf
commit b179b567a9
3 changed files with 26 additions and 1 deletions
@@ -799,4 +799,28 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
}
}
}
@Test
fun testDirectoryDependencyNotFailProjectResolution() {
with(Project("kotlin-js-nodejs-project")) {
setupWorkingDir()
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
gradleBuildScript().appendText(
"""${"\n"}
dependencies {
implementation(files("${"$"}{projectDir}/custom"))
implementation(files("${"$"}{projectDir}/custom2"))
}
""".trimIndent()
)
build(
"packageJson"
) {
assertSuccessful()
}
}
}
}
@@ -339,7 +339,8 @@ internal class KotlinCompilationNpmResolver(
resolver.gradleNodeModules.get(it.dependency.moduleName, it.dependency.moduleVersion, it.artifact.file)
} + fileCollectionDependencies.flatMap { dependency ->
dependency.files
.filter { it.exists() && it.isFile }
// Gradle can hash with FileHasher only files and only existed files
.filter { it.isFile }
.map { file ->
resolver.gradleNodeModules.get(
file.name,