Refactor daemon interface

This commit is contained in:
Alexey Tsvetkov
2016-12-28 21:04:25 +03:00
parent d19a92bab5
commit d4d1d5ad0f
16 changed files with 461 additions and 84 deletions
@@ -0,0 +1,40 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.daemon.common
import java.io.File
import java.io.Serializable
open class AdditionalCompilerArguments(val reportingFilters: List<ReportingFilter>) : Serializable {
companion object {
const val serialVersionUID: Long = 0
}
}
class IncrementalCompilerArguments(
val areFileChangesKnown: Boolean,
val modifiedFiles: List<File>?,
val deletedFiles: List<File>?,
val workingDir: File,
val customCacheVersionFileName: String,
val customCacheVersion: Int,
reportingFilters: List<ReportingFilter>
) : AdditionalCompilerArguments(reportingFilters) {
companion object {
const val serialVersionUID: Long = 0
}
}
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.daemon.common
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.repl.*
import java.io.File
import java.io.Serializable
@@ -35,6 +36,11 @@ interface CompileService : Remote {
METADATA
}
enum class CompilerMode : Serializable {
NON_INCREMENTAL_COMPILER,
INCREMENTAL_COMPILER
}
companion object {
val NO_SESSION: Int = 0
}
@@ -127,12 +133,13 @@ interface CompileService : Remote {
): CallResult<Int>
@Throws(RemoteException::class)
fun serverSideJvmIC(
fun compile(
sessionId: Int,
args: Array<out String>,
servicesFacade: IncrementalCompilationServicesFacade,
compilerOutputStream: RemoteOutputStream,
serviceOutputStream: RemoteOutputStream,
compilerMode: CompilerMode,
targetPlatform: TargetPlatform,
compilerArguments: CommonCompilerArguments,
additionalCompilerArguments: AdditionalCompilerArguments,
servicesFacade: CompilerServicesFacadeBase,
operationsTracer: RemoteOperationsTracer?
): CallResult<Int>
@@ -0,0 +1,52 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.daemon.common
import java.io.File
import java.io.Serializable
import java.rmi.Remote
import java.rmi.RemoteException
interface CompilerServicesFacadeBase : Remote {
/**
* Reports different kind of diagnostic messages from compile daemon to compile daemon clients (jps, gradle, ...)
*/
@Throws(RemoteException::class)
fun report(category: ReportCategory, severity: Int, message: String?, attachment: Serializable?)
}
interface IncrementalCompilerServicesFacade : CompilerServicesFacadeBase {
// AnnotationFileUpdater
@Throws(RemoteException::class)
fun hasAnnotationsFileUpdater(): Boolean
@Throws(RemoteException::class)
fun updateAnnotations(outdatedClassesJvmNames: Iterable<String>)
@Throws(RemoteException::class)
fun revert()
// ChangesRegistry
@Throws(RemoteException::class)
fun registerChanges(timestamp: Long, dirtyData: SimpleDirtyData)
@Throws(RemoteException::class)
fun unknownChanges(timestamp: Long)
@Throws(RemoteException::class)
fun getChanges(artifact: File, sinceTS: Long): Iterable<SimpleDirtyData>?
}
@@ -0,0 +1,40 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.daemon.common
import java.io.Serializable
enum class ReportCategory : Serializable {
/**
* Messages from compiler
* For related severities see [org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity]
*/
COMPILER_MESSAGE,
/**
* Messages from compile daemon
* For related severities see [org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity]
*/
DAEMON_MESSAGE,
/**
* For related severities see [org.jetbrains.kotlin.daemon.incremental.IncrementalCompilationSeverity]
*/
INCREMENTAL_COMPILATION;
companion object {
const val serialVersionUID: Long = 0
}
}
@@ -0,0 +1,28 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.daemon.common
import java.io.Serializable
/**
* Allows daemon clients to specify report category and severities for that category that should be reported from daemon
*/
data class ReportingFilter(val category: ReportCategory, val severities: List<Int>) : Serializable {
companion object {
const val serialVersionUID: Long = 0
}
}