From d849d47e220818484ea707019e34f21a29ff85db Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Tue, 27 Mar 2018 16:30:07 +0300 Subject: [PATCH] Reformat jps-plugin module Original commit: 455fe7fe61f396d2df766544d2799b9482938497 --- .../NullabilityAnnotationsTracker.kt | 32 +- .../compilerRunner/CompilerRunnerUtil.java | 1 - .../compilerRunner/JpsCompilerEnvironment.kt | 10 +- .../JpsCompilerServicesFacadeImpl.kt | 21 +- .../compilerRunner/JpsKotlinCompilerRunner.kt | 115 ++++--- .../kotlin/jps/JpsKotlinCompilerSettings.kt | 6 +- .../kotlin/jps/build/FSOperationsHelper.kt | 17 +- .../kotlin/jps/build/JpsJsModuleUtils.kt | 15 +- .../jetbrains/kotlin/jps/build/JpsUtils.java | 12 +- .../kotlin/jps/build/KotlinBuilder.kt | 302 ++++++++++-------- .../KotlinBuilderModuleScriptGenerator.kt | 66 ++-- .../jps/build/KotlinSourceFileCollector.java | 22 +- .../jetbrains/kotlin/jps/build/MarkerFile.kt | 3 +- .../jps/build/TeamcityStatisticsLogger.kt | 11 +- .../jps/incremental/JpsIncrementalJvmCache.kt | 12 +- .../KotlinDataContainerTargetType.kt | 18 +- .../kotlin/jps/incremental/storages/values.kt | 18 +- .../BaseJpsCompilerSettingsSerializer.kt | 6 +- .../JpsKotlinFacetConfigurationSerializer.kt | 20 +- .../Kotlin2JsCompilerArgumentsSerializer.kt | 2 +- .../Kotlin2JvmCompilerArgumentsSerializer.kt | 2 +- ...KotlinCommonCompilerArgumentsSerializer.kt | 2 +- .../model/KotlinCompilerSettingsSerializer.kt | 2 +- 23 files changed, 380 insertions(+), 335 deletions(-) diff --git a/jps/jps-plugin/src/org/jetbrains/jps/builders/java/dependencyView/NullabilityAnnotationsTracker.kt b/jps/jps-plugin/src/org/jetbrains/jps/builders/java/dependencyView/NullabilityAnnotationsTracker.kt index 940a09fde89..7e202b9b1fc 100644 --- a/jps/jps-plugin/src/org/jetbrains/jps/builders/java/dependencyView/NullabilityAnnotationsTracker.kt +++ b/jps/jps-plugin/src/org/jetbrains/jps/builders/java/dependencyView/NullabilityAnnotationsTracker.kt @@ -25,30 +25,36 @@ import org.jetbrains.kotlin.load.java.NULLABLE_ANNOTATIONS import java.util.* internal class NullabilityAnnotationsTracker : AnnotationsChangeTracker() { - private val annotations = (NULLABLE_ANNOTATIONS + JAVAX_NONNULL_ANNOTATION + NOT_NULL_ANNOTATIONS).mapTo(HashSet()) { it.internalNameWithoutInnerClasses }.toTypedArray() + private val annotations = + (NULLABLE_ANNOTATIONS + JAVAX_NONNULL_ANNOTATION + NOT_NULL_ANNOTATIONS).mapTo(HashSet()) { it.internalNameWithoutInnerClasses } + .toTypedArray() override fun methodAnnotationsChanged( - context: DependencyContext, - method: MethodRepr, - annotationsDiff: Difference.Specifier, - paramAnnotationsDiff: Difference.Specifier + context: DependencyContext, + method: MethodRepr, + annotationsDiff: Difference.Specifier, + paramAnnotationsDiff: Difference.Specifier ): Set { val changedAnnotations = annotationsDiff.addedOrRemoved() + - paramAnnotationsDiff.addedOrRemoved().map { it.type } + paramAnnotationsDiff.addedOrRemoved().map { it.type } return handleNullAnnotationsChanges(context, method, changedAnnotations) } override fun fieldAnnotationsChanged( - context: NamingContext, - field: FieldRepr, - annotationsDiff: Difference.Specifier + context: NamingContext, + field: FieldRepr, + annotationsDiff: Difference.Specifier ): Set { return handleNullAnnotationsChanges(context, field, annotationsDiff.addedOrRemoved()) } - private fun handleNullAnnotationsChanges(context: NamingContext, protoMember: ProtoMember, annotations: Sequence): Set { + private fun handleNullAnnotationsChanges( + context: NamingContext, + protoMember: ProtoMember, + annotations: Sequence + ): Set { val nullabilityAnnotations = TIntHashSet(this.annotations.toIntArray { context.get(it) }) val changedNullAnnotation = annotations.firstOrNull { nullabilityAnnotations.contains(it.className) } @@ -66,8 +72,8 @@ internal class NullabilityAnnotationsTracker : AnnotationsChangeTracker() { } private fun Difference.Specifier.addedOrRemoved(): Sequence = - added().asSequence() + removed().asSequence() + added().asSequence() + removed().asSequence() - private inline fun Array.toIntArray(fn: (T)->Int): IntArray = - IntArray(size) { i -> fn(get(i)) } + private inline fun Array.toIntArray(fn: (T) -> Int): IntArray = + IntArray(size) { i -> fn(get(i)) } } \ No newline at end of file diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/CompilerRunnerUtil.java b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/CompilerRunnerUtil.java index 7ee8d7e6ee9..cf8b0c8c4cd 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/CompilerRunnerUtil.java +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/CompilerRunnerUtil.java @@ -125,5 +125,4 @@ public class CompilerRunnerUtil { return null; } - } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment.kt index 58cbe194574..bd08f0fb4bd 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment.kt @@ -22,11 +22,11 @@ import org.jetbrains.kotlin.preloading.ClassCondition import org.jetbrains.kotlin.utils.KotlinPaths class JpsCompilerEnvironment( - val kotlinPaths: KotlinPaths, - services: Services, - val classesToLoadByParent: ClassCondition, - messageCollector: MessageCollector, - outputItemsCollector: OutputItemsCollectorImpl + val kotlinPaths: KotlinPaths, + services: Services, + val classesToLoadByParent: ClassCondition, + messageCollector: MessageCollector, + outputItemsCollector: OutputItemsCollectorImpl ) : CompilerEnvironment(services, messageCollector, outputItemsCollector) { override val outputItemsCollector: OutputItemsCollectorImpl get() = super.outputItemsCollector as OutputItemsCollectorImpl diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt index 6dd63e7bb5c..0d3ad786b08 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsCompilerServicesFacadeImpl.kt @@ -26,17 +26,20 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus import java.io.Serializable internal class JpsCompilerServicesFacadeImpl( - private val env: JpsCompilerEnvironment, - port: Int = SOCKET_ANY_FREE_PORT -) : CompilerCallbackServicesFacadeServer(env.services.get(IncrementalCompilationComponents::class.java), - env.services.get(LookupTracker::class.java), - env.services.get(CompilationCanceledStatus::class.java), - port), - JpsCompilerServicesFacade { + private val env: JpsCompilerEnvironment, + port: Int = SOCKET_ANY_FREE_PORT +) : CompilerCallbackServicesFacadeServer( + env.services.get(IncrementalCompilationComponents::class.java), + env.services.get(LookupTracker::class.java), + env.services.get(CompilationCanceledStatus::class.java), + port +), + JpsCompilerServicesFacade { override fun report(category: Int, severity: Int, message: String?, attachment: Serializable?) { env.messageCollector.reportFromDaemon( - { outFile, srcFiles -> env.outputItemsCollector.add(srcFiles, outFile) }, - category, severity, message, attachment) + { outFile, srcFiles -> env.outputItemsCollector.add(srcFiles, outFile) }, + category, severity, message, attachment + ) } } \ No newline at end of file diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt index 031a869af69..70a3204b43f 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt @@ -39,13 +39,12 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { private var compilerSettings: CompilerSettings? = null - private inline fun withCompilerSettings(settings: CompilerSettings, fn: ()->Unit) { + private inline fun withCompilerSettings(settings: CompilerSettings, fn: () -> Unit) { val old = compilerSettings try { compilerSettings = settings fn() - } - finally { + } finally { compilerSettings = old } } @@ -55,14 +54,14 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { private var _jpsCompileServiceSession: CompileServiceSession? = null @Synchronized - private fun getOrCreateDaemonConnection(newConnection: ()-> CompileServiceSession?): CompileServiceSession? { + private fun getOrCreateDaemonConnection(newConnection: () -> CompileServiceSession?): CompileServiceSession? { // TODO: consider adding state "ping" to the daemon interface if (_jpsCompileServiceSession == null || _jpsCompileServiceSession!!.compileService.getDaemonOptions() !is CompileService.CallResult.Good) { - _jpsCompileServiceSession?. let { + _jpsCompileServiceSession?.let { try { it.compileService.releaseCompileSession(it.sessionId) + } catch (_: Throwable) { } - catch (_: Throwable) {} } _jpsCompileServiceSession = newConnection() } @@ -74,11 +73,11 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { } fun runK2JvmCompiler( - commonArguments: CommonCompilerArguments, - k2jvmArguments: K2JVMCompilerArguments, - compilerSettings: CompilerSettings, - environment: JpsCompilerEnvironment, - moduleFile: File + commonArguments: CommonCompilerArguments, + k2jvmArguments: K2JVMCompilerArguments, + compilerSettings: CompilerSettings, + environment: JpsCompilerEnvironment, + moduleFile: File ) { val arguments = mergeBeans(commonArguments, XmlSerializerUtil.createCopy(k2jvmArguments)) setupK2JvmArguments(moduleFile, arguments) @@ -88,15 +87,15 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { } fun runK2JsCompiler( - commonArguments: CommonCompilerArguments, - k2jsArguments: K2JSCompilerArguments, - compilerSettings: CompilerSettings, - environment: JpsCompilerEnvironment, - sourceFiles: Collection, - sourceRoots: Collection, - libraries: List, - friendModules: List, - outputFile: File + commonArguments: CommonCompilerArguments, + k2jsArguments: K2JSCompilerArguments, + compilerSettings: CompilerSettings, + environment: JpsCompilerEnvironment, + sourceFiles: Collection, + sourceRoots: Collection, + libraries: List, + friendModules: List, + outputFile: File ) { log.debug("K2JS: common arguments: " + ArgumentUtils.convertArgumentsToStringList(commonArguments)) log.debug("K2JS: JS arguments: " + ArgumentUtils.convertArgumentsToStringList(k2jsArguments)) @@ -117,25 +116,24 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { } override fun compileWithDaemonOrFallback( - compilerClassName: String, - compilerArgs: CommonCompilerArguments, - environment: JpsCompilerEnvironment + compilerClassName: String, + compilerArgs: CommonCompilerArguments, + environment: JpsCompilerEnvironment ): ExitCode { log.debug("Using kotlin-home = " + environment.kotlinPaths.homePath) return if (isDaemonEnabled()) { val daemonExitCode = compileWithDaemon(compilerClassName, compilerArgs, environment) daemonExitCode ?: fallbackCompileStrategy(compilerArgs, compilerClassName, environment) - } - else { + } else { fallbackCompileStrategy(compilerArgs, compilerClassName, environment) } } override fun compileWithDaemon( - compilerClassName: String, - compilerArgs: CommonCompilerArguments, - environment: JpsCompilerEnvironment + compilerClassName: String, + compilerArgs: CommonCompilerArguments, + environment: JpsCompilerEnvironment ): ExitCode? { val targetPlatform = when (compilerClassName) { K2JVM_COMPILER -> CompileService.TargetPlatform.JVM @@ -154,15 +152,22 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { val (daemon, sessionId) = connection val compilerMode = CompilerMode.JPS_COMPILER val verbose = compilerArgs.verbose - val options = CompilationOptions(compilerMode, targetPlatform, reportCategories(verbose), reportSeverity(verbose), requestedCompilationResults = emptyArray()) - val res = daemon.compile(sessionId, withAdditionalCompilerArgs(compilerArgs), options, JpsCompilerServicesFacadeImpl(environment), null) + val options = CompilationOptions( + compilerMode, + targetPlatform, + reportCategories(verbose), + reportSeverity(verbose), + requestedCompilationResults = emptyArray() + ) + val res = + daemon.compile(sessionId, withAdditionalCompilerArgs(compilerArgs), options, JpsCompilerServicesFacadeImpl(environment), null) // TODO: consider implementing connection retry, instead of fallback here return res.takeUnless { it is CompileService.CallResult.Dying }?.let { exitCodeFromProcessExitCode(it.get()) } } private fun withAdditionalCompilerArgs(compilerArgs: CommonCompilerArguments): Array { val allArgs = ArgumentUtils.convertArgumentsToStringList(compilerArgs) + - (compilerSettings?.additionalArgumentsAsList ?: emptyList()) + (compilerSettings?.additionalArgumentsAsList ?: emptyList()) return allArgs.toTypedArray() } @@ -170,8 +175,7 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { val categories = if (!verbose) { arrayOf(ReportCategory.COMPILER_MESSAGE, ReportCategory.EXCEPTION) - } - else { + } else { ReportCategory.values() } @@ -180,17 +184,16 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { private fun reportSeverity(verbose: Boolean): Int = - if (!verbose) { - ReportSeverity.INFO.code - } - else { - ReportSeverity.DEBUG.code - } + if (!verbose) { + ReportSeverity.INFO.code + } else { + ReportSeverity.DEBUG.code + } private fun fallbackCompileStrategy( - compilerArgs: CommonCompilerArguments, - compilerClassName: String, - environment: JpsCompilerEnvironment + compilerArgs: CommonCompilerArguments, + compilerClassName: String, + environment: JpsCompilerEnvironment ): ExitCode { if ("true" == System.getProperty("kotlin.jps.tests") && "true" == System.getProperty(FAIL_ON_FALLBACK_PROPERTY)) { error("Fallback strategy is disabled in tests!") @@ -227,7 +230,13 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { } } - private fun setupK2JsArguments(_outputFile: File, sourceFiles: Collection, _libraries: List, _friendModules: List, settings: K2JSCompilerArguments) { + private fun setupK2JsArguments( + _outputFile: File, + sourceFiles: Collection, + _libraries: List, + _friendModules: List, + settings: K2JSCompilerArguments + ) { with(settings) { noStdlib = true freeArgs = sourceFiles.map { it.path }.toMutableList() @@ -245,15 +254,15 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { } override fun getDaemonConnection(environment: JpsCompilerEnvironment): CompileServiceSession? = - getOrCreateDaemonConnection { - val libPath = CompilerRunnerUtil.getLibPath(environment.kotlinPaths, environment.messageCollector) - val compilerPath = File(libPath, "kotlin-compiler.jar") - val toolsJarPath = CompilerRunnerUtil.getJdkToolsJar() - val compilerId = CompilerId.makeCompilerId(listOfNotNull(compilerPath, toolsJarPath) ) - val daemonOptions = configureDaemonOptions() + getOrCreateDaemonConnection { + val libPath = CompilerRunnerUtil.getLibPath(environment.kotlinPaths, environment.messageCollector) + val compilerPath = File(libPath, "kotlin-compiler.jar") + val toolsJarPath = CompilerRunnerUtil.getJdkToolsJar() + val compilerId = CompilerId.makeCompilerId(listOfNotNull(compilerPath, toolsJarPath)) + val daemonOptions = configureDaemonOptions() - val clientFlagFile = KotlinCompilerClient.getOrCreateClientFlagFile(daemonOptions) - val sessionFlagFile = makeAutodeletingFlagFile("compiler-jps-session-", File(daemonOptions.runFilesPathOrDefault)) - newDaemonConnection(compilerId, clientFlagFile, sessionFlagFile, environment, daemonOptions) - } + val clientFlagFile = KotlinCompilerClient.getOrCreateClientFlagFile(daemonOptions) + val sessionFlagFile = makeAutodeletingFlagFile("compiler-jps-session-", File(daemonOptions.runFilesPathOrDefault)) + newDaemonConnection(compilerId, clientFlagFile, sessionFlagFile, environment, daemonOptions) + } } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt index 512b45fc59a..b31103196fa 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt @@ -69,9 +69,9 @@ class JpsKotlinCompilerSettings : JpsElementBase() { val facetArguments = facetSettings.compilerArguments ?: return defaultArguments return copyBean(facetArguments).apply { multiPlatform = module - .dependenciesList - .dependencies - .any { (it as? JpsModuleDependency)?.module?.targetPlatform == TargetPlatformKind.Common } + .dependenciesList + .dependencies + .any { (it as? JpsModuleDependency)?.module?.targetPlatform == TargetPlatformKind.Common } } } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/FSOperationsHelper.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/FSOperationsHelper.kt index ad996865e47..d112f4d6fd4 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/FSOperationsHelper.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/FSOperationsHelper.kt @@ -30,9 +30,9 @@ import java.io.File import java.util.HashMap class FSOperationsHelper( - private val compileContext: CompileContext, - private val chunk: ModuleChunk, - private val log: Logger + private val compileContext: CompileContext, + private val chunk: ModuleChunk, + private val log: Logger ) { private val moduleBasedFilter = ModulesBasedFileFilter(compileContext, chunk) @@ -53,8 +53,7 @@ class FSOperationsHelper( if (recursively) { FSOperations.markDirtyRecursively(compileContext, CompilationRound.NEXT, chunk, ::shouldMark) - } - else { + } else { FSOperations.markDirty(compileContext, CompilationRound.NEXT, chunk, ::shouldMark) } } @@ -67,7 +66,7 @@ class FSOperationsHelper( markFilesImpl(files) { it !in excludeFiles && it.exists() && moduleBasedFilter.accept(it) } } - private inline fun markFilesImpl(files: Iterable, shouldMark: (File)->Boolean) { + private inline fun markFilesImpl(files: Iterable, shouldMark: (File) -> Boolean) { val filesToMark = files.filterTo(HashSet(), shouldMark) if (filesToMark.isEmpty()) return @@ -83,9 +82,9 @@ class FSOperationsHelper( // Based on `JavaBuilderUtil#ModulesBasedFileFilter` from Intellij private class ModulesBasedFileFilter( - private val context: CompileContext, - chunk: ModuleChunk - ): Mappings.DependentFilesFilter { + private val context: CompileContext, + chunk: ModuleChunk + ) : Mappings.DependentFilesFilter { private val chunkTargets = chunk.targets private val buildRootIndex = context.projectDescriptor.buildRootIndex private val buildTargetIndex = context.projectDescriptor.buildTargetIndex diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsJsModuleUtils.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsJsModuleUtils.kt index 2f507500b58..02f8738c384 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsJsModuleUtils.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsJsModuleUtils.kt @@ -70,24 +70,25 @@ object JpsJsModuleUtils { @JvmStatic fun getOutputMetaFile(module: JpsModule, isTests: Boolean): File { - val moduleBuildTarget = ModuleBuildTarget(module, if (isTests) JavaModuleBuildTargetType.TEST else JavaModuleBuildTargetType.PRODUCTION) + val moduleBuildTarget = + ModuleBuildTarget(module, if (isTests) JavaModuleBuildTargetType.TEST else JavaModuleBuildTargetType.PRODUCTION) val outputDir = KotlinBuilderModuleScriptGenerator.getOutputDirSafe(moduleBuildTarget) return getOutputMetaFile(outputDir, module.name, isTests) } @JvmStatic - fun getOutputFile(outputDir: File, moduleName: String, isTests: Boolean) - = File(outputDir, moduleName + suffix(isTests) + KotlinJavascriptMetadataUtils.JS_EXT) + fun getOutputFile(outputDir: File, moduleName: String, isTests: Boolean) = + File(outputDir, moduleName + suffix(isTests) + KotlinJavascriptMetadataUtils.JS_EXT) @JvmStatic - fun getOutputMetaFile(outputDir: File, moduleName: String, isTests: Boolean) - = File(outputDir, moduleName + suffix(isTests) + KotlinJavascriptMetadataUtils.META_JS_SUFFIX) + fun getOutputMetaFile(outputDir: File, moduleName: String, isTests: Boolean) = + File(outputDir, moduleName + suffix(isTests) + KotlinJavascriptMetadataUtils.META_JS_SUFFIX) private fun suffix(isTests: Boolean) = if (isTests) "_test" else "" } val JpsModule.hasProductionSourceRoot - get() = sourceRoots.any { it.rootType == JavaSourceRootType.SOURCE} + get() = sourceRoots.any { it.rootType == JavaSourceRootType.SOURCE } val JpsModule.hasTestSourceRoot - get() = sourceRoots.any { it.rootType == JavaSourceRootType.TEST_SOURCE} \ No newline at end of file + get() = sourceRoots.any { it.rootType == JavaSourceRootType.TEST_SOURCE } \ No newline at end of file diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsUtils.java b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsUtils.java index 577f4e8c358..31e3cbe62f5 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsUtils.java +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/JpsUtils.java @@ -37,7 +37,9 @@ import java.util.concurrent.ConcurrentHashMap; class JpsUtils { private static final Map IS_KOTLIN_JS_MODULE_CACHE = new ConcurrentHashMap(); private static final Map IS_KOTLIN_JS_STDLIB_JAR_CACHE = new ConcurrentHashMap(); - private JpsUtils() {} + + private JpsUtils() { + } @NotNull static JpsJavaDependenciesEnumerator getAllDependencies(@NotNull ModuleBuildTarget target) { @@ -66,8 +68,12 @@ class JpsUtils { Boolean cachedValue = IS_KOTLIN_JS_STDLIB_JAR_CACHE.get(url); if (cachedValue != null) { - if (cachedValue.booleanValue()) return true; - else continue; + if (cachedValue.booleanValue()) { + return true; + } + else { + continue; + } } boolean isKotlinJavascriptStdLibrary = LibraryUtils.isKotlinJavascriptStdLibrary(JpsPathUtil.urlToFile(url)); diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index fad89465a20..8957d7daea7 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -29,7 +29,6 @@ import org.jetbrains.jps.builders.java.JavaBuilderUtil import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor import org.jetbrains.jps.incremental.* import org.jetbrains.jps.incremental.ModuleLevelBuilder.ExitCode.* -import org.jetbrains.jps.incremental.fs.CompilationRound import org.jetbrains.jps.incremental.java.JavaBuilder import org.jetbrains.jps.incremental.messages.BuildMessage import org.jetbrains.jps.incremental.messages.CompilerMessage @@ -70,10 +69,11 @@ import java.io.File import java.io.IOException import java.net.URI import java.util.* +import kotlin.collections.HashSet class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { companion object { - @JvmField val KOTLIN_BUILDER_NAME: String = "Kotlin Builder" + const val KOTLIN_BUILDER_NAME: String = "Kotlin Builder" val LOG = Logger.getInstance("#org.jetbrains.kotlin.jps.build.KotlinBuilder") const val JVM_BUILD_META_INFO_FILE_NAME = "jvm-build-meta-info.txt" @@ -83,14 +83,14 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { val classesToLoadByParent: ClassCondition get() = ClassCondition { className -> className.startsWith("org.jetbrains.kotlin.load.kotlin.incremental.components.") - || className.startsWith("org.jetbrains.kotlin.incremental.components.") - || className.startsWith("org.jetbrains.kotlin.incremental.js") - || className == "org.jetbrains.kotlin.config.Services" - || className.startsWith("org.apache.log4j.") // For logging from compiler - || className == "org.jetbrains.kotlin.progress.CompilationCanceledStatus" - || className == "org.jetbrains.kotlin.progress.CompilationCanceledException" - || className == "org.jetbrains.kotlin.modules.TargetId" - || className == "org.jetbrains.kotlin.cli.common.ExitCode" + || className.startsWith("org.jetbrains.kotlin.incremental.components.") + || className.startsWith("org.jetbrains.kotlin.incremental.js") + || className == "org.jetbrains.kotlin.config.Services" + || className.startsWith("org.apache.log4j.") // For logging from compiler + || className == "org.jetbrains.kotlin.progress.CompilationCanceledStatus" + || className == "org.jetbrains.kotlin.progress.CompilationCanceledException" + || className == "org.jetbrains.kotlin.modules.TargetId" + || className == "org.jetbrains.kotlin.cli.common.ExitCode" } } @@ -174,18 +174,19 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { if (!file.exists()) continue val lastBuildMetaInfo = - try { - JvmBuildMetaInfo.deserializeFromString(file.readText()) ?: continue - } - catch (e: Exception) { - LOG.error("Could not deserialize jvm build meta info", e) - continue - } + try { + JvmBuildMetaInfo.deserializeFromString(file.readText()) ?: continue + } catch (e: Exception) { + LOG.error("Could not deserialize jvm build meta info", e) + continue + } val lastBuildLangVersion = LanguageVersion.fromVersionString(lastBuildMetaInfo.languageVersionString) val lastBuildApiVersion = ApiVersion.parse(lastBuildMetaInfo.apiVersionString) - val currentLangVersion = args.languageVersion?.let { LanguageVersion.fromVersionString(it) } ?: LanguageVersion.LATEST_STABLE - val currentApiVersion = args.apiVersion?.let { ApiVersion.parse(it) } ?: ApiVersion.createByLanguageVersion(currentLangVersion) + val currentLangVersion = + args.languageVersion?.let { LanguageVersion.fromVersionString(it) } ?: LanguageVersion.LATEST_STABLE + val currentApiVersion = + args.apiVersion?.let { ApiVersion.parse(it) } ?: ApiVersion.createByLanguageVersion(currentLangVersion) val reasonToRebuild = when { currentLangVersion != lastBuildLangVersion -> { @@ -220,10 +221,10 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } override fun build( - context: CompileContext, - chunk: ModuleChunk, - dirtyFilesHolder: DirtyFilesHolder, - outputConsumer: ModuleLevelBuilder.OutputConsumer + context: CompileContext, + chunk: ModuleChunk, + dirtyFilesHolder: DirtyFilesHolder, + outputConsumer: ModuleLevelBuilder.OutputConsumer ): ModuleLevelBuilder.ExitCode { if (chunk.isDummy(context)) return NOTHING_DONE @@ -235,30 +236,28 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { val actualExitCode = if (proposedExitCode == OK && fsOperations.hasMarkedDirty) ADDITIONAL_PASS_REQUIRED else proposedExitCode - LOG.debug("Build result: " + actualExitCode) + LOG.debug("Build result: $actualExitCode") context.testingContext?.buildLogger?.buildFinished(actualExitCode) return actualExitCode - } - catch (e: StopBuildException) { - LOG.info("Caught exception: " + e) + } catch (e: StopBuildException) { + LOG.info("Caught exception: $e") throw e - } - catch (e: Throwable) { - LOG.info("Caught exception: " + e) + } catch (e: Throwable) { + LOG.info("Caught exception: $e") MessageCollectorUtil.reportException(messageCollector, e) return ABORT } } private fun doBuild( - chunk: ModuleChunk, - context: CompileContext, - dirtyFilesHolder: DirtyFilesHolder, - messageCollector: MessageCollectorAdapter, - outputConsumer: OutputConsumer, - fsOperations: FSOperationsHelper + chunk: ModuleChunk, + context: CompileContext, + dirtyFilesHolder: DirtyFilesHolder, + messageCollector: MessageCollectorAdapter, + outputConsumer: OutputConsumer, + fsOperations: FSOperationsHelper ): ModuleLevelBuilder.ExitCode { // Workaround for Android Studio if (!JavaBuilder.IS_ENABLED[context, true] && !JpsUtils.isJsKotlinModule(chunk.representativeTarget())) { @@ -272,15 +271,14 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { val hasKotlin = HasKotlinMarker(dataManager) val rebuildAfterCacheVersionChanged = RebuildAfterCacheVersionChangeMarker(dataManager) val isChunkRebuilding = JavaBuilderUtil.isForcedRecompilationAllJavaModules(context) - || targets.any { rebuildAfterCacheVersionChanged[it] == true } + || targets.any { rebuildAfterCacheVersionChanged[it] == true } if (hasKotlinDirtyOrRemovedFiles(dirtyFilesHolder, chunk)) { if (!isChunkRebuilding && !IncrementalCompilation.isEnabled()) { targets.forEach { rebuildAfterCacheVersionChanged[it] = true } return CHUNK_REBUILD_REQUIRED } - } - else { + } else { if (isChunkRebuilding) { targets.forEach { hasKotlin[it] = false } } @@ -311,8 +309,10 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { LOG.debug("Compiling files: ${filesToCompile.values()}") val start = System.nanoTime() - val outputItemCollector = doCompileModuleChunk(allCompiledFiles, chunk, commonArguments, context, dirtyFilesHolder, - environment, filesToCompile, incrementalCaches, project) + val outputItemCollector = doCompileModuleChunk( + allCompiledFiles, chunk, commonArguments, context, dirtyFilesHolder, + environment, filesToCompile, incrementalCaches, project + ) statisticsLogger.registerStatistic(chunk, System.nanoTime() - start) @@ -324,8 +324,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { if (compilationErrors) { LOG.info("Compiled with errors") return ABORT - } - else { + } else { LOG.info("Compiled successfully") } @@ -372,12 +371,12 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } private fun applyActionsOnCacheVersionChange( - actions: Set, - cacheVersionsProvider: CacheVersionProvider, - context: CompileContext, - dataManager: BuildDataManager, - targets: MutableSet, - fsOperations: FSOperationsHelper + actions: Set, + cacheVersionsProvider: CacheVersionProvider, + context: CompileContext, + dataManager: BuildDataManager, + targets: MutableSet, + fsOperations: FSOperationsHelper ) { val hasKotlin = HasKotlinMarker(dataManager) val sortedActions = actions.sorted() @@ -463,13 +462,13 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } private fun compilerArgumentsForChunk(chunk: ModuleChunk): CommonCompilerArguments = - JpsKotlinCompilerSettings.getCommonCompilerArguments(chunk.representativeTarget().module) + JpsKotlinCompilerSettings.getCommonCompilerArguments(chunk.representativeTarget().module) private fun doCompileModuleChunk( - allCompiledFiles: MutableSet, chunk: ModuleChunk, commonArguments: CommonCompilerArguments, context: CompileContext, - dirtyFilesHolder: DirtyFilesHolder, environment: JpsCompilerEnvironment, - filesToCompile: MultiMap, incrementalCaches: Map, - project: JpsProject + allCompiledFiles: MutableSet, chunk: ModuleChunk, commonArguments: CommonCompilerArguments, context: CompileContext, + dirtyFilesHolder: DirtyFilesHolder, environment: JpsCompilerEnvironment, + filesToCompile: MultiMap, incrementalCaches: Map, + project: JpsProject ): OutputItemsCollector? { val representativeTarget = chunk.representativeTarget() @@ -478,11 +477,15 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { for (argumentProvider in ServiceLoader.load(KotlinJpsCompilerArgumentsProvider::class.java)) { // appending to pluginOptions - commonArguments.pluginOptions = concatenate(commonArguments.pluginOptions, - argumentProvider.getExtraArguments(representativeTarget, context)) + commonArguments.pluginOptions = concatenate( + commonArguments.pluginOptions, + argumentProvider.getExtraArguments(representativeTarget, context) + ) // appending to classpath - commonArguments.pluginClasspaths = concatenate(commonArguments.pluginClasspaths, - argumentProvider.getClasspath(representativeTarget, context)) + commonArguments.pluginClasspaths = concatenate( + commonArguments.pluginClasspaths, + argumentProvider.getClasspath(representativeTarget, context) + ) LOG.debug("Plugin loaded: ${argumentProvider::class.java.simpleName}") } @@ -504,15 +507,17 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } private fun createCompileEnvironment( - incrementalCaches: Map, - lookupTracker: LookupTracker, - context: CompileContext, - messageCollector: MessageCollectorAdapter + incrementalCaches: Map, + lookupTracker: LookupTracker, + context: CompileContext, + messageCollector: MessageCollectorAdapter ): JpsCompilerEnvironment? { val compilerServices = with(Services.Builder()) { register(LookupTracker::class.java, lookupTracker) - register(IncrementalCompilationComponents::class.java, - IncrementalCompilationComponentsImpl(incrementalCaches.mapKeys { TargetId(it.key) })) + register( + IncrementalCompilationComponents::class.java, + IncrementalCompilationComponentsImpl(incrementalCaches.mapKeys { TargetId(it.key) }) + ) register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus { override fun checkCanceled() { if (context.cancelStatus.isCanceled) throw CompilationCanceledException() @@ -523,17 +528,19 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { val paths = computeKotlinPathsForJpsPlugin() if (paths == null || !paths.homePath.exists()) { - messageCollector.report(ERROR, "Cannot find kotlinc home. Make sure the plugin is properly installed, " + - "or specify $JPS_KOTLIN_HOME_PROPERTY system property") + messageCollector.report( + ERROR, "Cannot find kotlinc home. Make sure the plugin is properly installed, " + + "or specify $JPS_KOTLIN_HOME_PROPERTY system property" + ) return null } return JpsCompilerEnvironment( - paths, - compilerServices, - classesToLoadByParent, - messageCollector, - OutputItemsCollectorImpl() + paths, + compilerServices, + classesToLoadByParent, + messageCollector, + OutputItemsCollectorImpl() ) } @@ -559,35 +566,39 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } private fun getGeneratedFiles( - chunk: ModuleChunk, - outputItemCollector: OutputItemsCollectorImpl + chunk: ModuleChunk, + outputItemCollector: OutputItemsCollectorImpl ): Map> { // If there's only one target, this map is empty: get() always returns null, and the representativeTarget will be used below val sourceToTarget = HashMap() if (chunk.targets.size > 1) { for (target in chunk.targets) { for (file in KotlinSourceFileCollector.getAllKotlinSourceFiles(target)) { - sourceToTarget.put(file, target) + sourceToTarget[file] = target } } } val representativeTarget = chunk.representativeTarget() fun SimpleOutputItem.target() = - sourceFiles.firstOrNull()?.let { sourceToTarget[it] } ?: - chunk.targets.singleOrNull { it.outputDir?.let { outputFile.startsWith(it) } ?: false } ?: - representativeTarget + sourceFiles.firstOrNull()?.let { sourceToTarget[it] } ?: chunk.targets.singleOrNull { + it.outputDir?.let { + outputFile.startsWith( + it + ) + } ?: false + } ?: representativeTarget return outputItemCollector.outputs.groupBy(SimpleOutputItem::target, SimpleOutputItem::toGeneratedFile) } private fun updateJavaMappings( - chunk: ModuleChunk, - context: CompileContext, - dirtyFilesHolder: DirtyFilesHolder, - filesToCompile: MultiMap, - outputItems: Map>, - incrementalCaches: Map + chunk: ModuleChunk, + context: CompileContext, + dirtyFilesHolder: DirtyFilesHolder, + filesToCompile: MultiMap, + outputItems: Map>, + incrementalCaches: Map ) { val previousMappings = context.projectDescriptor.dataManager.mappings val callback = JavaBuilderUtil.getDependenciesRegistrar(context) @@ -619,9 +630,9 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { sourceFiles.addAll(output.sourceFiles) callback.associate( - FileUtil.toSystemIndependentName(output.outputFile.canonicalPath), - sourceFiles.map { FileUtil.toSystemIndependentName(it.canonicalPath) }, - ClassReader(output.outputClass.fileContents) + FileUtil.toSystemIndependentName(output.outputFile.canonicalPath), + sourceFiles.map { FileUtil.toSystemIndependentName(it.canonicalPath) }, + ClassReader(output.outputClass.fileContents) ) } } @@ -640,13 +651,14 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } private fun updateLookupStorage( - chunk: ModuleChunk, - lookupTracker: LookupTracker, - dataManager: BuildDataManager, - dirtyFilesHolder: DirtyFilesHolder, - filesToCompile: MultiMap + chunk: ModuleChunk, + lookupTracker: LookupTracker, + dataManager: BuildDataManager, + dirtyFilesHolder: DirtyFilesHolder, + filesToCompile: MultiMap ) { - if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker::class.java}") + if (lookupTracker !is LookupTrackerImpl) + throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker::class.java}") val removedFiles = chunk.targets.flatMap { KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, it) } dataManager.withLookupStorage { lookupStorage -> @@ -656,20 +668,21 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } // if null is returned, nothing was done - private fun compileToJs(chunk: ModuleChunk, - commonArguments: CommonCompilerArguments, - environment: JpsCompilerEnvironment, - project: JpsProject + private fun compileToJs( + chunk: ModuleChunk, + commonArguments: CommonCompilerArguments, + environment: JpsCompilerEnvironment, + project: JpsProject ): OutputItemsCollector? { val representativeTarget = chunk.representativeTarget() if (chunk.modules.size > 1) { // We do not support circular dependencies, but if they are present, we do our best should not break the build, // so we simply yield a warning and report NOTHING_DONE environment.messageCollector.report( - STRONG_WARNING, - "Circular dependencies are not supported. The following JS modules depend on each other: " - + chunk.modules.joinToString(", ") { it.name } + ". " - + "Kotlin is not compiled for these modules" + STRONG_WARNING, + "Circular dependencies are not supported. The following JS modules depend on each other: " + + chunk.modules.joinToString(", ") { it.name } + ". " + + "Kotlin is not compiled for these modules" ) return null } @@ -698,12 +711,11 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { // If prefix is not specified (empty) in UI, we want to produce paths relative to source maps location val sourceRoots = if (k2JsArguments.sourceMapPrefix.isNullOrBlank()) { emptyList() - } - else { + } else { representativeModule.contentRootsList.urls - .map { URI.create(it) } - .filter { it.scheme == "file" } - .map { File(it.path) } + .map { URI.create(it) } + .filter { it.scheme == "file" } + .map { File(it.path) } } val friendPaths = KotlinBuilderModuleScriptGenerator.getProductionModulesWhichInternalsAreVisible(representativeTarget).mapNotNull { @@ -712,8 +724,10 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } val compilerRunner = JpsKotlinCompilerRunner() - compilerRunner.runK2JsCompiler(commonArguments, k2JsArguments, compilerSettings, environment, sourceFiles, sourceRoots, - libraries, friendPaths, outputFile) + compilerRunner.runK2JsCompiler( + commonArguments, k2JsArguments, compilerSettings, environment, sourceFiles, sourceRoots, + libraries, friendPaths, outputFile + ) return environment.outputItemsCollector } @@ -726,26 +740,29 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { val outputLibraryRuntimeDirectory = File(outputDir, compilerSettings.outputDirectoryForJsLibraryFiles).absolutePath val libraryFilesToCopy = arrayListOf() JpsJsModuleUtils.getLibraryFiles(representativeTarget, libraryFilesToCopy) - JsLibraryUtils.copyJsFilesFromLibraries(libraryFilesToCopy, outputLibraryRuntimeDirectory, - copySourceMap = k2jsCompilerSettings.sourceMap) + JsLibraryUtils.copyJsFilesFromLibraries( + libraryFilesToCopy, outputLibraryRuntimeDirectory, + copySourceMap = k2jsCompilerSettings.sourceMap + ) } } // if null is returned, nothing was done - private fun compileToJvm(allCompiledFiles: MutableSet, - chunk: ModuleChunk, - commonArguments: CommonCompilerArguments, - context: CompileContext, - dirtyFilesHolder: DirtyFilesHolder, - environment: JpsCompilerEnvironment, - filesToCompile: MultiMap + private fun compileToJvm( + allCompiledFiles: MutableSet, + chunk: ModuleChunk, + commonArguments: CommonCompilerArguments, + context: CompileContext, + dirtyFilesHolder: DirtyFilesHolder, + environment: JpsCompilerEnvironment, + filesToCompile: MultiMap ): OutputItemsCollector? { if (chunk.modules.size > 1) { environment.messageCollector.report( - STRONG_WARNING, - "Circular dependencies are only partially supported. The following modules depend on each other: " - + chunk.modules.joinToString(", ") { it.name } + ". " - + "Kotlin will compile them, but some strange effect may happen" + STRONG_WARNING, + "Circular dependencies are only partially supported. The following modules depend on each other: " + + chunk.modules.joinToString(", ") { it.name } + ". " + + "Kotlin will compile them, but some strange effect may happen" ) } @@ -763,7 +780,8 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } } - val moduleFile = KotlinBuilderModuleScriptGenerator.generateModuleDescription(context, chunk, filesToCompile, totalRemovedFiles != 0) + val moduleFile = + KotlinBuilderModuleScriptGenerator.generateModuleDescription(context, chunk, filesToCompile, totalRemovedFiles != 0) if (moduleFile == null) { KotlinBuilder.LOG.debug("Not compiling, because no files affected: " + filesToCompile.keySet().joinToString { it.presentableName }) // No Kotlin sources found @@ -775,14 +793,13 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { val compilerSettings = JpsKotlinCompilerSettings.getCompilerSettings(module) KotlinBuilder.LOG.debug("Compiling to JVM ${filesToCompile.values().size} files" - + (if (totalRemovedFiles == 0) "" else " ($totalRemovedFiles removed files)") - + " in " + filesToCompile.keySet().joinToString { it.presentableName }) + + (if (totalRemovedFiles == 0) "" else " ($totalRemovedFiles removed files)") + + " in " + filesToCompile.keySet().joinToString { it.presentableName }) try { val compilerRunner = JpsKotlinCompilerRunner() compilerRunner.runK2JvmCompiler(commonArguments, k2JvmArguments, compilerSettings, environment, moduleFile) - } - finally { + } finally { if (System.getProperty("kotlin.jps.delete.module.file.after.build") != "false") { moduleFile.delete() } @@ -802,7 +819,8 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { } val kind = kind(severity) if (kind != null) { - context.processMessage(CompilerMessage( + context.processMessage( + CompilerMessage( CompilerRunnerConstants.KOTLIN_COMPILER_NAME, kind, prefix + message, @@ -810,9 +828,9 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { -1, -1, -1, location?.line?.toLong() ?: -1, location?.column?.toLong() ?: -1 - )) - } - else { + ) + ) + } else { val path = if (location != null) "${location.path}:${location.line}:${location.column}: " else "" KotlinBuilder.LOG.debug(path + message) } @@ -830,7 +848,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { ERROR, EXCEPTION -> BuildMessage.Kind.ERROR WARNING, STRONG_WARNING -> BuildMessage.Kind.WARNING LOGGING -> null - else -> throw IllegalArgumentException("Unsupported severity: " + severity) + else -> throw IllegalArgumentException("Unsupported severity: $severity") } } } @@ -845,10 +863,10 @@ private class JpsICReporter : ICReporter { } private fun ChangesCollector.processChangesUsingLookups( - compiledFiles: Set, - dataManager: BuildDataManager, - fsOperations: FSOperationsHelper, - caches: Iterable + compiledFiles: Set, + dataManager: BuildDataManager, + fsOperations: FSOperationsHelper, + caches: Iterable ) { val allCaches = caches.flatMap { it.thisWithDependentCaches } val reporter = JpsICReporter() @@ -890,8 +908,8 @@ private fun getIncrementalCaches(chunk: ModuleChunk, context: CompileContext): M } fun getDependentTargets( - compilingChunk: ModuleChunk, - context: CompileContext + compilingChunk: ModuleChunk, + context: CompileContext ): Set { val compilingChunkIsTests = compilingChunk.targets.any { it.isTests } val classpathKind = JpsJavaClasspathKind.compile(compilingChunkIsTests) @@ -922,10 +940,11 @@ fun getDependentTargets( } private fun getDependenciesRecursively(module: JpsModule, kind: JpsJavaClasspathKind): Set = - JpsJavaExtensionService.dependencies(module).includedIn(kind).recursivelyExportedOnly().modules + JpsJavaExtensionService.dependencies(module).includedIn(kind).recursivelyExportedOnly().modules // TODO: investigate thread safety private val ALL_COMPILED_FILES_KEY = Key.create>("_all_kotlin_compiled_files_") + private fun getAllCompiledFilesContainer(context: CompileContext): MutableSet { var allCompiledFiles = ALL_COMPILED_FILES_KEY.get(context) if (allCompiledFiles == null) { @@ -937,18 +956,19 @@ private fun getAllCompiledFilesContainer(context: CompileContext): MutableSet>("_processed_targets_with_removed_files_") + private fun getProcessedTargetsWithRemovedFilesContainer(context: CompileContext): MutableSet { var set = PROCESSED_TARGETS_WITH_REMOVED_FILES.get(context) if (set == null) { - set = HashSet() + set = HashSet() PROCESSED_TARGETS_WITH_REMOVED_FILES.set(context, set) } return set } private fun hasKotlinDirtyOrRemovedFiles( - dirtyFilesHolder: DirtyFilesHolder, - chunk: ModuleChunk + dirtyFilesHolder: DirtyFilesHolder, + chunk: ModuleChunk ): Boolean { if (!dirtyFilesHolder.hasDirtyFiles() && !dirtyFilesHolder.hasRemovedFiles()) return false @@ -958,4 +978,4 @@ private fun hasKotlinDirtyOrRemovedFiles( } fun jvmBuildMetaInfoFile(target: ModuleBuildTarget, dataManager: BuildDataManager): File = - File(dataManager.dataPaths.getTargetDataRoot(target), KotlinBuilder.JVM_BUILD_META_INFO_FILE_NAME) \ No newline at end of file + File(dataManager.dataPaths.getTargetDataRoot(target), KotlinBuilder.JVM_BUILD_META_INFO_FILE_NAME) \ No newline at end of file diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.kt index 47584a2cf2d..d614e4495c7 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilderModuleScriptGenerator.kt @@ -51,21 +51,21 @@ object KotlinBuilderModuleScriptGenerator { // TODO switch to directly using when "since-build" will be >= 144.3357.4 internal val getRelatedProductionModule: (JpsModule) -> JpsModule? = run { val klass = - try { - Class.forName("org.jetbrains.jps.model.module.JpsTestModuleProperties") - } catch (e: ClassNotFoundException) { - return@run alwaysNull() - } + try { + Class.forName("org.jetbrains.jps.model.module.JpsTestModuleProperties") + } catch (e: ClassNotFoundException) { + return@run alwaysNull() + } val getTestModulePropertiesMethod: Method val getProductionModuleMethod: Method try { - getTestModulePropertiesMethod = JpsJavaExtensionService::class.java.getDeclaredMethod("getTestModuleProperties", JpsModule::class.java) + getTestModulePropertiesMethod = + JpsJavaExtensionService::class.java.getDeclaredMethod("getTestModuleProperties", JpsModule::class.java) getProductionModuleMethod = klass.getDeclaredMethod("getProductionModule") - } - catch (e: NoSuchMethodException) { + } catch (e: NoSuchMethodException) { return@run alwaysNull() } @@ -77,10 +77,10 @@ object KotlinBuilderModuleScriptGenerator { } fun generateModuleDescription( - context: CompileContext, - chunk: ModuleChunk, - sourceFiles: MultiMap, // ignored for non-incremental compilation - hasRemovedFiles: Boolean + context: CompileContext, + chunk: ModuleChunk, + sourceFiles: MultiMap, // ignored for non-incremental compilation + hasRemovedFiles: Boolean ): File? { val builder = KotlinModuleXmlBuilder() @@ -97,10 +97,11 @@ object KotlinBuilderModuleScriptGenerator { val friendDirs = getAdditionalOutputDirsWhereInternalsAreVisible(target) val moduleSources = ArrayList( - if (IncrementalCompilation.isEnabled()) - sourceFiles.get(target) - else - KotlinSourceFileCollector.getAllKotlinSourceFiles(target)) + if (IncrementalCompilation.isEnabled()) + sourceFiles.get(target) + else + KotlinSourceFileCollector.getAllKotlinSourceFiles(target) + ) if (moduleSources.size > 0 || hasRemovedFiles) { noSources = false @@ -114,17 +115,18 @@ object KotlinBuilderModuleScriptGenerator { assert(targetType is JavaModuleBuildTargetType) val targetId = TargetId(target) builder.addModule( - targetId.name, - outputDir.absolutePath, - moduleSources, - findSourceRoots(context, target), - findClassPathRoots(target), - findModularJdkRoot(target), - targetId.type, - (targetType as JavaModuleBuildTargetType).isTests, - // this excludes the output directories from the class path, to be removed for true incremental compilation - outputDirs, - friendDirs) + targetId.name, + outputDir.absolutePath, + moduleSources, + findSourceRoots(context, target), + findClassPathRoots(target), + findModularJdkRoot(target), + targetId.type, + (targetType as JavaModuleBuildTargetType).isTests, + // this excludes the output directories from the class path, to be removed for true incremental compilation + outputDirs, + friendDirs + ) } if (noSources) return null @@ -144,14 +146,12 @@ object KotlinBuilderModuleScriptGenerator { val dir = System.getProperty("kotlin.jps.dir.for.module.files")?.let { File(it) }?.takeIf { it.isDirectory } return try { File.createTempFile("kjps", readableSuffix + ".script.xml", dir) - } - catch (e: IOException) { + } catch (e: IOException) { // sometimes files cannot be created, because file name is too long (Windows, Mac OS) // see https://bugs.openjdk.java.net/browse/JDK-8148023 try { File.createTempFile("kjps", ".script.xml", dir) - } - catch (e: IOException) { + } catch (e: IOException) { val message = buildString { append("Could not create module file when building chunk $chunk") if (dir != null) { @@ -203,8 +203,8 @@ object KotlinBuilderModuleScriptGenerator { // List of paths to JRE modules in the following format: // jrt:///Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home!/java.base val urls = JpsJavaExtensionService.dependencies(target.module) - .satisfying { dependency -> dependency is JpsSdkDependency } - .classes().urls + .satisfying { dependency -> dependency is JpsSdkDependency } + .classes().urls val url = urls.firstOrNull { it.startsWith(StandardFileSystems.JRT_PROTOCOL_PREFIX) } ?: return null diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinSourceFileCollector.java b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinSourceFileCollector.java index c8323d2f226..c2f60a498c8 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinSourceFileCollector.java +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinSourceFileCollector.java @@ -42,8 +42,7 @@ public class KotlinSourceFileCollector { // For incremental compilation @NotNull public static MultiMap getDirtySourceFiles(DirtyFilesHolder dirtyFilesHolder) - throws IOException - { + throws IOException { final MultiMap result = new MultiMap(); dirtyFilesHolder.processDirtyFiles(new FileProcessor() { @@ -84,15 +83,17 @@ public class KotlinSourceFileCollector { @NotNull public static List getAllKotlinSourceFiles(@NotNull ModuleBuildTarget target) { - final List moduleExcludes = ContainerUtil.map(target.getModule().getExcludeRootsList().getUrls(), new Function() { - @Override - public File fun(String url) { - return JpsPathUtil.urlToFile(url); - } - }); + final List moduleExcludes = + ContainerUtil.map(target.getModule().getExcludeRootsList().getUrls(), new Function() { + @Override + public File fun(String url) { + return JpsPathUtil.urlToFile(url); + } + }); final JpsCompilerExcludes compilerExcludes = - JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(target.getModule().getProject()).getCompilerExcludes(); + JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(target.getModule().getProject()) + .getCompilerExcludes(); final List result = ContainerUtil.newArrayList(); for (JpsModuleSourceRoot sourceRoot : getRelevantSourceRoots(target)) { @@ -135,5 +136,6 @@ public class KotlinSourceFileCollector { return FileUtilRt.extensionEquals(file.getName(), "kt"); } - private KotlinSourceFileCollector() {} + private KotlinSourceFileCollector() { + } } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/MarkerFile.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/MarkerFile.kt index 7f0e8231008..072faf70562 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/MarkerFile.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/MarkerFile.kt @@ -57,4 +57,5 @@ abstract class MarkerFile(private val fileName: String, private val paths: Build } class HasKotlinMarker(dataManager: BuildDataManager) : MarkerFile(HAS_KOTLIN_MARKER_FILE_NAME, dataManager.dataPaths) -class RebuildAfterCacheVersionChangeMarker(dataManager: BuildDataManager) : MarkerFile(REBUILD_AFTER_CACHE_VERSION_CHANGE_MARKER, dataManager.dataPaths) +class RebuildAfterCacheVersionChangeMarker(dataManager: BuildDataManager) : + MarkerFile(REBUILD_AFTER_CACHE_VERSION_CHANGE_MARKER, dataManager.dataPaths) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/TeamcityStatisticsLogger.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/TeamcityStatisticsLogger.kt index 7dbcb461b05..01c7900edf0 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/TeamcityStatisticsLogger.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/TeamcityStatisticsLogger.kt @@ -47,8 +47,7 @@ class TeamcityStatisticsLogger { val escChar = escapedChar(c) if (escChar == 0.toChar()) { escaped.append(c) - } - else { + } else { escaped.append('|').append(escChar) } } @@ -65,8 +64,8 @@ class TeamcityStatisticsLogger { private fun printPerChunkStatistics(moduleChunk: ModuleChunk, timeToCompileNs: Long) { printStatisticMessage( - "${KotlinBuilder.KOTLIN_BUILDER_NAME} for ${moduleChunk.presentableShortName} compilation time, ms", - timeToCompileNs.nanosToMillis().toString() + "${KotlinBuilder.KOTLIN_BUILDER_NAME} for ${moduleChunk.presentableShortName} compilation time, ms", + timeToCompileNs.nanosToMillis().toString() ) } @@ -74,8 +73,8 @@ class TeamcityStatisticsLogger { if (!isOnTeamcity) return printStatisticMessage( - "${KotlinBuilder.KOTLIN_BUILDER_NAME} total compilation time, ms", - totalTime.get().nanosToMillis().toString() + "${KotlinBuilder.KOTLIN_BUILDER_NAME} total compilation time, ms", + totalTime.get().nanosToMillis().toString() ) } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/JpsIncrementalJvmCache.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/JpsIncrementalJvmCache.kt index 9178a270dbf..a50527e2d48 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/JpsIncrementalJvmCache.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/JpsIncrementalJvmCache.kt @@ -26,8 +26,8 @@ import org.jetbrains.kotlin.jps.build.KotlinBuilder import java.io.File class JpsIncrementalJvmCache( - target: ModuleBuildTarget, - paths: BuildDataPaths + target: ModuleBuildTarget, + paths: BuildDataPaths ) : IncrementalJvmCache(paths.getTargetDataRoot(target), target.outputDir), StorageOwner { override fun debugLog(message: String) { KotlinBuilder.LOG.debug(message) @@ -35,8 +35,8 @@ class JpsIncrementalJvmCache( } private class KotlinIncrementalStorageProvider( - private val target: ModuleBuildTarget, - private val paths: BuildDataPaths + private val target: ModuleBuildTarget, + private val paths: BuildDataPaths ) : StorageProvider() { override fun equals(other: Any?) = other is KotlinIncrementalStorageProvider && target == other.target @@ -44,9 +44,9 @@ private class KotlinIncrementalStorageProvider( override fun hashCode() = target.hashCode() override fun createStorage(targetDataDir: File): JpsIncrementalJvmCache = - JpsIncrementalJvmCache(target, paths) + JpsIncrementalJvmCache(target, paths) } fun BuildDataManager.getKotlinCache(target: ModuleBuildTarget): JpsIncrementalJvmCache = - getStorage(target, KotlinIncrementalStorageProvider(target, dataPaths)) + getStorage(target, KotlinIncrementalStorageProvider(target, dataPaths)) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/KotlinDataContainerTargetType.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/KotlinDataContainerTargetType.kt index bbaee2504ef..d8e64680d61 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/KotlinDataContainerTargetType.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/KotlinDataContainerTargetType.kt @@ -30,9 +30,9 @@ object KotlinDataContainerTargetType : BuildTargetType = listOf(KotlinDataContainerTarget) override fun createLoader(model: JpsModel): BuildTargetLoader = - object : BuildTargetLoader() { - override fun createTarget(targetId: String): KotlinDataContainerTarget? = KotlinDataContainerTarget - } + object : BuildTargetLoader() { + override fun createTarget(targetId: String): KotlinDataContainerTarget? = KotlinDataContainerTarget + } } // Fake target to store data per project for incremental compilation @@ -41,10 +41,10 @@ object KotlinDataContainerTarget : BuildTarget(KotlinDataCo override fun getPresentableName(): String = KOTLIN_DATA_CONTAINER override fun computeRootDescriptors( - model: JpsModel?, - index: ModuleExcludeIndex?, - ignoredFileIndex: IgnoredFileIndex?, - dataPaths: BuildDataPaths? + model: JpsModel?, + index: ModuleExcludeIndex?, + ignoredFileIndex: IgnoredFileIndex?, + dataPaths: BuildDataPaths? ): List = listOf() override fun getOutputRoots(context: CompileContext): Collection { @@ -56,7 +56,7 @@ object KotlinDataContainerTarget : BuildTarget(KotlinDataCo override fun findRootDescriptor(rootId: String?, rootIndex: BuildRootIndex?): BuildRootDescriptor? = null override fun computeDependencies( - targetRegistry: BuildTargetRegistry?, - outputIndex: TargetOutputIndex? + targetRegistry: BuildTargetRegistry?, + outputIndex: TargetOutputIndex? ): Collection>? = listOf() } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/storages/values.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/storages/values.kt index 40c633f4660..49ec3a59487 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/storages/values.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/incremental/storages/values.kt @@ -19,9 +19,9 @@ package org.jetbrains.kotlin.jps.incremental.storages import com.intellij.openapi.util.io.FileUtil class PathFunctionPair( - val path: String, - val function: String -): Comparable { + val path: String, + val function: String +) : Comparable { override fun compareTo(other: PathFunctionPair): Int { val pathComp = FileUtil.comparePaths(path, other.path) @@ -31,12 +31,12 @@ class PathFunctionPair( } override fun equals(other: Any?): Boolean = - when (other) { - is PathFunctionPair -> - FileUtil.pathsEqual(path, other.path) && function == other.function - else -> - false - } + when (other) { + is PathFunctionPair -> + FileUtil.pathsEqual(path, other.path) && function == other.function + else -> + false + } override fun hashCode(): Int = 31 * FileUtil.pathHashCode(path) + function.hashCode() } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/BaseJpsCompilerSettingsSerializer.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/BaseJpsCompilerSettingsSerializer.kt index e77afb094f5..e262a0edc92 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/BaseJpsCompilerSettingsSerializer.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/BaseJpsCompilerSettingsSerializer.kt @@ -24,9 +24,9 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.config.SettingConstants abstract class BaseJpsCompilerSettingsSerializer( - componentName: String, - private val settingsFactory: () -> T -): JpsProjectExtensionSerializer(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE, componentName) { + componentName: String, + private val settingsFactory: () -> T +) : JpsProjectExtensionSerializer(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE, componentName) { protected abstract fun onLoad(project: JpsProject, settings: T) override fun loadExtension(project: JpsProject, componentTag: Element) { diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/JpsKotlinFacetConfigurationSerializer.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/JpsKotlinFacetConfigurationSerializer.kt index 202b7389d4a..f2d05e9f9a8 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/JpsKotlinFacetConfigurationSerializer.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/JpsKotlinFacetConfigurationSerializer.kt @@ -24,23 +24,23 @@ import org.jetbrains.kotlin.config.deserializeFacetSettings import org.jetbrains.kotlin.config.serializeFacetSettings object JpsKotlinFacetConfigurationSerializer : JpsFacetConfigurationSerializer( - JpsKotlinFacetModuleExtension.KIND, - JpsKotlinFacetModuleExtension.FACET_TYPE_ID, - JpsKotlinFacetModuleExtension.FACET_NAME + JpsKotlinFacetModuleExtension.KIND, + JpsKotlinFacetModuleExtension.FACET_TYPE_ID, + JpsKotlinFacetModuleExtension.FACET_NAME ) { override fun loadExtension( - facetConfigurationElement: Element, - name: String, - parent: JpsElement?, - module: JpsModule + facetConfigurationElement: Element, + name: String, + parent: JpsElement?, + module: JpsModule ): JpsKotlinFacetModuleExtension { return JpsKotlinFacetModuleExtension(deserializeFacetSettings(facetConfigurationElement)) } override fun saveExtension( - extension: JpsKotlinFacetModuleExtension?, - facetConfigurationTag: Element, - module: JpsModule + extension: JpsKotlinFacetModuleExtension?, + facetConfigurationTag: Element, + module: JpsModule ) { (extension as JpsKotlinFacetModuleExtension).settings.serializeFacetSettings(facetConfigurationTag) } diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JsCompilerArgumentsSerializer.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JsCompilerArgumentsSerializer.kt index 51a50843a4c..a40d96775a1 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JsCompilerArgumentsSerializer.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JsCompilerArgumentsSerializer.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JS_COMPILER_ARGUME import org.jetbrains.kotlin.jps.JpsKotlinCompilerSettings internal class Kotlin2JsCompilerArgumentsSerializer : BaseJpsCompilerSettingsSerializer( - KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION, ::K2JSCompilerArguments + KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION, ::K2JSCompilerArguments ) { override fun onLoad(project: JpsProject, settings: K2JSCompilerArguments) { JpsKotlinCompilerSettings.setK2JsCompilerArguments(project, settings) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JvmCompilerArgumentsSerializer.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JvmCompilerArgumentsSerializer.kt index 5f6b0886aec..f0c95a2604e 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JvmCompilerArgumentsSerializer.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/Kotlin2JvmCompilerArgumentsSerializer.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JVM_COMPILER_ARGUM import org.jetbrains.kotlin.jps.JpsKotlinCompilerSettings internal class Kotlin2JvmCompilerArgumentsSerializer : BaseJpsCompilerSettingsSerializer( - KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION, ::K2JVMCompilerArguments + KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION, ::K2JVMCompilerArguments ) { override fun onLoad(project: JpsProject, settings: K2JVMCompilerArguments) { JpsKotlinCompilerSettings.setK2JvmCompilerArguments(project, settings) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCommonCompilerArgumentsSerializer.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCommonCompilerArgumentsSerializer.kt index 078f7513375..928233f1d6d 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCommonCompilerArgumentsSerializer.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCommonCompilerArgumentsSerializer.kt @@ -24,7 +24,7 @@ import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMMON_COMPILER_ARGUM import org.jetbrains.kotlin.jps.JpsKotlinCompilerSettings internal class KotlinCommonCompilerArgumentsSerializer : BaseJpsCompilerSettingsSerializer( - KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION, CommonCompilerArguments::DummyImpl + KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION, CommonCompilerArguments::DummyImpl ) { override fun onLoad(project: JpsProject, settings: CommonCompilerArguments.DummyImpl) { settings.setApiVersionToLanguageVersionIfNeeded() diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCompilerSettingsSerializer.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCompilerSettingsSerializer.kt index b22da528c70..62e90253631 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCompilerSettingsSerializer.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/model/KotlinCompilerSettingsSerializer.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMPILER_SETTINGS_SEC import org.jetbrains.kotlin.jps.JpsKotlinCompilerSettings internal class KotlinCompilerSettingsSerializer : BaseJpsCompilerSettingsSerializer( - KOTLIN_COMPILER_SETTINGS_SECTION, ::CompilerSettings + KOTLIN_COMPILER_SETTINGS_SECTION, ::CompilerSettings ) { override fun onLoad(project: JpsProject, settings: CompilerSettings) { JpsKotlinCompilerSettings.setCompilerSettings(project, settings)