[K/JS] Implement file merging for clashed file during per-file compilation

This commit is contained in:
Artem Kobzar
2023-09-14 13:14:15 +00:00
committed by Space Team
parent 337054ba92
commit 878452bd2b
43 changed files with 529 additions and 277 deletions
@@ -372,27 +372,6 @@ class Kotlin2JsIrGradlePluginIT : KGPBaseTest() {
}
}
@DisplayName("per-file with the declarations validation")
@GradleTest
fun testPerFileProjectWithResultFilesClash(gradleVersion: GradleVersion) {
project("kotlin-js-invalid-per-file-project", gradleVersion) {
buildAndFail("compileDevelopmentExecutableKotlinJs") {
assertTasksFailed(":compileDevelopmentExecutableKotlinJs")
assertOutputContains("""
|There are two files in module '<kotlin-js-invalid-per-file-project>' that have the similar package and file names.
| - Package "com.example" and
""".trimMargin())
}
buildAndFail("compileProductionExecutableKotlinJs") {
assertTasksFailed(":compileProductionExecutableKotlinJs")
assertOutputContains("""
|There are two files in module '<kotlin-js-invalid-per-file-project>' that have the similar package and file names.
| - Package "com.example" and path
""".trimMargin())
}
}
}
@DisplayName("fully qualified names can be used in the sourcemap")
@GradleTest
fun testKotlinJsSourceMapGenerateFqNames(gradleVersion: GradleVersion) {
@@ -1,16 +0,0 @@
plugins {
kotlin("js")
}
repositories {
mavenLocal()
mavenCentral()
}
kotlin {
js(IR) {
useEsModules()
binaries.executable()
nodejs()
}
}
@@ -1,8 +0,0 @@
kotlin.tests.individualTaskReports=true
kotlin.js.ir.output.granularity=per-file
kotlin.incremental=false
kotlin.incremental.js=false
kotlin.incremental.js.ir=false
kotlin.incremental.js.klib=false
kotlin.incremental.multiplatform=false
kotlin.incremental.useClasspathSnapshot=false
@@ -1,16 +0,0 @@
/*
* 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
@JsExport
fun best(): Int {
return 42
}
@JsExport
fun simpleBest(): Int {
return 73
}
@@ -1,9 +0,0 @@
/*
* 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
@JsExport
public val foo = 44