working version of jps-plugin integration with daemon
This commit is contained in:
Generated
+2
@@ -19,6 +19,8 @@
|
|||||||
<element id="module-output" name="util" />
|
<element id="module-output" name="util" />
|
||||||
<element id="module-output" name="util.runtime" />
|
<element id="module-output" name="util.runtime" />
|
||||||
<element id="file-copy" path="$PROJECT_DIR$/resources/kotlinManifest.properties" />
|
<element id="file-copy" path="$PROJECT_DIR$/resources/kotlinManifest.properties" />
|
||||||
|
<element id="module-output" name="kotlinr" />
|
||||||
|
<element id="module-output" name="rmi-interface" />
|
||||||
</root>
|
</root>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
@@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.rmi;
|
package org.jetbrains.kotlin.rmi;
|
||||||
|
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache;
|
|
||||||
import java.rmi.Remote;
|
import java.rmi.Remote;
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +29,13 @@ public interface CompilerFacade extends Remote {
|
|||||||
XML
|
XML
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RemoteIncrementalCache extends Remote, IncrementalCache {}
|
interface RemoteIncrementalCache extends Remote {
|
||||||
|
Collection<String> getObsoletePackageParts() throws RemoteException;;
|
||||||
|
|
||||||
|
byte[] getPackageData(String fqName) throws RemoteException;;
|
||||||
|
|
||||||
|
void close() throws RemoteException;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int remoteCompile(String[] args, RemoteOutputStream errStream, OutputFormat outputFormat) throws RemoteException;
|
int remoteCompile(String[] args, RemoteOutputStream errStream, OutputFormat outputFormat) throws RemoteException;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.rmi.service
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||||
import org.jetbrains.kotlin.rmi.CompilerFacade
|
import org.jetbrains.kotlin.rmi.CompilerFacade
|
||||||
|
import org.jetbrains.kotlin.service.CompilerFacadeImpl
|
||||||
import java.rmi.RMISecurityManager
|
import java.rmi.RMISecurityManager
|
||||||
import java.rmi.registry.LocateRegistry
|
import java.rmi.registry.LocateRegistry
|
||||||
import java.rmi.server.UnicastRemoteObject
|
import java.rmi.server.UnicastRemoteObject
|
||||||
|
|||||||
@@ -14,15 +14,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.rmi.service
|
package org.jetbrains.kotlin.service
|
||||||
|
|
||||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||||
import org.jetbrains.kotlin.config.Services
|
import org.jetbrains.kotlin.config.Services
|
||||||
import org.jetbrains.kotlin.incremental.components.UsageCollector
|
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||||
import org.jetbrains.kotlin.rmi.CompilerFacade
|
import org.jetbrains.kotlin.rmi.CompilerFacade
|
||||||
import org.jetbrains.kotlin.rmi.RemoteOutputStream
|
import org.jetbrains.kotlin.rmi.RemoteOutputStream
|
||||||
|
import org.jetbrains.kotlin.rmi.service.RemoteIncrementalCacheClient
|
||||||
|
import org.jetbrains.kotlin.rmi.service.RemoteOutputStreamClient
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
import java.rmi.server.UnicastRemoteObject
|
import java.rmi.server.UnicastRemoteObject
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
@@ -31,8 +33,9 @@ import java.util.concurrent.TimeUnit
|
|||||||
class CompilerFacadeImpl<Compiler: CLICompiler<*>>(val compiler: Compiler) : CompilerFacade, UnicastRemoteObject() {
|
class CompilerFacadeImpl<Compiler: CLICompiler<*>>(val compiler: Compiler) : CompilerFacade, UnicastRemoteObject() {
|
||||||
|
|
||||||
public class IncrementalCompilationComponentsImpl(val idToCache: Map<String, CompilerFacade.RemoteIncrementalCache>): IncrementalCompilationComponents {
|
public class IncrementalCompilationComponentsImpl(val idToCache: Map<String, CompilerFacade.RemoteIncrementalCache>): IncrementalCompilationComponents {
|
||||||
override fun getIncrementalCache(moduleId: String): IncrementalCache = idToCache[moduleId]!!
|
// perf: cheap object, but still the pattern may be costy if there are too many calls to cache with the same id (which seems not to be the case now)
|
||||||
override fun getUsageCollector(): UsageCollector = UsageCollector.DO_NOTHING
|
override fun getIncrementalCache(moduleId: String): IncrementalCache = RemoteIncrementalCacheClient(idToCache[moduleId]!!)
|
||||||
|
override fun getLookupTracker(): LookupTracker = LookupTracker.DO_NOTHING
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createCompileServices(incrementalCaches: Map<String, CompilerFacade.RemoteIncrementalCache>): Services =
|
private fun createCompileServices(incrementalCaches: Map<String, CompilerFacade.RemoteIncrementalCache>): Services =
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2015 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.rmi.service
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||||
|
import org.jetbrains.kotlin.rmi.CompilerFacade
|
||||||
|
|
||||||
|
public class RemoteIncrementalCacheClient(val cache: CompilerFacade.RemoteIncrementalCache): IncrementalCache {
|
||||||
|
override fun getObsoletePackageParts(): Collection<String> = cache.getObsoletePackageParts()
|
||||||
|
|
||||||
|
override fun getPackageData(fqName: String): ByteArray = cache.getPackageData(fqName)
|
||||||
|
|
||||||
|
override fun close(): Unit = cache.close()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user