diff --git a/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index e939d5f5f65..ac2a13f6547 100644 --- a/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps/jps-plugin/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -82,8 +82,8 @@ public abstract class AbstractIncrementalJpsTest( TestLoggerFactory.enableDebugLogging(myTestRootDisposable, "#org") val console = ConsoleAppender() - console.setLayout(PatternLayout("%d [%p|%c|%C{1}] %m%n")); - console.setThreshold(Level.ALL) + console.layout = PatternLayout("%d [%p|%c|%C{1}] %m%n"); + console.threshold = Level.ALL console.activateOptions() Logger.getRootLogger().addAppender(console) } @@ -110,7 +110,7 @@ public abstract class AbstractIncrementalJpsTest( protected open fun checkLookups(@suppress("UNUSED_PARAMETER") lookupTracker: LookupTracker) {} fun build(scope: CompileScopeTestBuilder = CompileScopeTestBuilder.make().all()): MakeResult { - val workDirPath = FileUtil.toSystemIndependentName(workDir.getAbsolutePath()) + val workDirPath = FileUtil.toSystemIndependentName(workDir.absolutePath) val logger = MyLogger(workDirPath) val descriptor = createProjectDescriptor(BuildLoggingManager(logger)) @@ -126,11 +126,11 @@ public abstract class AbstractIncrementalJpsTest( checkLookups(lookupTracker) - if (!buildResult.isSuccessful()) { + if (!buildResult.isSuccessful) { val errorMessages = buildResult .getMessages(BuildMessage.Kind.ERROR) - .map { it.getMessageText() } + .map { it.messageText } .map { it.replace("^.+:\\d+:\\s+".toRegex(), "").trim() } .joinToString("\n") return MakeResult(logger.log + "$COMPILATION_FAILED\n" + errorMessages + "\n", true, null) @@ -170,7 +170,7 @@ public abstract class AbstractIncrementalJpsTest( assert(moduleNames != null) { "File name has module prefix, but multi-module environment is absent" } assert(module in moduleNames!!) { "Module not found for file with prefix: $fileName" } - return module + "/src" + return "$module/src" } assert(moduleNames == null) { "Test is multi-module, but file has no module prefix: $fileName" } @@ -240,7 +240,7 @@ public abstract class AbstractIncrementalJpsTest( } private fun clearCachesRebuildAndCheckOutput(makeOverallResult: MakeResult) { - FileUtil.delete(BuildDataPathsImpl(myDataStorageRoot).getDataStorageRoot()!!) + FileUtil.delete(BuildDataPathsImpl(myDataStorageRoot).dataStorageRoot!!) rebuildAndCheckOutput(makeOverallResult) } @@ -251,10 +251,10 @@ public abstract class AbstractIncrementalJpsTest( val result = HashMap>() for (line in dependenciesTxt.readLines()) { - val split = line.splitBy("->") + val split = line.split("->") val module = split[0] val dependencies = if (split.size() > 1) split[1] else "" - val dependencyList = dependencies.splitBy(",").filterNot { it.isEmpty() } + val dependencyList = dependencies.split(",").filterNot { it.isEmpty() } result[module] = dependencyList } @@ -289,7 +289,7 @@ public abstract class AbstractIncrementalJpsTest( private fun createKotlinIncrementalCacheDump(project: ProjectDescriptor): String { return StringBuilder { - for (target in project.getBuildTargetIndex().getAllTargets().sortBy { it.getPresentableName() }) { + for (target in project.buildTargetIndex.allTargets.sortBy { it.presentableName }) { append("\n") append(project.dataManager.getKotlinCache(target).dump()) append("\n\n\n") @@ -304,15 +304,15 @@ public abstract class AbstractIncrementalJpsTest( result.println("Begin of SourceToOutputMap") result.pushIndent() - for (target in project.getBuildTargetIndex().getAllTargets()) { + for (target in project.buildTargetIndex.allTargets) { result.println(target) result.pushIndent() val mapping = project.dataManager.getSourceToOutputMap(target) - mapping.getSources().forEach { + mapping.sources.forEach { val outputs = mapping.getOutputs(it)!!.sort() if (outputs.isNotEmpty()) { - result.println("source $it -> " + outputs) + result.println("source $it -> $outputs") } } @@ -328,7 +328,7 @@ public abstract class AbstractIncrementalJpsTest( private fun createJavaMappingsDump(project: ProjectDescriptor): String { val byteArrayOutputStream = ByteArrayOutputStream() PrintStream(byteArrayOutputStream).use { - project.dataManager.getMappings().toStream(it) + project.dataManager.mappings.toStream(it) } return byteArrayOutputStream.toString() } @@ -353,8 +353,7 @@ public abstract class AbstractIncrementalJpsTest( // null means one module private fun configureModules(): Set? { var moduleNames: Set? - JpsJavaExtensionService.getInstance().getOrCreateProjectExtension(myProject) - .setOutputUrl(JpsPathUtil.pathToUrl(getAbsolutePath("out"))) + JpsJavaExtensionService.getInstance().getOrCreateProjectExtension(myProject).outputUrl = JpsPathUtil.pathToUrl(getAbsolutePath("out")) val jdk = addJdk("my jdk") val moduleDependencies = readModuleDependencies() @@ -370,7 +369,7 @@ public abstract class AbstractIncrementalJpsTest( } else { val nameToModule = moduleDependencies.keySet() - .keysToMap { addModule(it, arrayOf(getAbsolutePath(it + "/src")), null, null, jdk)!! } + .keysToMap { addModule(it, arrayOf(getAbsolutePath("$it/src")), null, null, jdk)!! } for ((moduleName, dependencies) in moduleDependencies) { val module = nameToModule[moduleName]!! @@ -380,9 +379,9 @@ public abstract class AbstractIncrementalJpsTest( } for (module in nameToModule.values()) { - val moduleName = module.getName() + val moduleName = module.name - val srcDir = File(workDir, moduleName + "/src") + val srcDir = File(workDir, "$moduleName/src") FileUtil.copyDir(testDataDir, srcDir, { it.getName().startsWith(moduleName + "_") && (it.getName().endsWith(".kt") || it.getName().endsWith(".java")) }) @@ -408,14 +407,14 @@ public abstract class AbstractIncrementalJpsTest( override fun isEnabled(): Boolean = true override fun logLine(message: String?) { - logBuf.append(JetTestUtils.replaceHashWithStar(message!!.removePrefix(rootPath + "/"))).append('\n') + logBuf.append(JetTestUtils.replaceHashWithStar(message!!.removePrefix("$rootPath/"))).append('\n') } } private abstract class Modification(val path: String) { abstract fun perform(workDir: File) - override fun toString(): String = "${javaClass.getSimpleName()} $path" + override fun toString(): String = "${javaClass.simpleName} $path" } private class ModifyContent(path: String, val dataFile: File) : Modification(path) {