From 2f3ff102044d3ae70c0389d2fdb2fd57ecc1f026 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Thu, 14 May 2020 15:35:35 +0200 Subject: [PATCH] formatting clean up --- .../jetbrains/kotlin/incremental/buildUtil.kt | 80 ++++++++++--------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt b/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt index bf7d5454f6f..a7751a89583 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt @@ -37,32 +37,32 @@ import kotlin.collections.HashSet const val DELETE_MODULE_FILE_PROPERTY = "kotlin.delete.module.file.after.build" fun makeModuleFile( - name: String, - isTest: Boolean, - outputDir: File, - sourcesToCompile: Iterable, - commonSources: Iterable, - javaSourceRoots: Iterable, - classpath: Iterable, - friendDirs: Iterable + name: String, + isTest: Boolean, + outputDir: File, + sourcesToCompile: Iterable, + commonSources: Iterable, + javaSourceRoots: Iterable, + classpath: Iterable, + friendDirs: Iterable ): File { val builder = KotlinModuleXmlBuilder() builder.addModule( - name, - outputDir.absolutePath, - // important to transform file to absolute paths, - // otherwise compiler will use module file's parent as base path (a temporary file; see below) - // (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths) - sourcesToCompile.map { it.absoluteFile }, - javaSourceRoots, - classpath, - commonSources.map { it.absoluteFile }, - null, - "java-production", - isTest, - // this excludes the output directories from the class path, to be removed for true incremental compilation - setOf(outputDir), - friendDirs + name, + outputDir.absolutePath, + // important to transform file to absolute paths, + // otherwise compiler will use module file's parent as base path (a temporary file; see below) + // (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths) + sourcesToCompile.map { it.absoluteFile }, + javaSourceRoots, + classpath, + commonSources.map { it.absoluteFile }, + null, + "java-production", + isTest, + // this excludes the output directories from the class path, to be removed for true incremental compilation + setOf(outputDir), + friendDirs ) val scriptFile = File.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml") @@ -83,9 +83,9 @@ private fun sanitizeJavaIdentifier(string: String) = } fun makeCompileServices( - incrementalCaches: Map, - lookupTracker: LookupTracker, - compilationCanceledStatus: CompilationCanceledStatus? + incrementalCaches: Map, + lookupTracker: LookupTracker, + compilationCanceledStatus: CompilationCanceledStatus? ): Services = with(Services.Builder()) { register(LookupTracker::class.java, lookupTracker) @@ -105,12 +105,14 @@ fun updateIncrementalCache( for (generatedFile in generatedFiles) { when { generatedFile is GeneratedJvmClass -> cache.saveFileToCache(generatedFile, changesCollector) - generatedFile.outputFile.isModuleMappingFile() -> cache.saveModuleMappingToCache(generatedFile.sourceFiles, generatedFile.outputFile) + generatedFile.outputFile.isModuleMappingFile() -> cache.saveModuleMappingToCache( + generatedFile.sourceFiles, + generatedFile.outputFile + ) } } - javaChangesTracker?.javaClassesUpdates?.forEach { - (source, serializedJavaClass) -> + javaChangesTracker?.javaClassesUpdates?.forEach { (source, serializedJavaClass) -> cache.saveJavaClassProto(source, serializedJavaClass, changesCollector) } @@ -118,9 +120,9 @@ fun updateIncrementalCache( } fun LookupStorage.update( - lookupTracker: LookupTracker, - filesToCompile: Iterable, - removedFiles: Iterable + lookupTracker: LookupTracker, + filesToCompile: Iterable, + removedFiles: Iterable ) { if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker::class.java}") @@ -130,8 +132,8 @@ fun LookupStorage.update( } data class DirtyData( - val dirtyLookupSymbols: Collection = emptyList(), - val dirtyClassesFqNames: Collection = emptyList() + val dirtyLookupSymbols: Collection = emptyList(), + val dirtyClassesFqNames: Collection = emptyList() ) fun ChangesCollector.getDirtyData( @@ -213,8 +215,8 @@ fun mapClassesFqNamesToFiles( } fun withSubtypes( - typeFqName: FqName, - caches: Iterable + typeFqName: FqName, + caches: Iterable ): Set { val types = LinkedList(listOf(typeFqName)) val subtypes = hashSetOf() @@ -223,9 +225,9 @@ fun withSubtypes( val unprocessedType = types.pollFirst() caches.asSequence() - .flatMap { it.getSubtypesOf(unprocessedType) } - .filter { it !in subtypes } - .forEach { types.addLast(it) } + .flatMap { it.getSubtypesOf(unprocessedType) } + .filter { it !in subtypes } + .forEach { types.addLast(it) } subtypes.add(unprocessedType) }