Creating shared module "build", copying lookup storage, tracker and incremental cache related files into it from jps plugin
This commit is contained in:
committed by
Zalim Bashorov
parent
84e530bc1a
commit
5ead2edaa0
Generated
+1
@@ -24,6 +24,7 @@
|
|||||||
<element id="module-output" name="deserialization" />
|
<element id="module-output" name="deserialization" />
|
||||||
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/native-platform-uberjar.jar" path-in-jar="/" />
|
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/native-platform-uberjar.jar" path-in-jar="/" />
|
||||||
<element id="module-output" name="android-jps-plugin" />
|
<element id="module-output" name="android-jps-plugin" />
|
||||||
|
<element id="module-output" name="build" />
|
||||||
</root>
|
</root>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
Generated
+1
@@ -13,6 +13,7 @@
|
|||||||
<module fileurl="file://$PROJECT_DIR$/compiler/backend/backend.iml" filepath="$PROJECT_DIR$/compiler/backend/backend.iml" group="compiler/java" />
|
<module fileurl="file://$PROJECT_DIR$/compiler/backend/backend.iml" filepath="$PROJECT_DIR$/compiler/backend/backend.iml" group="compiler/java" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/compiler/backend-common/backend-common.iml" filepath="$PROJECT_DIR$/compiler/backend-common/backend-common.iml" group="compiler" />
|
<module fileurl="file://$PROJECT_DIR$/compiler/backend-common/backend-common.iml" filepath="$PROJECT_DIR$/compiler/backend-common/backend-common.iml" group="compiler" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" group="ide/jps" />
|
<module fileurl="file://$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/bare-plugin/bare-plugin.iml" group="ide/jps" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/build/build.iml" filepath="$PROJECT_DIR$/build/build.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/core/builtins/builtins.iml" filepath="$PROJECT_DIR$/core/builtins/builtins.iml" group="core" />
|
<module fileurl="file://$PROJECT_DIR$/core/builtins/builtins.iml" filepath="$PROJECT_DIR$/core/builtins/builtins.iml" group="core" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" filepath="$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" group="compiler/cli" />
|
<module fileurl="file://$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" filepath="$PROJECT_DIR$/compiler/builtins-serializer/builtins-serializer.iml" group="compiler/cli" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli.iml" filepath="$PROJECT_DIR$/compiler/cli/cli.iml" group="compiler/cli" />
|
<module fileurl="file://$PROJECT_DIR$/compiler/cli/cli.iml" filepath="$PROJECT_DIR$/compiler/cli/cli.iml" group="compiler/cli" />
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="frontend.java" />
|
||||||
|
<orderEntry type="module" module-name="util.runtime" />
|
||||||
|
<orderEntry type="module" module-name="cli-common" />
|
||||||
|
<orderEntry type="module" module-name="util" />
|
||||||
|
<orderEntry type="module" module-name="compiler-tests" scope="TEST" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="idea-full" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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.build
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
||||||
|
import org.jetbrains.kotlin.utils.sure
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
open class GeneratedFile<Target>(
|
||||||
|
val target: Target,
|
||||||
|
val sourceFiles: Collection<File>,
|
||||||
|
val outputFile: File
|
||||||
|
)
|
||||||
|
|
||||||
|
class GeneratedJvmClass<Target> (
|
||||||
|
target: Target,
|
||||||
|
sourceFiles: Collection<File>,
|
||||||
|
outputFile: File
|
||||||
|
) : GeneratedFile<Target>(target, sourceFiles, outputFile) {
|
||||||
|
val outputClass = LocalFileKotlinClass.create(outputFile).sure {
|
||||||
|
"Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun File.isModuleMappingFile() = extension == ModuleMapping.MAPPING_FILE_EXT && parentFile.name == "META-INF"
|
||||||
+30
-39
@@ -14,14 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
import org.jetbrains.jps.builders.BuildTarget
|
|
||||||
import org.jetbrains.jps.builders.storage.BuildDataPaths
|
|
||||||
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
|
||||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||||
import org.jetbrains.kotlin.jps.incremental.CacheVersion.Action
|
|
||||||
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
|
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
|
||||||
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
|
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -93,43 +89,38 @@ class CacheVersion(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CacheVersionProvider(private val paths: BuildDataPaths) {
|
fun normalCacheVersion(dataRoot: File): CacheVersion =
|
||||||
private val BuildTarget<*>.dataRoot: File
|
CacheVersion(ownVersion = NORMAL_VERSION,
|
||||||
get() = paths.getTargetDataRoot(this)
|
versionFile = File(dataRoot, NORMAL_VERSION_FILE_NAME),
|
||||||
|
whenVersionChanged = CacheVersion.Action.REBUILD_CHUNK,
|
||||||
|
whenTurnedOn = CacheVersion.Action.REBUILD_CHUNK,
|
||||||
|
whenTurnedOff = CacheVersion.Action.CLEAN_NORMAL_CACHES,
|
||||||
|
isEnabled = { IncrementalCompilation.isEnabled() })
|
||||||
|
|
||||||
fun normalVersion(target: ModuleBuildTarget): CacheVersion =
|
fun experimentalCacheVersion(dataRoot: File): CacheVersion =
|
||||||
CacheVersion(ownVersion = NORMAL_VERSION,
|
CacheVersion(ownVersion = EXPERIMENTAL_VERSION,
|
||||||
versionFile = File(target.dataRoot, NORMAL_VERSION_FILE_NAME),
|
versionFile = File(dataRoot, EXPERIMENTAL_VERSION_FILE_NAME),
|
||||||
whenVersionChanged = Action.REBUILD_CHUNK,
|
whenVersionChanged = CacheVersion.Action.REBUILD_CHUNK,
|
||||||
whenTurnedOn = Action.REBUILD_CHUNK,
|
whenTurnedOn = CacheVersion.Action.REBUILD_CHUNK,
|
||||||
whenTurnedOff = Action.CLEAN_NORMAL_CACHES,
|
whenTurnedOff = CacheVersion.Action.CLEAN_EXPERIMENTAL_CACHES,
|
||||||
isEnabled = { IncrementalCompilation.isEnabled() })
|
isEnabled = { IncrementalCompilation.isExperimental() })
|
||||||
|
|
||||||
fun experimentalVersion(target: ModuleBuildTarget): CacheVersion =
|
fun dataContainerCacheVersion(dataRoot: File): CacheVersion =
|
||||||
CacheVersion(ownVersion = EXPERIMENTAL_VERSION,
|
CacheVersion(ownVersion = DATA_CONTAINER_VERSION,
|
||||||
versionFile = File(target.dataRoot, EXPERIMENTAL_VERSION_FILE_NAME),
|
versionFile = File(dataRoot, DATA_CONTAINER_VERSION_FILE_NAME),
|
||||||
whenVersionChanged = Action.REBUILD_CHUNK,
|
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
||||||
whenTurnedOn = Action.REBUILD_CHUNK,
|
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
||||||
whenTurnedOff = Action.CLEAN_EXPERIMENTAL_CACHES,
|
whenTurnedOff = CacheVersion.Action.CLEAN_DATA_CONTAINER,
|
||||||
isEnabled = { IncrementalCompilation.isExperimental() })
|
isEnabled = { IncrementalCompilation.isExperimental() })
|
||||||
|
|
||||||
fun dataContainerVersion(): CacheVersion =
|
fun allCachesVersions(containerDataRoot: File, dataRoots: Iterable<File>): Iterable<CacheVersion> {
|
||||||
CacheVersion(ownVersion = DATA_CONTAINER_VERSION,
|
val versions = arrayListOf<CacheVersion>()
|
||||||
versionFile = File(KotlinDataContainerTarget.dataRoot, DATA_CONTAINER_VERSION_FILE_NAME),
|
versions.add(dataContainerCacheVersion(containerDataRoot))
|
||||||
whenVersionChanged = Action.REBUILD_ALL_KOTLIN,
|
|
||||||
whenTurnedOn = Action.REBUILD_ALL_KOTLIN,
|
|
||||||
whenTurnedOff = Action.CLEAN_DATA_CONTAINER,
|
|
||||||
isEnabled = { IncrementalCompilation.isExperimental() })
|
|
||||||
|
|
||||||
fun allVersions(targets: Iterable<ModuleBuildTarget>): Iterable<CacheVersion> {
|
for (dataRoot in dataRoots) {
|
||||||
val versions = arrayListOf<CacheVersion>()
|
versions.add(normalCacheVersion(dataRoot))
|
||||||
versions.add(dataContainerVersion())
|
versions.add(experimentalCacheVersion(dataRoot))
|
||||||
|
|
||||||
for (target in targets) {
|
|
||||||
versions.add(normalVersion(target))
|
|
||||||
versions.add(experimentalVersion(target))
|
|
||||||
}
|
|
||||||
|
|
||||||
return versions
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return versions
|
||||||
}
|
}
|
||||||
+29
-29
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import com.google.protobuf.MessageLite
|
import com.google.protobuf.MessageLite
|
||||||
import com.intellij.openapi.util.io.FileUtil.toSystemIndependentName
|
import com.intellij.openapi.util.io.FileUtil.toSystemIndependentName
|
||||||
@@ -22,13 +22,9 @@ import com.intellij.util.SmartList
|
|||||||
import com.intellij.util.io.BooleanDataDescriptor
|
import com.intellij.util.io.BooleanDataDescriptor
|
||||||
import com.intellij.util.io.EnumeratorStringDescriptor
|
import com.intellij.util.io.EnumeratorStringDescriptor
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
import org.jetbrains.jps.builders.storage.BuildDataPaths
|
import org.jetbrains.kotlin.build.GeneratedJvmClass
|
||||||
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
|
||||||
import org.jetbrains.jps.incremental.storage.PathStringDescriptor
|
|
||||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||||
import org.jetbrains.kotlin.jps.build.GeneratedJvmClass
|
import org.jetbrains.kotlin.incremental.storage.*
|
||||||
import org.jetbrains.kotlin.jps.build.KotlinBuilder
|
|
||||||
import org.jetbrains.kotlin.jps.incremental.storage.*
|
|
||||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
||||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||||
@@ -51,9 +47,10 @@ import java.util.*
|
|||||||
|
|
||||||
val KOTLIN_CACHE_DIRECTORY_NAME = "kotlin"
|
val KOTLIN_CACHE_DIRECTORY_NAME = "kotlin"
|
||||||
|
|
||||||
open class IncrementalCacheImpl(
|
open class IncrementalCacheImpl<Target>(
|
||||||
private val target: ModuleBuildTarget,
|
private val targetDataRoot: File,
|
||||||
paths: BuildDataPaths
|
targetOutputDir: File?,
|
||||||
|
target: Target
|
||||||
) : BasicMapsOwner(), IncrementalCache {
|
) : BasicMapsOwner(), IncrementalCache {
|
||||||
companion object {
|
companion object {
|
||||||
private val PROTO_MAP = "proto"
|
private val PROTO_MAP = "proto"
|
||||||
@@ -69,8 +66,7 @@ open class IncrementalCacheImpl(
|
|||||||
private val MODULE_MAPPING_FILE_NAME = "." + ModuleMapping.MAPPING_FILE_EXT
|
private val MODULE_MAPPING_FILE_NAME = "." + ModuleMapping.MAPPING_FILE_EXT
|
||||||
}
|
}
|
||||||
|
|
||||||
private val baseDir = File(paths.getTargetDataRoot(target), KOTLIN_CACHE_DIRECTORY_NAME)
|
private val baseDir = File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)
|
||||||
private val cacheVersionProvider = CacheVersionProvider(paths)
|
|
||||||
private val experimentalMaps = arrayListOf<BasicMap<*, *>>()
|
private val experimentalMaps = arrayListOf<BasicMap<*, *>>()
|
||||||
|
|
||||||
private fun <K, V, M : BasicMap<K, V>> registerExperimentalMap(map: M): M {
|
private fun <K, V, M : BasicMap<K, V>> registerExperimentalMap(map: M): M {
|
||||||
@@ -91,19 +87,22 @@ open class IncrementalCacheImpl(
|
|||||||
private val subtypesMap = registerExperimentalMap(SubtypesMap(SUBTYPES.storageFile))
|
private val subtypesMap = registerExperimentalMap(SubtypesMap(SUBTYPES.storageFile))
|
||||||
private val supertypesMap = registerExperimentalMap(SupertypesMap(SUPERTYPES.storageFile))
|
private val supertypesMap = registerExperimentalMap(SupertypesMap(SUPERTYPES.storageFile))
|
||||||
|
|
||||||
private val dependents = arrayListOf<IncrementalCacheImpl>()
|
private val dependents = arrayListOf<IncrementalCacheImpl<Target>>()
|
||||||
private val outputDir by lazy(LazyThreadSafetyMode.NONE) { requireNotNull(target.outputDir) { "Target is expected to have output directory: $target" } }
|
private val outputDir by lazy(LazyThreadSafetyMode.NONE) { requireNotNull(targetOutputDir) { "Target is expected to have output directory: $target" } }
|
||||||
|
|
||||||
protected val dependentsWithThis: Sequence<IncrementalCacheImpl>
|
// TODO: review
|
||||||
|
val dependentsWithThis: Sequence<IncrementalCacheImpl<Target>>
|
||||||
get() = sequenceOf(this).plus(dependents.asSequence())
|
get() = sequenceOf(this).plus(dependents.asSequence())
|
||||||
|
|
||||||
internal val dependentCaches: Iterable<IncrementalCacheImpl>
|
internal val dependentCaches: Iterable<IncrementalCacheImpl<Target>>
|
||||||
get() = dependents
|
get() = dependents
|
||||||
|
|
||||||
override fun registerInline(fromPath: String, jvmSignature: String, toPath: String) {
|
override fun registerInline(fromPath: String, jvmSignature: String, toPath: String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addDependentCache(cache: IncrementalCacheImpl) {
|
protected open fun debugLog(message: String) {}
|
||||||
|
|
||||||
|
fun addDependentCache(cache: IncrementalCacheImpl<Target>) {
|
||||||
dependents.add(cache)
|
dependents.add(cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +132,7 @@ open class IncrementalCacheImpl(
|
|||||||
return CompilationResult.NO_CHANGES
|
return CompilationResult.NO_CHANGES
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveFileToCache(generatedClass: GeneratedJvmClass): CompilationResult {
|
fun saveFileToCache(generatedClass: GeneratedJvmClass<Target>): CompilationResult {
|
||||||
val sourceFiles: Collection<File> = generatedClass.sourceFiles
|
val sourceFiles: Collection<File> = generatedClass.sourceFiles
|
||||||
val kotlinClass: LocalFileKotlinClass = generatedClass.outputClass
|
val kotlinClass: LocalFileKotlinClass = generatedClass.outputClass
|
||||||
val className = kotlinClass.className
|
val className = kotlinClass.className
|
||||||
@@ -199,7 +198,7 @@ open class IncrementalCacheImpl(
|
|||||||
private fun CompilationResult.logIfSomethingChanged(className: JvmClassName) {
|
private fun CompilationResult.logIfSomethingChanged(className: JvmClassName) {
|
||||||
if (this == CompilationResult.NO_CHANGES) return
|
if (this == CompilationResult.NO_CHANGES) return
|
||||||
|
|
||||||
KotlinBuilder.LOG.debug("$className is changed: $this")
|
debugLog("$className is changed: $this")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clearCacheForRemovedClasses(): CompilationResult {
|
fun clearCacheForRemovedClasses(): CompilationResult {
|
||||||
@@ -301,7 +300,7 @@ open class IncrementalCacheImpl(
|
|||||||
override fun getObsoletePackageParts(): Collection<String> {
|
override fun getObsoletePackageParts(): Collection<String> {
|
||||||
val obsoletePackageParts =
|
val obsoletePackageParts =
|
||||||
dirtyOutputClassesMap.getDirtyOutputClasses().filter { packagePartMap.isPackagePart(JvmClassName.byInternalName(it)) }
|
dirtyOutputClassesMap.getDirtyOutputClasses().filter { packagePartMap.isPackagePart(JvmClassName.byInternalName(it)) }
|
||||||
KotlinBuilder.LOG.debug("Obsolete package parts: ${obsoletePackageParts}")
|
debugLog("Obsolete package parts: ${obsoletePackageParts}")
|
||||||
return obsoletePackageParts
|
return obsoletePackageParts
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +316,7 @@ open class IncrementalCacheImpl(
|
|||||||
val dirtyFacade = partToMultifileFacade.get(dirtyClass) ?: continue
|
val dirtyFacade = partToMultifileFacade.get(dirtyClass) ?: continue
|
||||||
obsoleteMultifileClasses.add(dirtyFacade)
|
obsoleteMultifileClasses.add(dirtyFacade)
|
||||||
}
|
}
|
||||||
KotlinBuilder.LOG.debug("Obsolete multifile class facades: $obsoleteMultifileClasses")
|
debugLog("Obsolete multifile class facades: $obsoleteMultifileClasses")
|
||||||
return obsoleteMultifileClasses
|
return obsoleteMultifileClasses
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,12 +335,12 @@ open class IncrementalCacheImpl(
|
|||||||
|
|
||||||
override fun clean() {
|
override fun clean() {
|
||||||
super.clean()
|
super.clean()
|
||||||
cacheVersionProvider.normalVersion(target).clean()
|
normalCacheVersion(targetDataRoot).clean()
|
||||||
cacheVersionProvider.experimentalVersion(target).clean()
|
experimentalCacheVersion(targetDataRoot).clean()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cleanExperimental() {
|
fun cleanExperimental() {
|
||||||
cacheVersionProvider.experimentalVersion(target).clean()
|
experimentalCacheVersion(targetDataRoot).clean()
|
||||||
experimentalMaps.forEach { it.clean() }
|
experimentalMaps.forEach { it.clean() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +496,8 @@ open class IncrementalCacheImpl(
|
|||||||
override fun dumpValue(value: String): String = value
|
override fun dumpValue(value: String): String = value
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class SourceToClassesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor.INSTANCE, StringCollectionExternalizer) {
|
// TODO: find how to deal with PathStringDescriptor - it seems too deeply rooted in jps
|
||||||
|
inner class SourceToClassesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, /* PathStringDescriptor.INSTANCE,*/ StringCollectionExternalizer) {
|
||||||
fun clearOutputsForSource(sourceFile: File) {
|
fun clearOutputsForSource(sourceFile: File) {
|
||||||
remove(sourceFile.absolutePath)
|
remove(sourceFile.absolutePath)
|
||||||
}
|
}
|
||||||
@@ -614,10 +614,10 @@ data class CompilationResult(
|
|||||||
|
|
||||||
operator fun plus(other: CompilationResult): CompilationResult =
|
operator fun plus(other: CompilationResult): CompilationResult =
|
||||||
CompilationResult(protoChanged || other.protoChanged,
|
CompilationResult(protoChanged || other.protoChanged,
|
||||||
constantsChanged || other.constantsChanged,
|
constantsChanged || other.constantsChanged,
|
||||||
inlineChanged || other.inlineChanged,
|
inlineChanged || other.inlineChanged,
|
||||||
inlineAdded || other.inlineAdded,
|
inlineAdded || other.inlineAdded,
|
||||||
changes + other.changes)
|
changes + other.changes)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ByteArray.md5(): Long {
|
fun ByteArray.md5(): Long {
|
||||||
+3
-6
@@ -14,22 +14,19 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
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.modules.TargetId
|
import org.jetbrains.kotlin.modules.TargetId
|
||||||
|
|
||||||
class IncrementalCompilationComponentsImpl(
|
class IncrementalCompilationComponentsImpl(
|
||||||
caches: Map<ModuleBuildTarget, IncrementalCache>,
|
private val caches: Map<TargetId, IncrementalCache>,
|
||||||
private val lookupTracker: LookupTracker
|
private val lookupTracker: LookupTracker
|
||||||
): IncrementalCompilationComponents {
|
): IncrementalCompilationComponents {
|
||||||
private val caches = caches.mapKeys { TargetId(it.key) }
|
|
||||||
|
|
||||||
override fun getIncrementalCache(target: TargetId): IncrementalCache =
|
override fun getIncrementalCache(target: TargetId): IncrementalCache =
|
||||||
caches[target]!!
|
caches[target] ?: throw Exception("Incremental cache for target ${target.name} not found")
|
||||||
|
|
||||||
override fun getLookupTracker(): LookupTracker = lookupTracker
|
override fun getLookupTracker(): LookupTracker = lookupTracker
|
||||||
}
|
}
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import org.jetbrains.kotlin.load.kotlin.FileBasedKotlinClass
|
import org.jetbrains.kotlin.load.kotlin.FileBasedKotlinClass
|
||||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||||
+3
-7
@@ -14,24 +14,20 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import com.intellij.util.containers.MultiMap
|
import com.intellij.util.containers.MultiMap
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
import org.jetbrains.jps.builders.storage.StorageProvider
|
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||||
import org.jetbrains.kotlin.incremental.components.Position
|
import org.jetbrains.kotlin.incremental.components.Position
|
||||||
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
import org.jetbrains.kotlin.incremental.components.ScopeKind
|
||||||
import org.jetbrains.kotlin.jps.incremental.storage.*
|
import org.jetbrains.kotlin.incremental.storage.*
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
object LookupStorageProvider : StorageProvider<LookupStorage>() {
|
|
||||||
override fun createStorage(targetDataDir: File): LookupStorage = LookupStorage(targetDataDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
class LookupStorage(private val targetDataDir: File) : BasicMapsOwner() {
|
open class LookupStorage(private val targetDataDir: File) : BasicMapsOwner() {
|
||||||
companion object {
|
companion object {
|
||||||
private val DELETED_TO_SIZE_TRESHOLD = 0.5
|
private val DELETED_TO_SIZE_TRESHOLD = 0.5
|
||||||
private val MINIMUM_GARBAGE_COLLECTIBLE_SIZE = 10000
|
private val MINIMUM_GARBAGE_COLLECTIBLE_SIZE = 10000
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
+4
-4
@@ -14,13 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import com.google.protobuf.MessageLite
|
import com.google.protobuf.MessageLite
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.jps.incremental.ProtoCompareGenerated.ProtoBufClassKind
|
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
|
||||||
import org.jetbrains.kotlin.jps.incremental.ProtoCompareGenerated.ProtoBufPackageKind
|
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
|
||||||
import org.jetbrains.kotlin.jps.incremental.storage.ProtoMapValue
|
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
|
||||||
import org.jetbrains.kotlin.serialization.Flags
|
import org.jetbrains.kotlin.serialization.Flags
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.Deserialization
|
import org.jetbrains.kotlin.serialization.deserialization.Deserialization
|
||||||
+3
-3
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import com.intellij.util.io.DataExternalizer
|
import com.intellij.util.io.DataExternalizer
|
||||||
import com.intellij.util.io.EnumeratorStringDescriptor
|
import com.intellij.util.io.EnumeratorStringDescriptor
|
||||||
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.TestOnly
|
|||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal abstract class BasicMap<K : Comparable<K>, V>(
|
abstract class BasicMap<K : Comparable<K>, V>(
|
||||||
storageFile: File,
|
storageFile: File,
|
||||||
keyDescriptor: KeyDescriptor<K>,
|
keyDescriptor: KeyDescriptor<K>,
|
||||||
valueExternalizer: DataExternalizer<V>
|
valueExternalizer: DataExternalizer<V>
|
||||||
@@ -67,7 +67,7 @@ internal abstract class BasicMap<K : Comparable<K>, V>(
|
|||||||
protected abstract fun dumpValue(value: V): String
|
protected abstract fun dumpValue(value: V): String
|
||||||
}
|
}
|
||||||
|
|
||||||
internal abstract class BasicStringMap<V>(
|
abstract class BasicStringMap<V>(
|
||||||
storageFile: File,
|
storageFile: File,
|
||||||
keyDescriptor: KeyDescriptor<String>,
|
keyDescriptor: KeyDescriptor<String>,
|
||||||
valueExternalizer: DataExternalizer<V>
|
valueExternalizer: DataExternalizer<V>
|
||||||
+5
-6
@@ -14,12 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
import org.jetbrains.jps.incremental.storage.StorageOwner
|
|
||||||
|
|
||||||
open class BasicMapsOwner : StorageOwner {
|
open class BasicMapsOwner {
|
||||||
private val maps = arrayListOf<BasicMap<*, *>>()
|
private val maps = arrayListOf<BasicMap<*, *>>()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -31,15 +30,15 @@ open class BasicMapsOwner : StorageOwner {
|
|||||||
return map
|
return map
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun clean() {
|
open fun clean() {
|
||||||
maps.forEach { it.clean() }
|
maps.forEach { it.clean() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() {
|
open fun close() {
|
||||||
maps.forEach { it.close() }
|
maps.forEach { it.close() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun flush(memoryCachesOnly: Boolean) {
|
open fun flush(memoryCachesOnly: Boolean) {
|
||||||
maps.forEach { it.flush(memoryCachesOnly) }
|
maps.forEach { it.flush(memoryCachesOnly) }
|
||||||
}
|
}
|
||||||
|
|
||||||
+2
-2
@@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import org.jetbrains.kotlin.jps.incremental.dumpCollection
|
import org.jetbrains.kotlin.incremental.dumpCollection
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import org.jetbrains.kotlin.utils.keysToMap
|
import org.jetbrains.kotlin.utils.keysToMap
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import com.intellij.util.io.ExternalIntegerKeyDescriptor
|
import com.intellij.util.io.ExternalIntegerKeyDescriptor
|
||||||
import java.io.File
|
import java.io.File
|
||||||
+2
-2
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import com.intellij.util.io.DataExternalizer
|
import com.intellij.util.io.DataExternalizer
|
||||||
import com.intellij.util.io.IOUtil
|
import com.intellij.util.io.IOUtil
|
||||||
@@ -28,7 +28,7 @@ import java.io.IOException
|
|||||||
/**
|
/**
|
||||||
* It's lazy in a sense that PersistentHashMap is created only on write
|
* It's lazy in a sense that PersistentHashMap is created only on write
|
||||||
*/
|
*/
|
||||||
internal class LazyStorage<K, V>(
|
class LazyStorage<K, V>(
|
||||||
private val storageFile: File,
|
private val storageFile: File,
|
||||||
private val keyDescriptor: KeyDescriptor<K>,
|
private val keyDescriptor: KeyDescriptor<K>,
|
||||||
private val valueExternalizer: DataExternalizer<V>
|
private val valueExternalizer: DataExternalizer<V>
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
+22
-4
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import com.intellij.util.io.DataExternalizer
|
import com.intellij.util.io.DataExternalizer
|
||||||
@@ -22,7 +22,6 @@ import com.intellij.util.io.EnumeratorStringDescriptor
|
|||||||
import com.intellij.util.io.IOUtil
|
import com.intellij.util.io.IOUtil
|
||||||
import com.intellij.util.io.KeyDescriptor
|
import com.intellij.util.io.KeyDescriptor
|
||||||
import gnu.trove.THashSet
|
import gnu.trove.THashSet
|
||||||
import org.jetbrains.jps.incremental.storage.PathStringDescriptor
|
|
||||||
import java.io.DataInput
|
import java.io.DataInput
|
||||||
import java.io.DataInputStream
|
import java.io.DataInputStream
|
||||||
import java.io.DataOutput
|
import java.io.DataOutput
|
||||||
@@ -125,6 +124,27 @@ object StringToLongMapExternalizer : StringMapExternalizer<Long>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
object PathStringCollectionExternalizer : DataExternalizer<Collection<String>> {
|
||||||
|
override fun save(output: DataOutput, value: Collection<String>) {
|
||||||
|
for (str in value) {
|
||||||
|
IOUtil.writeUTF(output, str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun read(input: DataInput): Collection<String> {
|
||||||
|
val result = THashSet(FileUtil.PATH_HASHING_STRATEGY)
|
||||||
|
val stream = input as DataInputStream
|
||||||
|
|
||||||
|
while (stream.available() > 0) {
|
||||||
|
val str = IOUtil.readUTF(stream)
|
||||||
|
result.add(str)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
object ConstantsMapExternalizer : DataExternalizer<Map<String, Any>> {
|
object ConstantsMapExternalizer : DataExternalizer<Map<String, Any>> {
|
||||||
override fun save(output: DataOutput, map: Map<String, Any>?) {
|
override fun save(output: DataOutput, map: Map<String, Any>?) {
|
||||||
output.writeInt(map!!.size)
|
output.writeInt(map!!.size)
|
||||||
@@ -228,6 +248,4 @@ open class CollectionExternalizer<T>(
|
|||||||
|
|
||||||
object StringCollectionExternalizer : CollectionExternalizer<String>(EnumeratorStringDescriptor(), { HashSet() })
|
object StringCollectionExternalizer : CollectionExternalizer<String>(EnumeratorStringDescriptor(), { HashSet() })
|
||||||
|
|
||||||
object PathCollectionExternalizer : CollectionExternalizer<String>(PathStringDescriptor(), { THashSet(FileUtil.PATH_HASHING_STRATEGY) })
|
|
||||||
|
|
||||||
object IntCollectionExternalizer : CollectionExternalizer<Int>(IntExternalizer, { HashSet() })
|
object IntCollectionExternalizer : CollectionExternalizer<Int>(IntExternalizer, { HashSet() })
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.jps.incremental.storage
|
package org.jetbrains.kotlin.incremental.storage
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ import java.util.*
|
|||||||
|
|
||||||
class GenerateProtoBufCompare {
|
class GenerateProtoBufCompare {
|
||||||
companion object {
|
companion object {
|
||||||
val DEST_FILE: File = File("jps-plugin/src/org/jetbrains/kotlin/jps/incremental/ProtoCompareGenerated.kt")
|
val DEST_FILE: File = File("build/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt")
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
@@ -70,7 +70,7 @@ class GenerateProtoBufCompare {
|
|||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
val p = Printer(sb)
|
val p = Printer(sb)
|
||||||
p.println(File("license/LICENSE.txt").readText())
|
p.println(File("license/LICENSE.txt").readText())
|
||||||
p.println("package org.jetbrains.kotlin.jps.incremental")
|
p.println("package org.jetbrains.kotlin.incremental")
|
||||||
p.println()
|
p.println()
|
||||||
|
|
||||||
p.println("import org.jetbrains.kotlin.name.ClassId")
|
p.println("import org.jetbrains.kotlin.name.ClassId")
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module" module-name="idea-jps-common" />
|
<orderEntry type="module" module-name="idea-jps-common" />
|
||||||
<orderEntry type="module" module-name="cli-common" />
|
<orderEntry type="module" module-name="cli-common" />
|
||||||
|
<orderEntry type="module" module-name="build" />
|
||||||
<orderEntry type="library" name="jps" level="project" />
|
<orderEntry type="library" name="jps" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="jps-test" level="project" />
|
<orderEntry type="library" scope="TEST" name="jps-test" level="project" />
|
||||||
<orderEntry type="library" scope="TEST" name="idea-full" level="project" />
|
<orderEntry type="library" scope="TEST" name="idea-full" level="project" />
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ import org.jetbrains.jps.model.ex.JpsElementChildRoleBase
|
|||||||
import org.jetbrains.jps.model.java.JpsJavaClasspathKind
|
import org.jetbrains.jps.model.java.JpsJavaClasspathKind
|
||||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService
|
import org.jetbrains.jps.model.java.JpsJavaExtensionService
|
||||||
import org.jetbrains.jps.model.module.JpsModule
|
import org.jetbrains.jps.model.module.JpsModule
|
||||||
|
import org.jetbrains.kotlin.build.GeneratedFile
|
||||||
|
import org.jetbrains.kotlin.build.GeneratedJvmClass
|
||||||
|
import org.jetbrains.kotlin.build.isModuleMappingFile
|
||||||
import org.jetbrains.kotlin.cli.common.KotlinVersion
|
import org.jetbrains.kotlin.cli.common.KotlinVersion
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||||
@@ -54,10 +57,10 @@ import org.jetbrains.kotlin.config.CompilerRunnerConstants.INTERNAL_ERROR_PREFIX
|
|||||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||||
import org.jetbrains.kotlin.config.Services
|
import org.jetbrains.kotlin.config.Services
|
||||||
import org.jetbrains.kotlin.daemon.common.isDaemonEnabled
|
import org.jetbrains.kotlin.daemon.common.isDaemonEnabled
|
||||||
|
import org.jetbrains.kotlin.incremental.*
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||||
import org.jetbrains.kotlin.jps.JpsKotlinCompilerSettings
|
import org.jetbrains.kotlin.jps.JpsKotlinCompilerSettings
|
||||||
import org.jetbrains.kotlin.jps.incremental.*
|
import org.jetbrains.kotlin.jps.incremental.*
|
||||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
|
||||||
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.modules.TargetId
|
import org.jetbrains.kotlin.modules.TargetId
|
||||||
@@ -67,7 +70,6 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
|||||||
import org.jetbrains.kotlin.utils.JsLibraryUtils
|
import org.jetbrains.kotlin.utils.JsLibraryUtils
|
||||||
import org.jetbrains.kotlin.utils.PathUtil
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import org.jetbrains.kotlin.utils.keysToMap
|
import org.jetbrains.kotlin.utils.keysToMap
|
||||||
import org.jetbrains.kotlin.utils.sure
|
|
||||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -249,7 +251,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
return OK
|
return OK
|
||||||
}
|
}
|
||||||
|
|
||||||
val generatedClasses = generatedFiles.filterIsInstance<GeneratedJvmClass>()
|
val generatedClasses = generatedFiles.filterIsInstance<GeneratedJvmClass<ModuleBuildTarget>>()
|
||||||
updateJavaMappings(chunk, compilationErrors, context, dirtyFilesHolder, filesToCompile, generatedClasses)
|
updateJavaMappings(chunk, compilationErrors, context, dirtyFilesHolder, filesToCompile, generatedClasses)
|
||||||
|
|
||||||
if (!IncrementalCompilation.isEnabled()) {
|
if (!IncrementalCompilation.isEnabled()) {
|
||||||
@@ -301,7 +303,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
rebuildAfterCacheVersionChanged[target] = true
|
rebuildAfterCacheVersionChanged[target] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
dataManager.getStorage(KotlinDataContainerTarget, LookupStorageProvider).clean()
|
dataManager.getStorage(KotlinDataContainerTarget, JpsLookupStorageProvider).clean()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
CacheVersion.Action.REBUILD_CHUNK -> {
|
CacheVersion.Action.REBUILD_CHUNK -> {
|
||||||
@@ -333,7 +335,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
}
|
}
|
||||||
CacheVersion.Action.CLEAN_DATA_CONTAINER -> {
|
CacheVersion.Action.CLEAN_DATA_CONTAINER -> {
|
||||||
LOG.info("Clearing lookup cache")
|
LOG.info("Clearing lookup cache")
|
||||||
dataManager.getStorage(KotlinDataContainerTarget, LookupStorageProvider).clean()
|
dataManager.getStorage(KotlinDataContainerTarget, JpsLookupStorageProvider).clean()
|
||||||
cacheVersionsProvider.dataContainerVersion().clean()
|
cacheVersionsProvider.dataContainerVersion().clean()
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
@@ -353,7 +355,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
private fun doCompileModuleChunk(
|
private fun doCompileModuleChunk(
|
||||||
allCompiledFiles: MutableSet<File>, chunk: ModuleChunk, commonArguments: CommonCompilerArguments, context: CompileContext,
|
allCompiledFiles: MutableSet<File>, chunk: ModuleChunk, commonArguments: CommonCompilerArguments, context: CompileContext,
|
||||||
dirtyFilesHolder: DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget>, environment: CompilerEnvironment,
|
dirtyFilesHolder: DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget>, environment: CompilerEnvironment,
|
||||||
filesToCompile: MultiMap<ModuleBuildTarget, File>, incrementalCaches: Map<ModuleBuildTarget, IncrementalCacheImpl>,
|
filesToCompile: MultiMap<ModuleBuildTarget, File>, incrementalCaches: Map<ModuleBuildTarget, IncrementalCacheImpl<*>>,
|
||||||
messageCollector: MessageCollectorAdapter, project: JpsProject
|
messageCollector: MessageCollectorAdapter, project: JpsProject
|
||||||
): OutputItemsCollectorImpl? {
|
): OutputItemsCollectorImpl? {
|
||||||
|
|
||||||
@@ -398,7 +400,8 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
context: CompileContext
|
context: CompileContext
|
||||||
): CompilerEnvironment {
|
): CompilerEnvironment {
|
||||||
val compilerServices = Services.Builder()
|
val compilerServices = Services.Builder()
|
||||||
.register(IncrementalCompilationComponents::class.java, IncrementalCompilationComponentsImpl(incrementalCaches, lookupTracker))
|
.register(IncrementalCompilationComponents::class.java,
|
||||||
|
IncrementalCompilationComponentsImpl(incrementalCaches.mapKeys { TargetId(it.key) }, lookupTracker))
|
||||||
.register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus {
|
.register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus {
|
||||||
override fun checkCanceled() {
|
override fun checkCanceled() {
|
||||||
if (context.cancelStatus.isCanceled) throw CompilationCanceledException()
|
if (context.cancelStatus.isCanceled) throw CompilationCanceledException()
|
||||||
@@ -424,7 +427,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
private fun getGeneratedFiles(
|
private fun getGeneratedFiles(
|
||||||
chunk: ModuleChunk,
|
chunk: ModuleChunk,
|
||||||
outputItemCollector: OutputItemsCollectorImpl
|
outputItemCollector: OutputItemsCollectorImpl
|
||||||
): List<GeneratedFile> {
|
): List<GeneratedFile<ModuleBuildTarget>> {
|
||||||
// If there's only one target, this map is empty: get() always returns null, and the representativeTarget will be used below
|
// If there's only one target, this map is empty: get() always returns null, and the representativeTarget will be used below
|
||||||
val sourceToTarget = HashMap<File, ModuleBuildTarget>()
|
val sourceToTarget = HashMap<File, ModuleBuildTarget>()
|
||||||
if (chunk.targets.size > 1) {
|
if (chunk.targets.size > 1) {
|
||||||
@@ -435,7 +438,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = ArrayList<GeneratedFile>()
|
val result = ArrayList<GeneratedFile<ModuleBuildTarget>>()
|
||||||
|
|
||||||
val representativeTarget = chunk.representativeTarget()
|
val representativeTarget = chunk.representativeTarget()
|
||||||
for (outputItem in outputItemCollector.outputs) {
|
for (outputItem in outputItemCollector.outputs) {
|
||||||
@@ -450,7 +453,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
result.add(GeneratedJvmClass(target, sourceFiles, outputFile))
|
result.add(GeneratedJvmClass(target, sourceFiles, outputFile))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result.add(GeneratedFile(target, sourceFiles, outputFile))
|
result.add(GeneratedFile<ModuleBuildTarget>(target, sourceFiles, outputFile))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@@ -462,7 +465,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
context: CompileContext,
|
context: CompileContext,
|
||||||
dirtyFilesHolder: DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget>,
|
dirtyFilesHolder: DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget>,
|
||||||
filesToCompile: MultiMap<ModuleBuildTarget, File>,
|
filesToCompile: MultiMap<ModuleBuildTarget, File>,
|
||||||
generatedClasses: List<GeneratedJvmClass>
|
generatedClasses: List<GeneratedJvmClass<ModuleBuildTarget>>
|
||||||
) {
|
) {
|
||||||
val previousMappings = context.projectDescriptor.dataManager.mappings
|
val previousMappings = context.projectDescriptor.dataManager.mappings
|
||||||
val delta = previousMappings.createDelta()
|
val delta = previousMappings.createDelta()
|
||||||
@@ -481,7 +484,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
JavaBuilderUtil.updateMappings(context, delta, dirtyFilesHolder, chunk, allCompiled, compiledInThisRound)
|
JavaBuilderUtil.updateMappings(context, delta, dirtyFilesHolder, chunk, allCompiled, compiledInThisRound)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerOutputItems(outputConsumer: ModuleLevelBuilder.OutputConsumer, generatedFiles: List<GeneratedFile>) {
|
private fun registerOutputItems(outputConsumer: ModuleLevelBuilder.OutputConsumer, generatedFiles: List<GeneratedFile<ModuleBuildTarget>>) {
|
||||||
for (generatedFile in generatedFiles) {
|
for (generatedFile in generatedFiles) {
|
||||||
outputConsumer.registerOutputFile(generatedFile.target, generatedFile.outputFile, generatedFile.sourceFiles.map { it.path })
|
outputConsumer.registerOutputFile(generatedFile.target, generatedFile.outputFile, generatedFile.sourceFiles.map { it.path })
|
||||||
}
|
}
|
||||||
@@ -489,8 +492,8 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
|
|
||||||
private fun updateKotlinIncrementalCache(
|
private fun updateKotlinIncrementalCache(
|
||||||
compilationErrors: Boolean,
|
compilationErrors: Boolean,
|
||||||
incrementalCaches: Map<ModuleBuildTarget, IncrementalCacheImpl>,
|
incrementalCaches: Map<ModuleBuildTarget, JpsIncrementalCacheImpl>,
|
||||||
generatedFiles: List<GeneratedFile>
|
generatedFiles: List<GeneratedFile<ModuleBuildTarget>>
|
||||||
): CompilationResult {
|
): CompilationResult {
|
||||||
|
|
||||||
assert(IncrementalCompilation.isEnabled()) { "updateKotlinIncrementalCache should not be called when incremental compilation disabled" }
|
assert(IncrementalCompilation.isEnabled()) { "updateKotlinIncrementalCache should not be called when incremental compilation disabled" }
|
||||||
@@ -499,7 +502,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
for (generatedFile in generatedFiles) {
|
for (generatedFile in generatedFiles) {
|
||||||
val ic = incrementalCaches[generatedFile.target]!!
|
val ic = incrementalCaches[generatedFile.target]!!
|
||||||
val newChangesInfo =
|
val newChangesInfo =
|
||||||
if (generatedFile is GeneratedJvmClass) {
|
if (generatedFile is GeneratedJvmClass<ModuleBuildTarget>) {
|
||||||
ic.saveFileToCache(generatedFile)
|
ic.saveFileToCache(generatedFile)
|
||||||
}
|
}
|
||||||
else if (generatedFile.outputFile.isModuleMappingFile()) {
|
else if (generatedFile.outputFile.isModuleMappingFile()) {
|
||||||
@@ -533,7 +536,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
|
|
||||||
if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker.javaClass}")
|
if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker.javaClass}")
|
||||||
|
|
||||||
val lookupStorage = dataManager.getStorage(KotlinDataContainerTarget, LookupStorageProvider)
|
val lookupStorage = dataManager.getStorage(KotlinDataContainerTarget, JpsLookupStorageProvider)
|
||||||
|
|
||||||
filesToCompile.values().forEach { lookupStorage.removeLookupsFrom(it) }
|
filesToCompile.values().forEach { lookupStorage.removeLookupsFrom(it) }
|
||||||
val removedFiles = chunk.targets.flatMap { KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, it) }
|
val removedFiles = chunk.targets.flatMap { KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, it) }
|
||||||
@@ -542,8 +545,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
lookupTracker.lookups.entrySet().forEach { lookupStorage.add(it.key, it.value) }
|
lookupTracker.lookups.entrySet().forEach { lookupStorage.add(it.key, it.value) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun File.isModuleMappingFile() = extension == ModuleMapping.MAPPING_FILE_EXT && parentFile.name == "META-INF"
|
|
||||||
|
|
||||||
// if null is returned, nothing was done
|
// if null is returned, nothing was done
|
||||||
private fun compileToJs(chunk: ModuleChunk,
|
private fun compileToJs(chunk: ModuleChunk,
|
||||||
commonArguments: CommonCompilerArguments,
|
commonArguments: CommonCompilerArguments,
|
||||||
@@ -740,12 +741,11 @@ private fun CompilationResult.doProcessChangesUsingLookups(
|
|||||||
compiledFiles: Set<File>,
|
compiledFiles: Set<File>,
|
||||||
dataManager: BuildDataManager,
|
dataManager: BuildDataManager,
|
||||||
fsOperations: FSOperationsHelper,
|
fsOperations: FSOperationsHelper,
|
||||||
caches: Collection<IncrementalCacheImpl>
|
caches: Collection<IncrementalCacheImpl<*>>
|
||||||
) {
|
) {
|
||||||
val dirtyLookupSymbols = HashSet<LookupSymbol>()
|
val dirtyLookupSymbols = HashSet<LookupSymbol>()
|
||||||
val lookupStorage = dataManager.getStorage(KotlinDataContainerTarget, LookupStorageProvider)
|
val lookupStorage = dataManager.getStorage(KotlinDataContainerTarget, JpsLookupStorageProvider)
|
||||||
val allCaches = caches.toHashSet()
|
val allCaches: Sequence<IncrementalCacheImpl<*>> = caches.asSequence().flatMap { it.dependentsWithThis }
|
||||||
allCaches.addAll(caches.flatMap { it.dependentCaches })
|
|
||||||
|
|
||||||
KotlinBuilder.LOG.debug("Start processing changes")
|
KotlinBuilder.LOG.debug("Start processing changes")
|
||||||
|
|
||||||
@@ -797,7 +797,7 @@ private fun CompilationResult.doProcessChangesUsingLookups(
|
|||||||
*/
|
*/
|
||||||
private fun withSubtypes(
|
private fun withSubtypes(
|
||||||
typeFqName: FqName,
|
typeFqName: FqName,
|
||||||
caches: Collection<IncrementalCacheImpl>
|
caches: Sequence<IncrementalCacheImpl<*>>
|
||||||
): Set<FqName> {
|
): Set<FqName> {
|
||||||
val types = linkedListOf(typeFqName)
|
val types = linkedListOf(typeFqName)
|
||||||
val subtypes = hashSetOf<FqName>()
|
val subtypes = hashSetOf<FqName>()
|
||||||
@@ -805,10 +805,9 @@ private fun withSubtypes(
|
|||||||
while (types.isNotEmpty()) {
|
while (types.isNotEmpty()) {
|
||||||
val unprocessedType = types.pollFirst()
|
val unprocessedType = types.pollFirst()
|
||||||
|
|
||||||
caches.asSequence()
|
caches.flatMap { it.getSubtypesOf(unprocessedType) }
|
||||||
.flatMap { it.getSubtypesOf(unprocessedType) }
|
.filter { it !in subtypes }
|
||||||
.filter { it !in subtypes }
|
.forEach { types.addLast(it) }
|
||||||
.forEach { types.addLast(it) }
|
|
||||||
|
|
||||||
subtypes.add(unprocessedType)
|
subtypes.add(unprocessedType)
|
||||||
}
|
}
|
||||||
@@ -915,22 +914,6 @@ private fun hasKotlinDirtyOrRemovedFiles(
|
|||||||
return chunk.targets.any { KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, it).isNotEmpty() }
|
return chunk.targets.any { KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, it).isNotEmpty() }
|
||||||
}
|
}
|
||||||
|
|
||||||
open class GeneratedFile internal constructor(
|
|
||||||
val target: ModuleBuildTarget,
|
|
||||||
val sourceFiles: Collection<File>,
|
|
||||||
val outputFile: File
|
|
||||||
)
|
|
||||||
|
|
||||||
class GeneratedJvmClass (
|
|
||||||
target: ModuleBuildTarget,
|
|
||||||
sourceFiles: Collection<File>,
|
|
||||||
outputFile: File
|
|
||||||
) : GeneratedFile(target, sourceFiles, outputFile) {
|
|
||||||
val outputClass = LocalFileKotlinClass.create(outputFile).sure {
|
|
||||||
"Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private inline fun <T, R> Iterable<T>.forAllPairs(other: Iterable<R>, fn: (T, R)->Unit) {
|
private inline fun <T, R> Iterable<T>.forAllPairs(other: Iterable<R>, fn: (T, R)->Unit) {
|
||||||
for (t in this) {
|
for (t in this) {
|
||||||
for (r in other) {
|
for (r in other) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.jps.build
|
|||||||
import org.jetbrains.jps.builders.storage.BuildDataPaths
|
import org.jetbrains.jps.builders.storage.BuildDataPaths
|
||||||
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
||||||
import org.jetbrains.jps.incremental.storage.BuildDataManager
|
import org.jetbrains.jps.incremental.storage.BuildDataManager
|
||||||
import org.jetbrains.kotlin.jps.incremental.KOTLIN_CACHE_DIRECTORY_NAME
|
import org.jetbrains.kotlin.incremental.KOTLIN_CACHE_DIRECTORY_NAME
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
private val HAS_KOTLIN_MARKER_FILE_NAME = "has-kotlin-marker.txt"
|
private val HAS_KOTLIN_MARKER_FILE_NAME = "has-kotlin-marker.txt"
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* 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.jps.incremental
|
||||||
|
|
||||||
|
import org.jetbrains.jps.builders.BuildTarget
|
||||||
|
import org.jetbrains.jps.builders.storage.BuildDataPaths
|
||||||
|
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
||||||
|
import org.jetbrains.kotlin.incremental.*
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
class CacheVersionProvider(private val paths: BuildDataPaths) {
|
||||||
|
private val BuildTarget<*>.dataRoot: File
|
||||||
|
get() = paths.getTargetDataRoot(this)
|
||||||
|
|
||||||
|
fun normalVersion(target: ModuleBuildTarget): CacheVersion = normalCacheVersion(target.dataRoot)
|
||||||
|
|
||||||
|
fun experimentalVersion(target: ModuleBuildTarget): CacheVersion = experimentalCacheVersion(target.dataRoot)
|
||||||
|
|
||||||
|
fun dataContainerVersion(): CacheVersion = dataContainerCacheVersion(KotlinDataContainerTarget.dataRoot)
|
||||||
|
|
||||||
|
fun allVersions(targets: Iterable<ModuleBuildTarget>): Iterable<CacheVersion> = allCachesVersions(KotlinDataContainerTarget.dataRoot, targets.map { it.dataRoot } )
|
||||||
|
}
|
||||||
@@ -24,8 +24,10 @@ import org.jetbrains.jps.incremental.ModuleBuildTarget
|
|||||||
import org.jetbrains.jps.incremental.storage.BuildDataManager
|
import org.jetbrains.jps.incremental.storage.BuildDataManager
|
||||||
import org.jetbrains.jps.incremental.storage.StorageOwner
|
import org.jetbrains.jps.incremental.storage.StorageOwner
|
||||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||||
|
import org.jetbrains.kotlin.incremental.*
|
||||||
|
import org.jetbrains.kotlin.incremental.storage.*
|
||||||
import org.jetbrains.kotlin.inline.inlineFunctionsJvmNames
|
import org.jetbrains.kotlin.inline.inlineFunctionsJvmNames
|
||||||
import org.jetbrains.kotlin.jps.incremental.storage.*
|
import org.jetbrains.kotlin.jps.build.KotlinBuilder
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||||
import org.jetbrains.org.objectweb.asm.*
|
import org.jetbrains.org.objectweb.asm.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -34,7 +36,7 @@ import java.util.*
|
|||||||
class JpsIncrementalCacheImpl(
|
class JpsIncrementalCacheImpl(
|
||||||
target: ModuleBuildTarget,
|
target: ModuleBuildTarget,
|
||||||
paths: BuildDataPaths
|
paths: BuildDataPaths
|
||||||
) : IncrementalCacheImpl(target, paths), StorageOwner {
|
) : IncrementalCacheImpl<ModuleBuildTarget>(paths.getTargetDataRoot(target), target.outputDir, target), StorageOwner {
|
||||||
|
|
||||||
private val inlineFunctionsMap = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
|
private val inlineFunctionsMap = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile))
|
||||||
private val dirtyInlineFunctionsMap = registerMap(DirtyInlineFunctionsMap(DIRTY_INLINE_FUNCTIONS.storageFile))
|
private val dirtyInlineFunctionsMap = registerMap(DirtyInlineFunctionsMap(DIRTY_INLINE_FUNCTIONS.storageFile))
|
||||||
@@ -46,6 +48,10 @@ class JpsIncrementalCacheImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun debugLog(message: String) {
|
||||||
|
KotlinBuilder.LOG.debug(message)
|
||||||
|
}
|
||||||
|
|
||||||
override fun additionalProcessChangedClass(kotlinClass: LocalFileKotlinClass, isPackage: Boolean) =
|
override fun additionalProcessChangedClass(kotlinClass: LocalFileKotlinClass, isPackage: Boolean) =
|
||||||
inlineFunctionsMap.process(kotlinClass, isPackage)
|
inlineFunctionsMap.process(kotlinClass, isPackage)
|
||||||
|
|
||||||
@@ -173,7 +179,7 @@ class JpsIncrementalCacheImpl(
|
|||||||
* * inlineFunction - jvmSignature of some inline function in source file
|
* * inlineFunction - jvmSignature of some inline function in source file
|
||||||
* * target files - collection of files inlineFunction has been inlined to
|
* * target files - collection of files inlineFunction has been inlined to
|
||||||
*/
|
*/
|
||||||
private inner class InlineFunctionsFilesMap(storageFile: File) : BasicMap<PathFunctionPair, Collection<String>>(storageFile, PathFunctionPairKeyDescriptor, PathCollectionExternalizer) {
|
private inner class InlineFunctionsFilesMap(storageFile: File) : BasicMap<PathFunctionPair, Collection<String>>(storageFile, PathFunctionPairKeyDescriptor, PathStringCollectionExternalizer) {
|
||||||
fun add(sourcePath: String, jvmSignature: String, targetPath: String) {
|
fun add(sourcePath: String, jvmSignature: String, targetPath: String) {
|
||||||
val key = PathFunctionPair(sourcePath, jvmSignature)
|
val key = PathFunctionPair(sourcePath, jvmSignature)
|
||||||
storage.append(key, targetPath)
|
storage.append(key, targetPath)
|
||||||
|
|||||||
@@ -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.jps.incremental
|
||||||
|
|
||||||
|
import org.jetbrains.jps.builders.storage.StorageProvider
|
||||||
|
import org.jetbrains.jps.incremental.storage.StorageOwner
|
||||||
|
import org.jetbrains.kotlin.incremental.LookupStorage
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
object JpsLookupStorageProvider : StorageProvider<JpsLookupStorage>() {
|
||||||
|
override fun createStorage(targetDataDir: File): JpsLookupStorage = JpsLookupStorage(targetDataDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
class JpsLookupStorage(targetDataDir: File) : StorageOwner, LookupStorage(targetDataDir)
|
||||||
@@ -44,11 +44,11 @@ import org.jetbrains.jps.model.java.JpsJavaDependencyScope
|
|||||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService
|
import org.jetbrains.jps.model.java.JpsJavaExtensionService
|
||||||
import org.jetbrains.jps.util.JpsPathUtil
|
import org.jetbrains.jps.util.JpsPathUtil
|
||||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||||
|
import org.jetbrains.kotlin.incremental.LookupSymbol
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||||
import org.jetbrains.kotlin.jps.build.classFilesComparison.assertEqualDirectories
|
import org.jetbrains.kotlin.jps.build.classFilesComparison.assertEqualDirectories
|
||||||
|
import org.jetbrains.kotlin.jps.incremental.JpsLookupStorageProvider
|
||||||
import org.jetbrains.kotlin.jps.incremental.KotlinDataContainerTarget
|
import org.jetbrains.kotlin.jps.incremental.KotlinDataContainerTarget
|
||||||
import org.jetbrains.kotlin.jps.incremental.LookupStorageProvider
|
|
||||||
import org.jetbrains.kotlin.jps.incremental.LookupSymbol
|
|
||||||
import org.jetbrains.kotlin.jps.incremental.getKotlinCache
|
import org.jetbrains.kotlin.jps.incremental.getKotlinCache
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
@@ -384,7 +384,7 @@ abstract class AbstractIncrementalJpsTest(
|
|||||||
p.println("Begin of Lookup Maps")
|
p.println("Begin of Lookup Maps")
|
||||||
p.println()
|
p.println()
|
||||||
|
|
||||||
val lookupStorage = project.dataManager.getStorage(KotlinDataContainerTarget, LookupStorageProvider)
|
val lookupStorage = project.dataManager.getStorage(KotlinDataContainerTarget, JpsLookupStorageProvider)
|
||||||
lookupStorage.forceGC()
|
lookupStorage.forceGC()
|
||||||
p.print(lookupStorage.dump(lookupsDuringTest))
|
p.print(lookupStorage.dump(lookupsDuringTest))
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ import com.intellij.testFramework.UsefulTestCase
|
|||||||
import org.jetbrains.jps.builders.BuildTarget
|
import org.jetbrains.jps.builders.BuildTarget
|
||||||
import org.jetbrains.jps.builders.storage.BuildDataPaths
|
import org.jetbrains.jps.builders.storage.BuildDataPaths
|
||||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||||
import org.jetbrains.kotlin.jps.incremental.CacheVersion
|
import org.jetbrains.kotlin.incremental.CacheVersion
|
||||||
|
import org.jetbrains.kotlin.incremental.storage.BasicMapsOwner
|
||||||
import org.jetbrains.kotlin.jps.incremental.CacheVersionProvider
|
import org.jetbrains.kotlin.jps.incremental.CacheVersionProvider
|
||||||
import org.jetbrains.kotlin.jps.incremental.KOTLIN_CACHE_DIRECTORY_NAME
|
import org.jetbrains.kotlin.incremental.KOTLIN_CACHE_DIRECTORY_NAME
|
||||||
import org.jetbrains.kotlin.jps.incremental.KotlinDataContainerTarget
|
import org.jetbrains.kotlin.jps.incremental.KotlinDataContainerTarget
|
||||||
import org.jetbrains.kotlin.jps.incremental.storage.BasicMapsOwner
|
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import com.google.common.hash.Hashing
|
|||||||
import com.google.common.io.Files
|
import com.google.common.io.Files
|
||||||
import com.google.protobuf.ExtensionRegistry
|
import com.google.protobuf.ExtensionRegistry
|
||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import org.jetbrains.kotlin.jps.incremental.LocalFileKotlinClass
|
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
|
||||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||||
import org.jetbrains.kotlin.serialization.DebugProtoBuf
|
import org.jetbrains.kotlin.serialization.DebugProtoBuf
|
||||||
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
|
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ package org.jetbrains.kotlin.jps.incremental
|
|||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import com.intellij.testFramework.UsefulTestCase
|
import com.intellij.testFramework.UsefulTestCase
|
||||||
import com.intellij.util.SmartList
|
import com.intellij.util.SmartList
|
||||||
import org.jetbrains.kotlin.jps.incremental.storage.ProtoMapValue
|
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
|
||||||
|
import org.jetbrains.kotlin.incremental.difference
|
||||||
|
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
|
||||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
||||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||||
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
|
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
|
||||||
|
|||||||
Reference in New Issue
Block a user