Do not expose paths with placeholders in JS IC caches

#KT-31310 Fixed
This commit is contained in:
Alexey Tsvetkov
2019-05-15 19:01:52 +03:00
parent d2c372a4f7
commit 209a5d8464
8 changed files with 62 additions and 5 deletions
@@ -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.")
@@ -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()