Minor: rename Storage->Sink

This commit is contained in:
Alexey Tsvetkov
2017-01-13 09:32:56 +03:00
parent f027860ac0
commit 39b37b85e3
6 changed files with 14 additions and 14 deletions
@@ -20,9 +20,9 @@ import java.io.Serializable
import java.rmi.Remote import java.rmi.Remote
import java.rmi.RemoteException import java.rmi.RemoteException
interface CompilationResultsStorage : Remote { interface CompilationResultsSink : Remote {
@Throws(RemoteException::class) @Throws(RemoteException::class)
fun store(compilationResultCategory: Int, value: Serializable) fun push(compilationResultCategory: Int, value: Serializable)
} }
enum class CompilationResultCategory(val code: Int) { enum class CompilationResultCategory(val code: Int) {
@@ -135,7 +135,7 @@ interface CompileService : Remote {
compilerArguments: CommonCompilerArguments, compilerArguments: CommonCompilerArguments,
compilationOptions: CompilationOptions, compilationOptions: CompilationOptions,
servicesFacade: CompilerServicesFacadeBase, servicesFacade: CompilerServicesFacadeBase,
compilationResultsStorage: CompilationResultsStorage? compilationResultsSink: CompilationResultsSink?
): CallResult<Int> ): CallResult<Int>
@Throws(RemoteException::class) @Throws(RemoteException::class)
@@ -324,7 +324,7 @@ class CompileServiceImpl(
compilerArguments: CommonCompilerArguments, compilerArguments: CommonCompilerArguments,
compilationOptions: CompilationOptions, compilationOptions: CompilationOptions,
servicesFacade: CompilerServicesFacadeBase, servicesFacade: CompilerServicesFacadeBase,
compilationResultsStorage: CompilationResultsStorage? compilationResultsSink: CompilationResultsSink?
): CompileService.CallResult<Int> { ): CompileService.CallResult<Int> {
val messageCollector = CompileServicesFacadeMessageCollector(servicesFacade, compilationOptions) val messageCollector = CompileServicesFacadeMessageCollector(servicesFacade, compilationOptions)
val daemonReporter = DaemonMessageReporter(servicesFacade, compilationOptions) val daemonReporter = DaemonMessageReporter(servicesFacade, compilationOptions)
@@ -356,7 +356,7 @@ class CompileServiceImpl(
withIC { withIC {
doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler -> doCompile(sessionId, daemonReporter, tracer = null) { eventManger, profiler ->
execIncrementalCompiler(k2jvmArgs, gradleIncrementalArgs, gradleIncrementalServicesFacade, compilationResultsStorage!!, execIncrementalCompiler(k2jvmArgs, gradleIncrementalArgs, gradleIncrementalServicesFacade, compilationResultsSink!!,
messageCollector, daemonReporter) messageCollector, daemonReporter)
} }
} }
@@ -388,11 +388,11 @@ class CompileServiceImpl(
k2jvmArgs: K2JVMCompilerArguments, k2jvmArgs: K2JVMCompilerArguments,
incrementalCompilationOptions: IncrementalCompilationOptions, incrementalCompilationOptions: IncrementalCompilationOptions,
servicesFacade: IncrementalCompilerServicesFacade, servicesFacade: IncrementalCompilerServicesFacade,
compilationResultsStorage: CompilationResultsStorage, compilationResultsSink: CompilationResultsSink,
compilerMessageCollector: MessageCollector, compilerMessageCollector: MessageCollector,
daemonMessageReporter: DaemonMessageReporter daemonMessageReporter: DaemonMessageReporter
): ExitCode { ): ExitCode {
val reporter = RemoteICReporter(servicesFacade, compilationResultsStorage, incrementalCompilationOptions) val reporter = RemoteICReporter(servicesFacade, compilationResultsSink, incrementalCompilationOptions)
val annotationFileUpdater = if (servicesFacade.hasAnnotationsFileUpdater()) RemoteAnnotationsFileUpdater(servicesFacade) else null val annotationFileUpdater = if (servicesFacade.hasAnnotationsFileUpdater()) RemoteAnnotationsFileUpdater(servicesFacade) else null
val moduleFile = k2jvmArgs.module?.let(::File) val moduleFile = k2jvmArgs.module?.let(::File)
@@ -24,7 +24,7 @@ import java.io.Serializable
internal class RemoteICReporter( internal class RemoteICReporter(
private val servicesFacade: CompilerServicesFacadeBase, private val servicesFacade: CompilerServicesFacadeBase,
private val compilationResultsStorage: CompilationResultsStorage, private val compilationResultsSink: CompilationResultsSink,
compilationOptions: CompilationOptions compilationOptions: CompilationOptions
) : ICReporter { ) : ICReporter {
private val shouldReportMessages = ReportCategory.IC_MESSAGE.code in compilationOptions.reportCategories private val shouldReportMessages = ReportCategory.IC_MESSAGE.code in compilationOptions.reportCategories
@@ -39,7 +39,7 @@ internal class RemoteICReporter(
override fun reportCompileIteration(sourceFiles: Collection<File>, exitCode: ExitCode) { override fun reportCompileIteration(sourceFiles: Collection<File>, exitCode: ExitCode) {
if (shouldReportCompileIteration) { if (shouldReportCompileIteration) {
compilationResultsStorage.store(CompilationResultCategory.IC_COMPILE_ITERATION.code, CompileIterationResult(sourceFiles, exitCode.toString())) compilationResultsSink.push(CompilationResultCategory.IC_COMPILE_ITERATION.code, CompileIterationResult(sourceFiles, exitCode.toString()))
} }
} }
} }
@@ -2,7 +2,7 @@ package org.jetbrains.kotlin.compilerRunner
import org.gradle.api.Project import org.gradle.api.Project
import org.jetbrains.kotlin.daemon.common.CompilationResultCategory import org.jetbrains.kotlin.daemon.common.CompilationResultCategory
import org.jetbrains.kotlin.daemon.common.CompilationResultsStorage import org.jetbrains.kotlin.daemon.common.CompilationResultsSink
import org.jetbrains.kotlin.daemon.common.SOCKET_ANY_FREE_PORT import org.jetbrains.kotlin.daemon.common.SOCKET_ANY_FREE_PORT
import org.jetbrains.kotlin.daemon.report.CompileIterationResult import org.jetbrains.kotlin.daemon.report.CompileIterationResult
import org.jetbrains.kotlin.gradle.plugin.kotlinDebug import org.jetbrains.kotlin.gradle.plugin.kotlinDebug
@@ -11,12 +11,12 @@ import java.io.Serializable
import java.rmi.RemoteException import java.rmi.RemoteException
import java.rmi.server.UnicastRemoteObject import java.rmi.server.UnicastRemoteObject
internal class GradleCompilationResultsStorage(project: Project): CompilationResultsStorage, UnicastRemoteObject(SOCKET_ANY_FREE_PORT) { internal class GradleCompilationResultsSink(project: Project): CompilationResultsSink, UnicastRemoteObject(SOCKET_ANY_FREE_PORT) {
private val log = project.logger private val log = project.logger
private val projectRootFile = project.rootProject.projectDir private val projectRootFile = project.rootProject.projectDir
@Throws(RemoteException::class) @Throws(RemoteException::class)
override fun store(compilationResultCategory: Int, value: Serializable) { override fun push(compilationResultCategory: Int, value: Serializable) {
if (compilationResultCategory == CompilationResultCategory.IC_COMPILE_ITERATION.code) { if (compilationResultCategory == CompilationResultCategory.IC_COMPILE_ITERATION.code) {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
val compileIterationResult = value as? CompileIterationResult val compileIterationResult = value as? CompileIterationResult
@@ -172,7 +172,7 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil
val servicesFacade = GradleCompilerServicesFacadeImpl(project, environment.messageCollector) val servicesFacade = GradleCompilerServicesFacadeImpl(project, environment.messageCollector)
val res = withDaemon(environment, retryOnConnectionError = true) { daemon, sessionId -> val res = withDaemon(environment, retryOnConnectionError = true) { daemon, sessionId ->
daemon.compile(sessionId, environment.compilerArgs, compilationOptions, servicesFacade, compilationResultsStorage = null) daemon.compile(sessionId, environment.compilerArgs, compilationOptions, servicesFacade, compilationResultsSink = null)
} }
val exitCode = res?.get()?.let { exitCodeFromProcessExitCode(it) } val exitCode = res?.get()?.let { exitCodeFromProcessExitCode(it) }
@@ -203,7 +203,7 @@ internal class GradleCompilerRunner(private val project: Project) : KotlinCompil
val servicesFacade = GradleIncrementalCompilerServicesFacadeImpl(project, environment) val servicesFacade = GradleIncrementalCompilerServicesFacadeImpl(project, environment)
val res = withDaemon(environment, retryOnConnectionError = true) { daemon, sessionId -> val res = withDaemon(environment, retryOnConnectionError = true) { daemon, sessionId ->
daemon.compile(sessionId, environment.compilerArgs, compilationOptions, servicesFacade, GradleCompilationResultsStorage(project)) daemon.compile(sessionId, environment.compilerArgs, compilationOptions, servicesFacade, GradleCompilationResultsSink(project))
} }
val exitCode = res?.get()?.let { exitCodeFromProcessExitCode(it) } val exitCode = res?.get()?.let { exitCodeFromProcessExitCode(it) }