diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt
index 1bcda00d3a0..2c033ca0503 100644
--- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt
+++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTest.kt
@@ -752,7 +752,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
}
- private fun checkOutputFilesList(outputDir: File = productionOutputDir) {
+ protected fun checkOutputFilesList(outputDir: File = productionOutputDir) {
if (!expectedOutputFile.exists()) {
expectedOutputFile.writeText("")
throw IllegalStateException("$expectedOutputFile did not exist. Created empty file.")
diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt
index 85166819553..63d4bbf0036 100644
--- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt
+++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt
@@ -36,18 +36,35 @@ import java.io.File
class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() {
var isICEnabledBackup: Boolean = false
+ var isICEnabledForJsBackup: Boolean = false
override fun setUp() {
super.setUp()
isICEnabledBackup = IncrementalCompilation.isEnabledForJvm()
IncrementalCompilation.setIsEnabledForJvm(true)
+
+ isICEnabledForJsBackup = IncrementalCompilation.isEnabledForJs()
+ IncrementalCompilation.setIsEnabledForJs(true)
}
override fun tearDown() {
IncrementalCompilation.setIsEnabledForJvm(isICEnabledBackup)
+ IncrementalCompilation.setIsEnabledForJs(isICEnabledForJsBackup)
+
super.tearDown()
}
+ fun testKotlinJavaScriptChangePackage() {
+ initProject(LibraryDependency.JS_STDLIB)
+ buildAllModules().assertSuccessful()
+
+ val class2Kt = File(workDir, "src/Class2.kt")
+ val newClass2KtContent = class2Kt.readText().replace("package2", "package1")
+ JpsBuildTestCase.change(class2Kt.path, newClass2KtContent)
+ buildAllModules().assertSuccessful()
+ checkOutputFilesList(File(workDir, "out/production"))
+ }
+
fun testRelocatableCaches() {
fun buildAndGetMappings(): String {
workDir.deleteRecursively()
diff --git a/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/expected-output.txt b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/expected-output.txt
new file mode 100644
index 00000000000..ab908429b52
--- /dev/null
+++ b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/expected-output.txt
@@ -0,0 +1,9 @@
+kotlinProject/
+ kotlinProject/
+ package1/
+ package1.kjsm
+ kotlinProject.js
+ kotlinProject.meta.js
+ lib/
+ kotlin.js
+ kotlin.meta.js
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/kotlinProject.iml b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/kotlinProject.iml
new file mode 100644
index 00000000000..a0cbe548242
--- /dev/null
+++ b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/kotlinProject.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/kotlinProject.ipr b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/kotlinProject.ipr
new file mode 100644
index 00000000000..90747786771
--- /dev/null
+++ b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/kotlinProject.ipr
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/src/Class1.kt b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/src/Class1.kt
new file mode 100644
index 00000000000..0e406383c52
--- /dev/null
+++ b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/src/Class1.kt
@@ -0,0 +1,3 @@
+package package1
+
+class Class1
\ No newline at end of file
diff --git a/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/src/Class2.kt b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/src/Class2.kt
new file mode 100644
index 00000000000..7df6ade3cc8
--- /dev/null
+++ b/jps/jps-plugin/testData/general/KotlinJavaScriptChangePackage/src/Class2.kt
@@ -0,0 +1,3 @@
+package package2
+
+class Class2
\ No newline at end of file