jps-plugin: cleanup 'public', property access syntax
This commit is contained in:
@@ -22,17 +22,17 @@ import com.intellij.openapi.components.ApplicationComponent
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
|
||||
public class BareJpsPluginRegistrar : ApplicationComponent {
|
||||
class BareJpsPluginRegistrar : ApplicationComponent {
|
||||
override fun initComponent() {
|
||||
val mainKotlinPlugin = PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin"))
|
||||
|
||||
if (mainKotlinPlugin != null && mainKotlinPlugin.isEnabled()) {
|
||||
if (mainKotlinPlugin != null && mainKotlinPlugin.isEnabled) {
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
val compileServerPlugin = CompileServerPlugin()
|
||||
compileServerPlugin.setClasspath("jps/kotlin-jps-plugin.jar;kotlin-runtime.jar;kotlin-reflect.jar;kotlin-bare-plugin.jar")
|
||||
compileServerPlugin.setPluginDescriptor(PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin.bare")))
|
||||
compileServerPlugin.classpath = "jps/kotlin-jps-plugin.jar;kotlin-runtime.jar;kotlin-reflect.jar;kotlin-bare-plugin.jar"
|
||||
compileServerPlugin.pluginDescriptor = PluginManager.getPlugin(PluginId.getId("org.jetbrains.kotlin.bare"))
|
||||
|
||||
Extensions.getRootArea()
|
||||
.getExtensionPoint(CompileServerPlugin.EP_NAME)
|
||||
@@ -44,6 +44,6 @@ public class BareJpsPluginRegistrar : ApplicationComponent {
|
||||
}
|
||||
|
||||
override fun getComponentName(): String {
|
||||
return javaClass.getName()
|
||||
return javaClass.name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +44,12 @@ import java.lang.reflect.Modifier
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
public object KotlinCompilerRunner {
|
||||
object KotlinCompilerRunner {
|
||||
private val K2JVM_COMPILER = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
||||
private val K2JS_COMPILER = "org.jetbrains.kotlin.cli.js.K2JSCompiler"
|
||||
private val INTERNAL_ERROR = ExitCode.INTERNAL_ERROR.toString()
|
||||
|
||||
public fun runK2JvmCompiler(
|
||||
fun runK2JvmCompiler(
|
||||
commonArguments: CommonCompilerArguments,
|
||||
k2jvmArguments: K2JVMCompilerArguments,
|
||||
compilerSettings: CompilerSettings,
|
||||
@@ -63,7 +63,7 @@ public object KotlinCompilerRunner {
|
||||
runCompiler(K2JVM_COMPILER, arguments, compilerSettings.additionalArguments, messageCollector, collector, environment)
|
||||
}
|
||||
|
||||
public fun runK2JsCompiler(
|
||||
fun runK2JsCompiler(
|
||||
commonArguments: CommonCompilerArguments,
|
||||
k2jsArguments: K2JSCompilerArguments,
|
||||
compilerSettings: CompilerSettings,
|
||||
@@ -138,7 +138,7 @@ public object KotlinCompilerRunner {
|
||||
|
||||
}
|
||||
|
||||
internal class DaemonConnection(public val daemon: CompileService?, public val sessionId: Int = CompileService.NO_SESSION)
|
||||
internal class DaemonConnection(val daemon: CompileService?, val sessionId: Int = CompileService.NO_SESSION)
|
||||
|
||||
internal object getDaemonConnection {
|
||||
private @Volatile var connection: DaemonConnection? = null
|
||||
|
||||
@@ -37,10 +37,10 @@ object JpsJsModuleUtils {
|
||||
}
|
||||
|
||||
fun getLibraryFiles(target: ModuleBuildTarget, result: MutableList<String>) {
|
||||
val libraries = JpsUtils.getAllDependencies(target).getLibraries()
|
||||
val libraries = JpsUtils.getAllDependencies(target).libraries
|
||||
for (library in libraries) {
|
||||
for (root in library.getRoots(JpsOrderRootType.COMPILED)) {
|
||||
val path = JpsPathUtil.urlToPath(root.getUrl())
|
||||
val path = JpsPathUtil.urlToPath(root.url)
|
||||
// ignore files, added only for IDE support (stubs and indexes)
|
||||
if (!path.startsWith(KotlinJavascriptMetadataUtils.VFS_PROTOCOL + "://")) {
|
||||
result.add(path)
|
||||
@@ -52,12 +52,12 @@ object JpsJsModuleUtils {
|
||||
fun getDependencyModulesAndSources(target: ModuleBuildTarget, result: MutableList<String>) {
|
||||
JpsUtils.getAllDependencies(target).processModules(object : Consumer<JpsModule> {
|
||||
override fun consume(module: JpsModule) {
|
||||
if (module == target.getModule() || module.getModuleType() != JpsJavaModuleType.INSTANCE) return
|
||||
if (module == target.module || module.moduleType != JpsJavaModuleType.INSTANCE) return
|
||||
|
||||
val moduleBuildTarget = ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION)
|
||||
val outputDir = KotlinBuilderModuleScriptGenerator.getOutputDirSafe(moduleBuildTarget)
|
||||
val metaInfoFile = getOutputMetaFile(outputDir, module.getName())
|
||||
result.add(metaInfoFile.getAbsolutePath())
|
||||
val metaInfoFile = getOutputMetaFile(outputDir, module.name)
|
||||
result.add(metaInfoFile.absolutePath)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -69,12 +69,11 @@ import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
companion object {
|
||||
@JvmField
|
||||
public val KOTLIN_BUILDER_NAME: String = "Kotlin Builder"
|
||||
@JvmField val KOTLIN_BUILDER_NAME: String = "Kotlin Builder"
|
||||
|
||||
public val LOOKUP_TRACKER: JpsElementChildRoleBase<JpsSimpleElement<out LookupTracker>> = JpsElementChildRoleBase.create("lookup tracker")
|
||||
val LOOKUP_TRACKER: JpsElementChildRoleBase<JpsSimpleElement<out LookupTracker>> = JpsElementChildRoleBase.create("lookup tracker")
|
||||
val LOG = Logger.getInstance("#org.jetbrains.kotlin.jps.build.KotlinBuilder")
|
||||
}
|
||||
|
||||
@@ -438,7 +437,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
|
||||
messageCollector.report(
|
||||
INFO,
|
||||
"Plugin loaded: ${argumentProvider.javaClass.getSimpleName()}",
|
||||
"Plugin loaded: ${argumentProvider.javaClass.simpleName}",
|
||||
CompilerMessageLocation.NO_LOCATION
|
||||
)
|
||||
}
|
||||
@@ -455,7 +454,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
.register(IncrementalCompilationComponents::class.java, IncrementalCompilationComponentsImpl(incrementalCaches, lookupTracker))
|
||||
.register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus {
|
||||
override fun checkCanceled() {
|
||||
if (context.getCancelStatus().isCanceled()) throw CompilationCanceledException()
|
||||
if (context.cancelStatus.isCanceled) throw CompilationCanceledException()
|
||||
}
|
||||
})
|
||||
.build()
|
||||
@@ -481,8 +480,8 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
): List<GeneratedFile> {
|
||||
// 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>()
|
||||
if (chunk.getTargets().size > 1) {
|
||||
for (target in chunk.getTargets()) {
|
||||
if (chunk.targets.size > 1) {
|
||||
for (target in chunk.targets) {
|
||||
for (file in KotlinSourceFileCollector.getAllKotlinSourceFiles(target)) {
|
||||
sourceToTarget.put(file, target)
|
||||
}
|
||||
@@ -492,7 +491,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
val result = ArrayList<GeneratedFile>()
|
||||
|
||||
val representativeTarget = chunk.representativeTarget()
|
||||
for (outputItem in outputItemCollector.getOutputs()) {
|
||||
for (outputItem in outputItemCollector.outputs) {
|
||||
val sourceFiles = outputItem.sourceFiles
|
||||
val outputFile = outputItem.outputFile
|
||||
val target =
|
||||
@@ -500,7 +499,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
chunk.targets.filter { it.outputDir?.let { outputFile.startsWith(it) } ?: false }.singleOrNull() ?:
|
||||
representativeTarget
|
||||
|
||||
if (outputFile.getName().endsWith(".class")) {
|
||||
if (outputFile.name.endsWith(".class")) {
|
||||
result.add(GeneratedJvmClass(target, sourceFiles, outputFile))
|
||||
}
|
||||
else {
|
||||
@@ -518,15 +517,15 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
filesToCompile: MultiMap<ModuleBuildTarget, File>,
|
||||
generatedClasses: List<GeneratedJvmClass>
|
||||
) {
|
||||
val previousMappings = context.getProjectDescriptor().dataManager.getMappings()
|
||||
val previousMappings = context.projectDescriptor.dataManager.mappings
|
||||
val delta = previousMappings.createDelta()
|
||||
val callback = delta.getCallback()
|
||||
val callback = delta.callback
|
||||
|
||||
for (generatedClass in generatedClasses) {
|
||||
callback.associate(
|
||||
FileUtil.toSystemIndependentName(generatedClass.outputFile.getAbsolutePath()),
|
||||
generatedClass.sourceFiles.map { FileUtil.toSystemIndependentName(it.getAbsolutePath()) },
|
||||
ClassReader(generatedClass.outputClass.getFileContents())
|
||||
FileUtil.toSystemIndependentName(generatedClass.outputFile.absolutePath),
|
||||
generatedClass.sourceFiles.map { FileUtil.toSystemIndependentName(it.absolutePath) },
|
||||
ClassReader(generatedClass.outputClass.fileContents)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -537,7 +536,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
|
||||
private fun registerOutputItems(outputConsumer: ModuleLevelBuilder.OutputConsumer, generatedFiles: List<GeneratedFile>) {
|
||||
for (generatedFile in generatedFiles) {
|
||||
outputConsumer.registerOutputFile(generatedFile.target, generatedFile.outputFile, generatedFile.sourceFiles.map { it.getPath() })
|
||||
outputConsumer.registerOutputFile(generatedFile.target, generatedFile.outputFile, generatedFile.sourceFiles.map { it.path })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,13 +607,13 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
val outputItemCollector = OutputItemsCollectorImpl()
|
||||
|
||||
val representativeTarget = chunk.representativeTarget()
|
||||
if (chunk.getModules().size > 1) {
|
||||
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
|
||||
messageCollector.report(
|
||||
WARNING,
|
||||
"Circular dependencies are not supported. The following JS modules depend on each other: "
|
||||
+ chunk.getModules().map { it.getName() }.joinToString(", ") + ". "
|
||||
+ chunk.modules.map { it.name }.joinToString(", ") + ". "
|
||||
+ "Kotlin is not compiled for these modules",
|
||||
CompilerMessageLocation.NO_LOCATION
|
||||
)
|
||||
@@ -628,7 +627,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
|
||||
val outputDir = KotlinBuilderModuleScriptGenerator.getOutputDirSafe(representativeTarget)
|
||||
|
||||
val moduleName = representativeTarget.getModule().getName()
|
||||
val moduleName = representativeTarget.module.name
|
||||
val outputFile = JpsJsModuleUtils.getOutputFile(outputDir, moduleName)
|
||||
val libraryFiles = JpsJsModuleUtils.getLibraryFilesAndDependencies(representativeTarget)
|
||||
val compilerSettings = JpsKotlinCompilerSettings.getCompilerSettings(project)
|
||||
@@ -643,7 +642,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
val outputDir = KotlinBuilderModuleScriptGenerator.getOutputDirSafe(representativeTarget)
|
||||
val compilerSettings = JpsKotlinCompilerSettings.getCompilerSettings(project)
|
||||
if (compilerSettings.copyJsLibraryFiles) {
|
||||
val outputLibraryRuntimeDirectory = File(outputDir, compilerSettings.outputDirectoryForJsLibraryFiles).getAbsolutePath()
|
||||
val outputLibraryRuntimeDirectory = File(outputDir, compilerSettings.outputDirectoryForJsLibraryFiles).absolutePath
|
||||
val libraryFilesToCopy = arrayListOf<String>()
|
||||
JpsJsModuleUtils.getLibraryFiles(representativeTarget, libraryFilesToCopy)
|
||||
LibraryUtils.copyJsFilesFromLibraries(libraryFilesToCopy, outputLibraryRuntimeDirectory)
|
||||
@@ -661,11 +660,11 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
): OutputItemsCollectorImpl? {
|
||||
val outputItemCollector = OutputItemsCollectorImpl()
|
||||
|
||||
if (chunk.getModules().size > 1) {
|
||||
if (chunk.modules.size > 1) {
|
||||
messageCollector.report(
|
||||
WARNING,
|
||||
"Circular dependencies are only partially supported. The following modules depend on each other: "
|
||||
+ chunk.getModules().map { it.getName() }.joinToString(", ") + ". "
|
||||
+ chunk.modules.map { it.name }.joinToString(", ") + ". "
|
||||
+ "Kotlin will compile them, but some strange effect may happen",
|
||||
CompilerMessageLocation.NO_LOCATION
|
||||
)
|
||||
@@ -676,7 +675,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
val processedTargetsWithRemoved = getProcessedTargetsWithRemovedFilesContainer(context)
|
||||
|
||||
var totalRemovedFiles = 0
|
||||
for (target in chunk.getTargets()) {
|
||||
for (target in chunk.targets) {
|
||||
val removedFilesInTarget = KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, target)
|
||||
if (!removedFilesInTarget.isEmpty()) {
|
||||
if (processedTargetsWithRemoved.add(target)) {
|
||||
@@ -692,7 +691,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
return null
|
||||
}
|
||||
|
||||
val project = context.getProjectDescriptor().getProject()
|
||||
val project = context.projectDescriptor.project
|
||||
val k2JvmArguments = JpsKotlinCompilerSettings.getK2JvmCompilerArguments(project)
|
||||
val compilerSettings = JpsKotlinCompilerSettings.getCompilerSettings(project)
|
||||
|
||||
@@ -706,7 +705,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
return outputItemCollector
|
||||
}
|
||||
|
||||
public class MessageCollectorAdapter(private val context: CompileContext) : MessageCollector {
|
||||
class MessageCollectorAdapter(private val context: CompileContext) : MessageCollector {
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) {
|
||||
var prefix = ""
|
||||
@@ -832,7 +831,7 @@ private fun hasKotlinDirtyOrRemovedFiles(
|
||||
return chunk.targets.any { KotlinSourceFileCollector.getRemovedKotlinFiles(dirtyFilesHolder, it).isNotEmpty() }
|
||||
}
|
||||
|
||||
public open class GeneratedFile internal constructor(
|
||||
open class GeneratedFile internal constructor(
|
||||
val target: ModuleBuildTarget,
|
||||
val sourceFiles: Collection<File>,
|
||||
val outputFile: File
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.jps.build
|
||||
import org.jetbrains.jps.incremental.CompileContext
|
||||
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
||||
|
||||
public interface KotlinJpsCompilerArgumentsProvider {
|
||||
public fun getExtraArguments(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String>
|
||||
public fun getClasspath(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String>
|
||||
interface KotlinJpsCompilerArgumentsProvider {
|
||||
fun getExtraArguments(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String>
|
||||
fun getClasspath(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String>
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class TeamcityStatisticsLogger {
|
||||
|
||||
private fun printPerChunkStatistics(moduleChunk: ModuleChunk, timeToCompileNs: Long) {
|
||||
printStatisticMessage(
|
||||
"${KotlinBuilder.KOTLIN_BUILDER_NAME} for ${moduleChunk.getPresentableShortName()} compilation time, ms",
|
||||
"${KotlinBuilder.KOTLIN_BUILDER_NAME} for ${moduleChunk.presentableShortName} compilation time, ms",
|
||||
timeToCompileNs.nanosToMillis().toString()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ import java.util.*
|
||||
|
||||
val KOTLIN_CACHE_DIRECTORY_NAME = "kotlin"
|
||||
|
||||
public class IncrementalCacheImpl(
|
||||
class IncrementalCacheImpl(
|
||||
private val target: ModuleBuildTarget,
|
||||
paths: BuildDataPaths
|
||||
) : BasicMapsOwner(), IncrementalCache {
|
||||
@@ -112,11 +112,11 @@ public class IncrementalCacheImpl(
|
||||
inlinedTo.add(fromPath, jvmSignature, toPath)
|
||||
}
|
||||
|
||||
public fun addDependentCache(cache: IncrementalCacheImpl) {
|
||||
fun addDependentCache(cache: IncrementalCacheImpl) {
|
||||
dependents.add(cache)
|
||||
}
|
||||
|
||||
public fun markOutputClassesDirty(removedAndCompiledSources: List<File>) {
|
||||
fun markOutputClassesDirty(removedAndCompiledSources: List<File>) {
|
||||
for (sourceFile in removedAndCompiledSources) {
|
||||
val classes = sourceToClassesMap[sourceFile]
|
||||
classes.forEach {
|
||||
@@ -127,7 +127,7 @@ public class IncrementalCacheImpl(
|
||||
}
|
||||
}
|
||||
|
||||
public fun getFilesToReinline(): Collection<File> {
|
||||
fun getFilesToReinline(): Collection<File> {
|
||||
val result = THashSet(FileUtil.PATH_HASHING_STRATEGY)
|
||||
|
||||
for ((className, functions) in dirtyInlineFunctionsMap.getEntries()) {
|
||||
@@ -142,7 +142,7 @@ public class IncrementalCacheImpl(
|
||||
return result.map { File(it) }
|
||||
}
|
||||
|
||||
public fun cleanDirtyInlineFunctions() {
|
||||
fun cleanDirtyInlineFunctions() {
|
||||
dirtyInlineFunctionsMap.clean()
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class IncrementalCacheImpl(
|
||||
return toSystemIndependentName(File(outputDir, "$internalClassName.class").canonicalPath)
|
||||
}
|
||||
|
||||
public fun saveModuleMappingToCache(sourceFiles: Collection<File>, file: File): CompilationResult {
|
||||
fun saveModuleMappingToCache(sourceFiles: Collection<File>, file: File): CompilationResult {
|
||||
val jvmClassName = JvmClassName.byInternalName(MODULE_MAPPING_FILE_NAME)
|
||||
protoMap.process(jvmClassName, file.readBytes(), emptyArray<String>(), isPackage = false, checkChangesIsOpenPart = false)
|
||||
dirtyOutputClassesMap.notDirty(MODULE_MAPPING_FILE_NAME)
|
||||
@@ -158,7 +158,7 @@ public class IncrementalCacheImpl(
|
||||
return CompilationResult.NO_CHANGES
|
||||
}
|
||||
|
||||
public fun saveFileToCache(generatedClass: GeneratedJvmClass): CompilationResult {
|
||||
fun saveFileToCache(generatedClass: GeneratedJvmClass): CompilationResult {
|
||||
val sourceFiles: Collection<File> = generatedClass.sourceFiles
|
||||
val kotlinClass: LocalFileKotlinClass = generatedClass.outputClass
|
||||
val className = kotlinClass.className
|
||||
@@ -216,7 +216,7 @@ public class IncrementalCacheImpl(
|
||||
KotlinBuilder.LOG.debug("$className is changed: $this")
|
||||
}
|
||||
|
||||
public fun clearCacheForRemovedClasses(): CompilationResult {
|
||||
fun clearCacheForRemovedClasses(): CompilationResult {
|
||||
|
||||
fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
|
||||
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
|
||||
@@ -324,26 +324,26 @@ public class IncrementalCacheImpl(
|
||||
return protoMap[JvmClassName.byInternalName(MODULE_MAPPING_FILE_NAME)]?.bytes
|
||||
}
|
||||
|
||||
public override fun clean() {
|
||||
override fun clean() {
|
||||
super.clean()
|
||||
cacheVersionProvider.normalVersion(target).clean()
|
||||
cacheVersionProvider.experimentalVersion(target).clean()
|
||||
}
|
||||
|
||||
public fun cleanExperimental() {
|
||||
fun cleanExperimental() {
|
||||
cacheVersionProvider.experimentalVersion(target).clean()
|
||||
experimentalMaps.forEach { it.clean() }
|
||||
}
|
||||
|
||||
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
|
||||
|
||||
public fun process(kotlinClass: LocalFileKotlinClass, isPackage: Boolean): CompilationResult {
|
||||
fun process(kotlinClass: LocalFileKotlinClass, isPackage: Boolean): CompilationResult {
|
||||
val header = kotlinClass.classHeader
|
||||
val bytes = BitEncoding.decodeBytes(header.annotationData!!)
|
||||
return put(kotlinClass.className, bytes, header.strings!!, isPackage, checkChangesIsOpenPart = true)
|
||||
}
|
||||
|
||||
public fun process(className: JvmClassName, data: ByteArray, strings: Array<String>, isPackage: Boolean, checkChangesIsOpenPart: Boolean): CompilationResult {
|
||||
fun process(className: JvmClassName, data: ByteArray, strings: Array<String>, isPackage: Boolean, checkChangesIsOpenPart: Boolean): CompilationResult {
|
||||
return put(className, data, strings, isPackage, checkChangesIsOpenPart)
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ public class IncrementalCacheImpl(
|
||||
operator fun get(className: JvmClassName): ProtoMapValue? =
|
||||
storage[className.internalName]
|
||||
|
||||
public fun remove(className: JvmClassName) {
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
|
||||
@@ -415,12 +415,12 @@ public class IncrementalCacheImpl(
|
||||
operator fun contains(className: JvmClassName): Boolean =
|
||||
className.internalName in storage
|
||||
|
||||
public fun process(kotlinClass: LocalFileKotlinClass): CompilationResult {
|
||||
fun process(kotlinClass: LocalFileKotlinClass): CompilationResult {
|
||||
return put(kotlinClass.className, getConstantsMap(kotlinClass.fileContents))
|
||||
}
|
||||
|
||||
private fun put(className: JvmClassName, constantsMap: Map<String, Any>?): CompilationResult {
|
||||
val key = className.getInternalName()
|
||||
val key = className.internalName
|
||||
|
||||
val oldMap = storage[key]
|
||||
if (oldMap == constantsMap) return CompilationResult.NO_CHANGES
|
||||
@@ -435,7 +435,7 @@ public class IncrementalCacheImpl(
|
||||
return CompilationResult(constantsChanged = true)
|
||||
}
|
||||
|
||||
public fun remove(className: JvmClassName) {
|
||||
fun remove(className: JvmClassName) {
|
||||
put(className, null)
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ public class IncrementalCacheImpl(
|
||||
return result
|
||||
}
|
||||
|
||||
public fun process(kotlinClass: LocalFileKotlinClass, isPackage: Boolean): CompilationResult {
|
||||
fun process(kotlinClass: LocalFileKotlinClass, isPackage: Boolean): CompilationResult {
|
||||
return put(kotlinClass.className, getInlineFunctionsMap(kotlinClass.fileContents), isPackage)
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ public class IncrementalCacheImpl(
|
||||
changes = changes)
|
||||
}
|
||||
|
||||
public fun remove(className: JvmClassName) {
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
|
||||
@@ -526,28 +526,28 @@ public class IncrementalCacheImpl(
|
||||
}
|
||||
|
||||
private inner class PackagePartMap(storageFile: File) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
|
||||
public fun addPackagePart(className: JvmClassName) {
|
||||
fun addPackagePart(className: JvmClassName) {
|
||||
storage[className.internalName] = true
|
||||
}
|
||||
|
||||
public fun remove(className: JvmClassName) {
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
|
||||
public fun isPackagePart(className: JvmClassName): Boolean =
|
||||
fun isPackagePart(className: JvmClassName): Boolean =
|
||||
className.internalName in storage
|
||||
|
||||
override fun dumpValue(value: Boolean) = ""
|
||||
}
|
||||
|
||||
private inner class MultifileClassFacadeMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
|
||||
public fun add(facadeName: JvmClassName, partNames: Collection<String>) {
|
||||
fun add(facadeName: JvmClassName, partNames: Collection<String>) {
|
||||
storage[facadeName.internalName] = partNames
|
||||
}
|
||||
|
||||
public fun getMultifileClassParts(facadeName: String): Collection<String>? = storage[facadeName]
|
||||
fun getMultifileClassParts(facadeName: String): Collection<String>? = storage[facadeName]
|
||||
|
||||
public fun remove(className: JvmClassName) {
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
|
||||
@@ -555,15 +555,15 @@ public class IncrementalCacheImpl(
|
||||
}
|
||||
|
||||
private inner class MultifileClassPartMap(storageFile: File) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
|
||||
public fun add(partName: String, facadeName: String) {
|
||||
fun add(partName: String, facadeName: String) {
|
||||
storage[partName] = facadeName
|
||||
}
|
||||
|
||||
public fun getFacadeName(partName: String): String? {
|
||||
fun getFacadeName(partName: String): String? {
|
||||
return storage.get(partName)
|
||||
}
|
||||
|
||||
public fun remove(className: JvmClassName) {
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
|
||||
@@ -571,15 +571,15 @@ public class IncrementalCacheImpl(
|
||||
}
|
||||
|
||||
private inner class SourceToClassesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor.INSTANCE, StringCollectionExternalizer) {
|
||||
public fun clearOutputsForSource(sourceFile: File) {
|
||||
fun clearOutputsForSource(sourceFile: File) {
|
||||
remove(sourceFile.absolutePath)
|
||||
}
|
||||
|
||||
public fun add(sourceFile: File, className: JvmClassName) {
|
||||
fun add(sourceFile: File, className: JvmClassName) {
|
||||
storage.append(sourceFile.absolutePath, { out -> IOUtil.writeUTF(out, className.internalName) })
|
||||
}
|
||||
|
||||
public operator fun get(sourceFile: File): Collection<JvmClassName> =
|
||||
operator fun get(sourceFile: File): Collection<JvmClassName> =
|
||||
storage[sourceFile.absolutePath].orEmpty().map { JvmClassName.byInternalName(it) }
|
||||
|
||||
override fun dumpValue(value: Collection<String>) = value.dumpCollection()
|
||||
@@ -634,28 +634,28 @@ public class IncrementalCacheImpl(
|
||||
}
|
||||
|
||||
private inner class DirtyOutputClassesMap(storageFile: File) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
|
||||
public fun markDirty(className: String) {
|
||||
fun markDirty(className: String) {
|
||||
storage[className] = true
|
||||
}
|
||||
|
||||
public fun notDirty(className: String) {
|
||||
fun notDirty(className: String) {
|
||||
storage.remove(className)
|
||||
}
|
||||
|
||||
public fun getDirtyOutputClasses(): Collection<String> =
|
||||
fun getDirtyOutputClasses(): Collection<String> =
|
||||
storage.keys
|
||||
|
||||
public fun isDirty(className: String): Boolean =
|
||||
fun isDirty(className: String): Boolean =
|
||||
storage.contains(className)
|
||||
|
||||
override fun dumpValue(value: Boolean) = ""
|
||||
}
|
||||
|
||||
private inner class DirtyInlineFunctionsMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
|
||||
public fun getEntries(): Map<JvmClassName, Collection<String>> =
|
||||
fun getEntries(): Map<JvmClassName, Collection<String>> =
|
||||
storage.keys.toMapBy(JvmClassName::byInternalName) { storage[it]!! }
|
||||
|
||||
public fun put(className: JvmClassName, changedFunctions: List<String>) {
|
||||
fun put(className: JvmClassName, changedFunctions: List<String>) {
|
||||
storage[className.internalName] = changedFunctions
|
||||
}
|
||||
|
||||
@@ -672,14 +672,14 @@ public class IncrementalCacheImpl(
|
||||
* * target files - collection of files inlineFunction has been inlined to
|
||||
*/
|
||||
private inner class InlineFunctionsFilesMap(storageFile: File) : BasicMap<PathFunctionPair, Collection<String>>(storageFile, PathFunctionPairKeyDescriptor, PathCollectionExternalizer) {
|
||||
public fun add(sourcePath: String, jvmSignature: String, targetPath: String) {
|
||||
fun add(sourcePath: String, jvmSignature: String, targetPath: String) {
|
||||
val key = PathFunctionPair(sourcePath, jvmSignature)
|
||||
storage.append(key) { out ->
|
||||
IOUtil.writeUTF(out, targetPath)
|
||||
}
|
||||
}
|
||||
|
||||
public operator fun get(sourcePath: String, jvmSignature: String): Collection<String> {
|
||||
operator fun get(sourcePath: String, jvmSignature: String): Collection<String> {
|
||||
val key = PathFunctionPair(sourcePath, jvmSignature)
|
||||
return storage[key] ?: emptySet()
|
||||
}
|
||||
@@ -717,7 +717,7 @@ data class CompilationResult(
|
||||
val changes: Sequence<ChangeInfo> = emptySequence()
|
||||
) {
|
||||
companion object {
|
||||
public val NO_CHANGES: CompilationResult = CompilationResult()
|
||||
val NO_CHANGES: CompilationResult = CompilationResult()
|
||||
}
|
||||
|
||||
operator fun plus(other: CompilationResult): CompilationResult =
|
||||
@@ -772,6 +772,5 @@ private fun <K : Comparable<K>, V> Map<K, V>.dumpMap(dumpValue: (V)->String): St
|
||||
append("}")
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public fun <T : Comparable<T>> Collection<T>.dumpCollection(): String =
|
||||
@TestOnly fun <T : Comparable<T>> Collection<T>.dumpCollection(): String =
|
||||
"[${sorted().joinToString(", ", transform = Any::toString)}]"
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||
import org.jetbrains.kotlin.modules.TargetId
|
||||
|
||||
public class IncrementalCompilationComponentsImpl(
|
||||
class IncrementalCompilationComponentsImpl(
|
||||
caches: Map<ModuleBuildTarget, IncrementalCache>,
|
||||
private val lookupTracker: LookupTracker
|
||||
): IncrementalCompilationComponents {
|
||||
|
||||
@@ -40,7 +40,7 @@ class LocalFileKotlinClass private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
public val className: JvmClassName by lazy { JvmClassName.byClassId(classId) }
|
||||
val className: JvmClassName by lazy { JvmClassName.byClassId(classId) }
|
||||
|
||||
override fun getLocation(): String = file.absolutePath
|
||||
|
||||
|
||||
@@ -65,14 +65,14 @@ class LookupStorage(private val targetDataDir: File) : BasicMapsOwner() {
|
||||
}
|
||||
}
|
||||
|
||||
public fun add(lookupSymbol: LookupSymbol, containingPaths: Collection<String>) {
|
||||
fun add(lookupSymbol: LookupSymbol, containingPaths: Collection<String>) {
|
||||
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
|
||||
val fileIds = containingPaths.map { addFileIfNeeded(File(it)) }.toHashSet()
|
||||
fileIds.addAll(lookupMap[key] ?: emptySet())
|
||||
lookupMap[key] = fileIds
|
||||
}
|
||||
|
||||
public fun removeLookupsFrom(file: File) {
|
||||
fun removeLookupsFrom(file: File) {
|
||||
val id = fileToId[file] ?: return
|
||||
idToFile.remove(id)
|
||||
fileToId.remove(file)
|
||||
@@ -149,14 +149,12 @@ class LookupStorage(private val targetDataDir: File) : BasicMapsOwner() {
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public fun forceGC() {
|
||||
@TestOnly fun forceGC() {
|
||||
removeGarbageIfNeeded(force = true)
|
||||
flush(false)
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public fun dump(lookupSymbols: Set<LookupSymbol>): String {
|
||||
@TestOnly fun dump(lookupSymbols: Set<LookupSymbol>): String {
|
||||
flush(false)
|
||||
|
||||
val sb = StringBuilder()
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.util.*
|
||||
|
||||
/** This file is generated by org.jetbrains.kotlin.generators.protobuf.GenerateProtoBufCompare. DO NOT MODIFY MANUALLY */
|
||||
|
||||
open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, public val newNameResolver: NameResolver) {
|
||||
open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameResolver: NameResolver) {
|
||||
private val strings = Interner<String>()
|
||||
public val oldStringIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
public val newStringIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
public val oldClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
public val newClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
val oldStringIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
val newStringIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
val oldClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
val newClassIdIndexesMap: MutableMap<Int, Int> = hashMapOf()
|
||||
|
||||
private val classIds = Interner<ClassId>()
|
||||
|
||||
@@ -46,13 +46,13 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
|
||||
return true
|
||||
}
|
||||
public enum class ProtoBufPackageKind {
|
||||
enum class ProtoBufPackageKind {
|
||||
FUNCTION_LIST,
|
||||
PROPERTY_LIST,
|
||||
TYPE_TABLE
|
||||
}
|
||||
|
||||
public fun difference(old: ProtoBuf.Package, new: ProtoBuf.Package): EnumSet<ProtoBufPackageKind> {
|
||||
fun difference(old: ProtoBuf.Package, new: ProtoBuf.Package): EnumSet<ProtoBufPackageKind> {
|
||||
val result = EnumSet.noneOf(ProtoBufPackageKind::class.java)
|
||||
|
||||
if (!checkEqualsPackageFunction(old, new)) result.add(ProtoBufPackageKind.FUNCTION_LIST)
|
||||
@@ -109,7 +109,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
|
||||
return true
|
||||
}
|
||||
public enum class ProtoBufClassKind {
|
||||
enum class ProtoBufClassKind {
|
||||
FLAGS,
|
||||
FQ_NAME,
|
||||
COMPANION_OBJECT_NAME,
|
||||
@@ -125,7 +125,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
CLASS_ANNOTATION_LIST
|
||||
}
|
||||
|
||||
public fun difference(old: ProtoBuf.Class, new: ProtoBuf.Class): EnumSet<ProtoBufClassKind> {
|
||||
fun difference(old: ProtoBuf.Class, new: ProtoBuf.Class): EnumSet<ProtoBufClassKind> {
|
||||
val result = EnumSet.noneOf(ProtoBufClassKind::class.java)
|
||||
|
||||
if (old.hasFlags() != new.hasFlags()) result.add(ProtoBufClassKind.FLAGS)
|
||||
@@ -758,10 +758,10 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
return true
|
||||
}
|
||||
|
||||
public fun oldGetIndexOfString(index: Int): Int = getIndexOfString(index, oldStringIndexesMap, oldNameResolver)
|
||||
public fun newGetIndexOfString(index: Int): Int = getIndexOfString(index, newStringIndexesMap, newNameResolver)
|
||||
fun oldGetIndexOfString(index: Int): Int = getIndexOfString(index, oldStringIndexesMap, oldNameResolver)
|
||||
fun newGetIndexOfString(index: Int): Int = getIndexOfString(index, newStringIndexesMap, newNameResolver)
|
||||
|
||||
public fun getIndexOfString(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {
|
||||
fun getIndexOfString(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {
|
||||
map[index]?.let { return it }
|
||||
|
||||
val result = strings.intern(nameResolver.getString(index))
|
||||
@@ -769,10 +769,10 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
return result
|
||||
}
|
||||
|
||||
public fun oldGetIndexOfClassId(index: Int): Int = getIndexOfClassId(index, oldClassIdIndexesMap, oldNameResolver)
|
||||
public fun newGetIndexOfClassId(index: Int): Int = getIndexOfClassId(index, newClassIdIndexesMap, newNameResolver)
|
||||
fun oldGetIndexOfClassId(index: Int): Int = getIndexOfClassId(index, oldClassIdIndexesMap, oldNameResolver)
|
||||
fun newGetIndexOfClassId(index: Int): Int = getIndexOfClassId(index, newClassIdIndexesMap, newNameResolver)
|
||||
|
||||
public fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {
|
||||
fun getIndexOfClassId(index: Int, map: MutableMap<Int, Int>, nameResolver: NameResolver): Int {
|
||||
map[index]?.let { return it }
|
||||
|
||||
val result = classIds.intern(nameResolver.getClassId(index))
|
||||
@@ -789,7 +789,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
}
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
for(i in 0..functionCount - 1) {
|
||||
@@ -807,7 +807,7 @@ public fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes:
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasFlags()) {
|
||||
@@ -863,7 +863,7 @@ public fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasFlags()) {
|
||||
@@ -907,7 +907,7 @@ public fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasFlags()) {
|
||||
@@ -955,7 +955,7 @@ public fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
for(i in 0..typeCount - 1) {
|
||||
@@ -969,7 +969,7 @@ public fun ProtoBuf.TypeTable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexe
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
hashCode = 31 * hashCode + id
|
||||
@@ -999,7 +999,7 @@ public fun ProtoBuf.TypeParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIn
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
for(i in 0..argumentCount - 1) {
|
||||
@@ -1053,7 +1053,7 @@ public fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasFlags()) {
|
||||
@@ -1071,7 +1071,7 @@ public fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameInde
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasName()) {
|
||||
@@ -1081,7 +1081,7 @@ public fun ProtoBuf.EnumEntry.hashCode(stringIndexes: (Int) -> Int, fqNameIndexe
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
hashCode = 31 * hashCode + fqNameIndexes(id)
|
||||
@@ -1093,7 +1093,7 @@ public fun ProtoBuf.Annotation.hashCode(stringIndexes: (Int) -> Int, fqNameIndex
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasFlags()) {
|
||||
@@ -1121,7 +1121,7 @@ public fun ProtoBuf.ValueParameter.hashCode(stringIndexes: (Int) -> Int, fqNameI
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasName()) {
|
||||
@@ -1135,7 +1135,7 @@ public fun JvmProtoBuf.JvmMethodSignature.hashCode(stringIndexes: (Int) -> Int,
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun JvmProtoBuf.JvmPropertySignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun JvmProtoBuf.JvmPropertySignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasField()) {
|
||||
@@ -1157,7 +1157,7 @@ public fun JvmProtoBuf.JvmPropertySignature.hashCode(stringIndexes: (Int) -> Int
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasProjection()) {
|
||||
@@ -1175,7 +1175,7 @@ public fun ProtoBuf.Type.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIn
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Annotation.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Annotation.Argument.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
hashCode = 31 * hashCode + stringIndexes(nameId)
|
||||
@@ -1185,7 +1185,7 @@ public fun ProtoBuf.Annotation.Argument.hashCode(stringIndexes: (Int) -> Int, fq
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasName()) {
|
||||
@@ -1199,7 +1199,7 @@ public fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, f
|
||||
return hashCode
|
||||
}
|
||||
|
||||
public fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||
var hashCode = 1
|
||||
|
||||
if (hasType()) {
|
||||
|
||||
@@ -29,13 +29,13 @@ import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||
import org.jetbrains.kotlin.utils.HashSetUtil
|
||||
import java.util.*
|
||||
|
||||
public sealed class DifferenceKind() {
|
||||
public object NONE: DifferenceKind()
|
||||
public object CLASS_SIGNATURE: DifferenceKind()
|
||||
public class MEMBERS(val names: Collection<String>): DifferenceKind()
|
||||
sealed class DifferenceKind() {
|
||||
object NONE: DifferenceKind()
|
||||
object CLASS_SIGNATURE: DifferenceKind()
|
||||
class MEMBERS(val names: Collection<String>): DifferenceKind()
|
||||
}
|
||||
|
||||
public fun difference(oldData: ProtoMapValue, newData: ProtoMapValue): DifferenceKind {
|
||||
fun difference(oldData: ProtoMapValue, newData: ProtoMapValue): DifferenceKind {
|
||||
if (oldData.isPackageFacade != newData.isPackageFacade) return DifferenceKind.CLASS_SIGNATURE
|
||||
|
||||
val differenceObject =
|
||||
|
||||
@@ -72,7 +72,7 @@ internal abstract class BasicStringMap<V>(
|
||||
keyDescriptor: KeyDescriptor<String>,
|
||||
valueExternalizer: DataExternalizer<V>
|
||||
) : BasicMap<String, V>(storageFile, keyDescriptor, valueExternalizer) {
|
||||
public constructor(
|
||||
constructor(
|
||||
storageFile: File,
|
||||
valueExternalizer: DataExternalizer<V>
|
||||
) : this(storageFile, EnumeratorStringDescriptor.INSTANCE, valueExternalizer)
|
||||
|
||||
@@ -43,6 +43,5 @@ open class BasicMapsOwner : StorageOwner {
|
||||
maps.forEach { it.flush(memoryCachesOnly) }
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public fun dump(): String = maps.map { it.dump() }.joinToString("\n\n")
|
||||
@TestOnly fun dump(): String = maps.map { it.dump() }.joinToString("\n\n")
|
||||
}
|
||||
@@ -24,15 +24,15 @@ internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescri
|
||||
|
||||
override fun dumpValue(value: Int): String = value.toString()
|
||||
|
||||
public operator fun get(file: File): Int? = storage[file]
|
||||
operator fun get(file: File): Int? = storage[file]
|
||||
|
||||
public operator fun set(file: File, id: Int) {
|
||||
operator fun set(file: File, id: Int) {
|
||||
storage[file] = id
|
||||
}
|
||||
|
||||
public fun remove(file: File) {
|
||||
fun remove(file: File) {
|
||||
storage.remove(file)
|
||||
}
|
||||
|
||||
public fun toMap(): Map<File, Int> = storage.keys.keysToMap { storage[it]!! }
|
||||
fun toMap(): Map<File, Int> = storage.keys.keysToMap { storage[it]!! }
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ internal class IdToFileMap(file: File) : BasicMap<Int, File>(file, ExternalInteg
|
||||
|
||||
override fun dumpValue(value: File): String = value.toString()
|
||||
|
||||
public operator fun get(id: Int): File? = storage[id]
|
||||
operator fun get(id: Int): File? = storage[id]
|
||||
|
||||
public operator fun contains(id: Int): Boolean = id in storage
|
||||
operator fun contains(id: Int): Boolean = id in storage
|
||||
|
||||
public operator fun set(id: Int, file: File) {
|
||||
operator fun set(id: Int, file: File) {
|
||||
storage[id] = file
|
||||
}
|
||||
|
||||
public fun remove(id: Int) {
|
||||
fun remove(id: Int) {
|
||||
storage.remove(id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,20 +23,20 @@ internal class LookupMap(storage: File) : BasicMap<LookupSymbolKey, Collection<I
|
||||
|
||||
override fun dumpValue(value: Collection<Int>): String = value.toString()
|
||||
|
||||
public fun add(name: String, scope: String, fileId: Int) {
|
||||
fun add(name: String, scope: String, fileId: Int) {
|
||||
storage.append(LookupSymbolKey(name, scope)) { out -> out.writeInt(fileId) }
|
||||
}
|
||||
|
||||
public operator fun get(key: LookupSymbolKey): Collection<Int>? = storage[key]
|
||||
operator fun get(key: LookupSymbolKey): Collection<Int>? = storage[key]
|
||||
|
||||
public operator fun set(key: LookupSymbolKey, fileIds: Set<Int>) {
|
||||
operator fun set(key: LookupSymbolKey, fileIds: Set<Int>) {
|
||||
storage[key] = fileIds
|
||||
}
|
||||
|
||||
public fun remove(key: LookupSymbolKey) {
|
||||
fun remove(key: LookupSymbolKey) {
|
||||
storage.remove(key)
|
||||
}
|
||||
|
||||
public val keys: Collection<LookupSymbolKey>
|
||||
val keys: Collection<LookupSymbolKey>
|
||||
get() = storage.keys
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.jps.incremental.storage
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
|
||||
data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int) : Comparable<LookupSymbolKey> {
|
||||
public constructor(name: String, scope: String) : this(name.hashCode(), scope.hashCode())
|
||||
constructor(name: String, scope: String) : this(name.hashCode(), scope.hashCode())
|
||||
|
||||
override fun compareTo(other: LookupSymbolKey): Int {
|
||||
val nameCmp = nameHash.compareTo(other.nameHash)
|
||||
@@ -31,8 +31,8 @@ data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int) : Comparable<L
|
||||
}
|
||||
|
||||
class PathFunctionPair(
|
||||
public val path: String,
|
||||
public val function: String
|
||||
val path: String,
|
||||
val function: String
|
||||
): Comparable<PathFunctionPair> {
|
||||
override fun compareTo(other: PathFunctionPair): Int {
|
||||
val pathComp = FileUtil.comparePaths(path, other.path)
|
||||
|
||||
@@ -18,5 +18,5 @@ package org.jetbrains.kotlin.modules
|
||||
|
||||
import org.jetbrains.jps.incremental.ModuleBuildTarget
|
||||
|
||||
public fun TargetId(moduleBuildTarget: ModuleBuildTarget): TargetId =
|
||||
fun TargetId(moduleBuildTarget: ModuleBuildTarget): TargetId =
|
||||
TargetId(moduleBuildTarget.id, moduleBuildTarget.targetType.typeId)
|
||||
|
||||
@@ -62,7 +62,7 @@ import kotlin.properties.Delegates
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
|
||||
public abstract class AbstractIncrementalJpsTest(
|
||||
abstract class AbstractIncrementalJpsTest(
|
||||
private val allowNoFilesWithSuffixInTestData: Boolean = false,
|
||||
private val checkDumpsCaseInsensitively: Boolean = false,
|
||||
private val allowNoBuildLogFileInTestData: Boolean = false
|
||||
@@ -230,7 +230,7 @@ public abstract class AbstractIncrementalJpsTest(
|
||||
|
||||
val modifications = ArrayList<Modification>()
|
||||
for (file in testDataDir.listFiles()!!) {
|
||||
val fileName = file.getName()
|
||||
val fileName = file.name
|
||||
|
||||
if (fileName.endsWith(newSuffix)) {
|
||||
modifications.add(ModifyContent(getDirPrefix(fileName) + "/" + fileName.removeSuffix(newSuffix), file))
|
||||
@@ -245,8 +245,8 @@ public abstract class AbstractIncrementalJpsTest(
|
||||
return modifications
|
||||
}
|
||||
|
||||
val haveFilesWithoutNumbers = testDataDir.listFiles { it -> it.getName().matches(".+\\.($COMMANDS_AS_REGEX_PART)$".toRegex()) }?.isNotEmpty() ?: false
|
||||
val haveFilesWithNumbers = testDataDir.listFiles { it -> it.getName().matches(".+\\.($COMMANDS_AS_REGEX_PART)\\.\\d+$".toRegex()) }?.isNotEmpty() ?: false
|
||||
val haveFilesWithoutNumbers = testDataDir.listFiles { it -> it.name.matches(".+\\.($COMMANDS_AS_REGEX_PART)$".toRegex()) }?.isNotEmpty() ?: false
|
||||
val haveFilesWithNumbers = testDataDir.listFiles { it -> it.name.matches(".+\\.($COMMANDS_AS_REGEX_PART)\\.\\d+$".toRegex()) }?.isNotEmpty() ?: false
|
||||
|
||||
if (haveFilesWithoutNumbers && haveFilesWithNumbers) {
|
||||
fail("Bad test data format: files ending with both unnumbered and numbered $COMMANDS_AS_MESSAGE_PART were found")
|
||||
@@ -512,7 +512,7 @@ public abstract class AbstractIncrementalJpsTest(
|
||||
// TODO replace with org.jetbrains.jps.builders.TestProjectBuilderLogger
|
||||
private class MyLogger(val rootPath: String) : ProjectBuilderLoggerBase() {
|
||||
private val logBuf = StringBuilder()
|
||||
public val log: String
|
||||
val log: String
|
||||
get() = logBuf.toString()
|
||||
|
||||
val compiledFiles = hashSetOf<File>()
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.jps.incremental.storage.BasicMapsOwner
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import java.io.File
|
||||
|
||||
public abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest() {
|
||||
abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest() {
|
||||
protected open val expectedCachesFileName: String
|
||||
get() = "expected-kotlin-caches.txt"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.util.concurrency.FixedFuture
|
||||
import java.io.File
|
||||
import java.util.concurrent.Future
|
||||
|
||||
public class IncrementalConstantSearchTest : AbstractIncrementalJpsTest() {
|
||||
class IncrementalConstantSearchTest : AbstractIncrementalJpsTest() {
|
||||
fun testJavaConstantChangedUsedInKotlin() {
|
||||
doTest("jps-plugin/testData/incremental/custom/javaConstantChangedUsedInKotlin/")
|
||||
}
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.jps.build
|
||||
import com.intellij.openapi.util.SystemInfoRt
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType
|
||||
|
||||
public class IncrementalProjectPathCaseChangedTest : AbstractIncrementalJpsTest(checkDumpsCaseInsensitively = true) {
|
||||
class IncrementalProjectPathCaseChangedTest : AbstractIncrementalJpsTest(checkDumpsCaseInsensitively = true) {
|
||||
fun testProjectPathCaseChanged() {
|
||||
doTest("jps-plugin/testData/incremental/custom/projectPathCaseChanged/")
|
||||
}
|
||||
@@ -37,8 +37,8 @@ public class IncrementalProjectPathCaseChangedTest : AbstractIncrementalJpsTest(
|
||||
}
|
||||
|
||||
override fun performAdditionalModifications(modifications: List<AbstractIncrementalJpsTest.Modification>) {
|
||||
val module = myProject.getModules()[0]
|
||||
val sourceRoot = module.getSourceRoots()[0].getUrl()
|
||||
val module = myProject.modules[0]
|
||||
val sourceRoot = module.sourceRoots[0].url
|
||||
assert(sourceRoot.endsWith("/src"))
|
||||
val newSourceRoot = sourceRoot.replace("/src", "/SRC")
|
||||
module.removeSourceRoot(sourceRoot, JavaSourceRootType.SOURCE)
|
||||
|
||||
@@ -60,7 +60,7 @@ import java.util.zip.ZipOutputStream
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
companion object {
|
||||
private val PROJECT_NAME = "kotlinProject"
|
||||
private val ADDITIONAL_MODULE_NAME = "module2"
|
||||
@@ -113,8 +113,8 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
val list = arrayListOf<String>()
|
||||
for (moduleName in moduleNames) {
|
||||
val outputDir = File("out/production/$moduleName")
|
||||
list.add(toSystemIndependentName(JpsJsModuleUtils.getOutputFile(outputDir, moduleName).getPath()))
|
||||
list.add(toSystemIndependentName(JpsJsModuleUtils.getOutputMetaFile(outputDir, moduleName).getPath()))
|
||||
list.add(toSystemIndependentName(JpsJsModuleUtils.getOutputFile(outputDir, moduleName).path))
|
||||
list.add(toSystemIndependentName(JpsJsModuleUtils.getOutputMetaFile(outputDir, moduleName).path))
|
||||
}
|
||||
return list.toTypedArray()
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
private fun assertFilesExistInOutput(module: JpsModule, vararg relativePaths: String) {
|
||||
for (path in relativePaths) {
|
||||
val outputFile = findFileInOutputDir(module, path)
|
||||
assertTrue(outputFile.exists(), "Output not written: " + outputFile.getAbsolutePath() + "\n Directory contents: \n" + dirContents(outputFile.getParentFile()))
|
||||
assertTrue(outputFile.exists(), "Output not written: " + outputFile.absolutePath + "\n Directory contents: \n" + dirContents(outputFile.parentFile))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
val outputDir = File(JpsPathUtil.urlToPath(outputUrl))
|
||||
for (path in relativePaths) {
|
||||
val outputFile = File(outputDir, path)
|
||||
assertFalse(outputFile.exists(), "Output directory \"" + outputFile.getAbsolutePath() + "\" contains \"" + path + "\"")
|
||||
assertFalse(outputFile.exists(), "Output directory \"" + outputFile.absolutePath + "\" contains \"" + path + "\"")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
val files = dir.listFiles() ?: return "<not found>"
|
||||
val builder = StringBuilder()
|
||||
for (file in files) {
|
||||
builder.append(" * ").append(file.getName()).append("\n")
|
||||
builder.append(" * ").append(file.name).append("\n")
|
||||
}
|
||||
return builder.toString()
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
return "out/production/$moduleName/${JvmCodegenUtil.getMappingFileName(moduleName)}"
|
||||
}
|
||||
|
||||
public fun mergeArrays(vararg stringArrays: Array<String>): Array<String> {
|
||||
fun mergeArrays(vararg stringArrays: Array<String>): Array<String> {
|
||||
val result = HashSet<String>()
|
||||
for (array in stringArrays) {
|
||||
result.addAll(Arrays.asList(*array))
|
||||
@@ -186,7 +186,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
super.setUp()
|
||||
val sourceFilesRoot = File(AbstractKotlinJpsBuildTestCase.TEST_DATA_PATH + "general/" + getTestName(false))
|
||||
workDir = AbstractKotlinJpsBuildTestCase.copyTestDataToTmpDir(sourceFilesRoot)
|
||||
getOrCreateProjectDir()
|
||||
orCreateProjectDir
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
@@ -198,21 +198,21 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
|
||||
private fun initProject() {
|
||||
addJdk(JDK_NAME)
|
||||
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr")
|
||||
loadProject(workDir.absolutePath + File.separator + PROJECT_NAME + ".ipr")
|
||||
}
|
||||
|
||||
public fun doTest() {
|
||||
fun doTest() {
|
||||
initProject()
|
||||
makeAll().assertSuccessful()
|
||||
}
|
||||
|
||||
public fun doTestWithRuntime() {
|
||||
fun doTestWithRuntime() {
|
||||
initProject()
|
||||
addKotlinRuntimeDependency()
|
||||
makeAll().assertSuccessful()
|
||||
}
|
||||
|
||||
public fun doTestWithKotlinJavaScriptLibrary() {
|
||||
fun doTestWithKotlinJavaScriptLibrary() {
|
||||
initProject()
|
||||
addKotlinJavaScriptStdlibDependency()
|
||||
createKotlinJavaScriptLibraryArchive()
|
||||
@@ -220,17 +220,17 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
makeAll().assertSuccessful()
|
||||
}
|
||||
|
||||
public fun testKotlinProject() {
|
||||
fun testKotlinProject() {
|
||||
doTest()
|
||||
|
||||
checkWhen(touch("src/test1.kt"), null, packageClasses("kotlinProject", "src/test1.kt", "Test1Kt"))
|
||||
}
|
||||
|
||||
public fun testSourcePackagePrefix() {
|
||||
fun testSourcePackagePrefix() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
public fun testSourcePackageLongPrefix() {
|
||||
fun testSourcePackageLongPrefix() {
|
||||
initProject()
|
||||
val buildResult = makeAll()
|
||||
buildResult.assertSuccessful()
|
||||
@@ -239,7 +239,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertEquals("Invalid package prefix name is ignored: invalid-prefix.test", warnings.first().messageText)
|
||||
}
|
||||
|
||||
public fun testSourcePackagePrefixKnownIssueWithInnerClasses() {
|
||||
fun testSourcePackagePrefixKnownIssueWithInnerClasses() {
|
||||
initProject()
|
||||
val buildResult = makeAll()
|
||||
buildResult.assertFailed()
|
||||
@@ -247,7 +247,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertTrue("Message wasn't found. $errors", errors.first().contains("class xxx.JavaWithInner.TextRenderer, unresolved supertypes: TableRow"))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProject() {
|
||||
fun testKotlinJavaScriptProject() {
|
||||
initProject()
|
||||
addKotlinJavaScriptStdlibDependency()
|
||||
makeAll().assertSuccessful()
|
||||
@@ -256,7 +256,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/test1.kt"), null, k2jsOutput(PROJECT_NAME))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProjectWithTwoModules() {
|
||||
fun testKotlinJavaScriptProjectWithTwoModules() {
|
||||
initProject()
|
||||
addKotlinJavaScriptStdlibDependency()
|
||||
makeAll().assertSuccessful()
|
||||
@@ -269,9 +269,9 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(arrayOf(touch("src/test1.kt"), touch("module2/src/module2.kt")), null, k2jsOutput(PROJECT_NAME, ADDITIONAL_MODULE_NAME))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProjectWithDirectoryAsStdlib() {
|
||||
fun testKotlinJavaScriptProjectWithDirectoryAsStdlib() {
|
||||
initProject()
|
||||
val jslibJar = PathUtil.getKotlinPathsForDistDirectory().getJsStdLibJarPath()
|
||||
val jslibJar = PathUtil.getKotlinPathsForDistDirectory().jsStdLibJarPath
|
||||
val jslibDir = File(workDir, "KotlinJavaScript")
|
||||
try {
|
||||
ZipUtil.extract(jslibJar, jslibDir, null)
|
||||
@@ -287,7 +287,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/test1.kt"), null, k2jsOutput(PROJECT_NAME))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProjectWithDirectoryAsLibrary() {
|
||||
fun testKotlinJavaScriptProjectWithDirectoryAsLibrary() {
|
||||
initProject()
|
||||
addKotlinJavaScriptStdlibDependency()
|
||||
addKotlinJavaScriptDependency(KOTLIN_JS_LIBRARY, File(workDir, KOTLIN_JS_LIBRARY))
|
||||
@@ -297,28 +297,28 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/test1.kt"), null, k2jsOutput(PROJECT_NAME))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProjectWithLibrary() {
|
||||
fun testKotlinJavaScriptProjectWithLibrary() {
|
||||
doTestWithKotlinJavaScriptLibrary()
|
||||
|
||||
assertEquals(EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_DEFAULT_DIR, contentOfOutputDir(PROJECT_NAME))
|
||||
checkWhen(touch("src/test1.kt"), null, k2jsOutput(PROJECT_NAME))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProjectWithLibraryCustomOutputDir() {
|
||||
fun testKotlinJavaScriptProjectWithLibraryCustomOutputDir() {
|
||||
doTestWithKotlinJavaScriptLibrary()
|
||||
|
||||
assertEquals(EXPECTED_JS_FILES_IN_OUTPUT_WITH_ADDITIONAL_LIB_AND_CUSTOM_DIR, contentOfOutputDir(PROJECT_NAME))
|
||||
checkWhen(touch("src/test1.kt"), null, k2jsOutput(PROJECT_NAME))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProjectWithLibraryNoCopy() {
|
||||
fun testKotlinJavaScriptProjectWithLibraryNoCopy() {
|
||||
doTestWithKotlinJavaScriptLibrary()
|
||||
|
||||
assertEquals(EXPECTED_JS_FILES_IN_OUTPUT_NO_COPY, contentOfOutputDir(PROJECT_NAME))
|
||||
checkWhen(touch("src/test1.kt"), null, k2jsOutput(PROJECT_NAME))
|
||||
}
|
||||
|
||||
public fun testKotlinJavaScriptProjectWithLibraryAndErrors() {
|
||||
fun testKotlinJavaScriptProjectWithLibraryAndErrors() {
|
||||
initProject()
|
||||
addKotlinJavaScriptStdlibDependency()
|
||||
createKotlinJavaScriptLibraryArchive()
|
||||
@@ -328,20 +328,20 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertEquals(Collections.EMPTY_SET, contentOfOutputDir(PROJECT_NAME))
|
||||
}
|
||||
|
||||
public fun testExcludeFolderInSourceRoot() {
|
||||
fun testExcludeFolderInSourceRoot() {
|
||||
doTest()
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesExistInOutput(module, "Foo.class")
|
||||
assertFilesNotExistInOutput(module, *EXCLUDE_FILES)
|
||||
|
||||
checkWhen(touch("src/foo.kt"), null, arrayOf(klass("kotlinProject", "Foo")))
|
||||
}
|
||||
|
||||
public fun testExcludeModuleFolderInSourceRootOfAnotherModule() {
|
||||
fun testExcludeModuleFolderInSourceRootOfAnotherModule() {
|
||||
doTest()
|
||||
|
||||
for (module in myProject.getModules()) {
|
||||
for (module in myProject.modules) {
|
||||
assertFilesExistInOutput(module, "Foo.class")
|
||||
}
|
||||
|
||||
@@ -349,10 +349,10 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/module2/src/foo.kt"), null, arrayOf(klass("module2", "Foo")))
|
||||
}
|
||||
|
||||
public fun testExcludeFileUsingCompilerSettings() {
|
||||
fun testExcludeFileUsingCompilerSettings() {
|
||||
doTest()
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesExistInOutput(module, "Foo.class", "Bar.class")
|
||||
assertFilesNotExistInOutput(module, *EXCLUDE_FILES)
|
||||
|
||||
@@ -361,10 +361,10 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/dir/YetAnotherExcluded.kt"), null, NOTHING)
|
||||
}
|
||||
|
||||
public fun testExcludeFolderNonRecursivelyUsingCompilerSettings() {
|
||||
fun testExcludeFolderNonRecursivelyUsingCompilerSettings() {
|
||||
doTest()
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesExistInOutput(module, "Foo.class", "Bar.class")
|
||||
assertFilesNotExistInOutput(module, *EXCLUDE_FILES)
|
||||
|
||||
@@ -375,10 +375,10 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/dir/subdir/YetAnotherExcluded.kt"), null, NOTHING)
|
||||
}
|
||||
|
||||
public fun testExcludeFolderRecursivelyUsingCompilerSettings() {
|
||||
fun testExcludeFolderRecursivelyUsingCompilerSettings() {
|
||||
doTest()
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesExistInOutput(module, "Foo.class", "Bar.class")
|
||||
assertFilesNotExistInOutput(module, *EXCLUDE_FILES)
|
||||
|
||||
@@ -390,10 +390,10 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/exclude/subdir/YetAnotherExcluded.kt"), null, NOTHING)
|
||||
}
|
||||
|
||||
public fun testManyFiles() {
|
||||
fun testManyFiles() {
|
||||
doTest()
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesExistInOutput(module, "foo/MainKt.class", "boo/BooKt.class", "foo/Bar.class")
|
||||
|
||||
checkWhen(touch("src/main.kt"), null, packageClasses("kotlinProject", "src/main.kt", "foo.MainKt"))
|
||||
@@ -412,10 +412,10 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("src/Bar.kt"), null, arrayOf(klass("kotlinProject", "foo.Bar")))
|
||||
}
|
||||
|
||||
public fun testManyFilesForPackage() {
|
||||
fun testManyFilesForPackage() {
|
||||
doTest()
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesExistInOutput(module, "foo/MainKt.class", "boo/BooKt.class", "foo/Bar.class")
|
||||
|
||||
checkWhen(touch("src/main.kt"), null, packageClasses("kotlinProject", "src/main.kt", "foo.MainKt"))
|
||||
@@ -441,7 +441,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
module("kotlinProject")))
|
||||
}
|
||||
|
||||
public fun testKotlinProjectTwoFilesInOnePackage() {
|
||||
fun testKotlinProjectTwoFilesInOnePackage() {
|
||||
doTest()
|
||||
|
||||
checkWhen(touch("src/test1.kt"), null, packageClasses("kotlinProject", "src/test1.kt", "_DefaultPackage"))
|
||||
@@ -452,38 +452,38 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
packagePartClass("kotlinProject", "src/test2.kt", "_DefaultPackage"),
|
||||
module("kotlinProject")))
|
||||
|
||||
assertFilesNotExistInOutput(myProject.getModules().get(0), "_DefaultPackage.class")
|
||||
assertFilesNotExistInOutput(myProject.modules.get(0), "_DefaultPackage.class")
|
||||
}
|
||||
|
||||
public fun testKotlinJavaProject() {
|
||||
fun testKotlinJavaProject() {
|
||||
doTestWithRuntime()
|
||||
}
|
||||
|
||||
public fun testJKJProject() {
|
||||
fun testJKJProject() {
|
||||
doTestWithRuntime()
|
||||
}
|
||||
|
||||
public fun testKJKProject() {
|
||||
fun testKJKProject() {
|
||||
doTestWithRuntime()
|
||||
}
|
||||
|
||||
public fun testKJCircularProject() {
|
||||
fun testKJCircularProject() {
|
||||
doTestWithRuntime()
|
||||
}
|
||||
|
||||
public fun testJKJInheritanceProject() {
|
||||
fun testJKJInheritanceProject() {
|
||||
doTestWithRuntime()
|
||||
}
|
||||
|
||||
public fun testKJKInheritanceProject() {
|
||||
fun testKJKInheritanceProject() {
|
||||
doTestWithRuntime()
|
||||
}
|
||||
|
||||
public fun testCircularDependenciesNoKotlinFiles() {
|
||||
fun testCircularDependenciesNoKotlinFiles() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
public fun testCircularDependenciesDifferentPackages() {
|
||||
fun testCircularDependenciesDifferentPackages() {
|
||||
initProject()
|
||||
val result = makeAll()
|
||||
|
||||
@@ -497,7 +497,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("module2/src/kt1.kt"), null, packageClasses("module2", "module2/src/kt1.kt", "kt1.Kt1Kt"))
|
||||
}
|
||||
|
||||
public fun testCircularDependenciesSamePackage() {
|
||||
fun testCircularDependenciesSamePackage() {
|
||||
initProject()
|
||||
val result = makeAll()
|
||||
result.assertSuccessful()
|
||||
@@ -512,7 +512,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("module2/src/b.kt"), null, packageClasses("module2", "module2/src/b.kt", "test.TestPackage"))
|
||||
}
|
||||
|
||||
public fun testCircularDependenciesSamePackageWithTests() {
|
||||
fun testCircularDependenciesSamePackageWithTests() {
|
||||
initProject()
|
||||
val result = makeAll()
|
||||
result.assertSuccessful()
|
||||
@@ -527,31 +527,31 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
checkWhen(touch("module2/src/b.kt"), null, packageClasses("module2", "module2/src/b.kt", "test.TestPackage"))
|
||||
}
|
||||
|
||||
public fun testInternalFromAnotherModule() {
|
||||
fun testInternalFromAnotherModule() {
|
||||
initProject()
|
||||
val result = makeAll()
|
||||
result.assertFailed()
|
||||
result.checkErrors()
|
||||
}
|
||||
|
||||
public fun testCircularDependenciesInternalFromAnotherModule() {
|
||||
fun testCircularDependenciesInternalFromAnotherModule() {
|
||||
initProject()
|
||||
val result = makeAll()
|
||||
result.assertFailed()
|
||||
result.checkErrors()
|
||||
}
|
||||
|
||||
public fun testCircularDependenciesWrongInternalFromTests() {
|
||||
fun testCircularDependenciesWrongInternalFromTests() {
|
||||
initProject()
|
||||
val result = makeAll()
|
||||
result.assertFailed()
|
||||
result.checkErrors()
|
||||
}
|
||||
|
||||
public fun testCircularDependencyWithReferenceToOldVersionLib() {
|
||||
fun testCircularDependencyWithReferenceToOldVersionLib() {
|
||||
initProject()
|
||||
|
||||
val libraryJar = MockLibraryUtil.compileLibraryToJar(workDir.getAbsolutePath() + File.separator + "oldModuleLib/src", "module-lib", false)
|
||||
val libraryJar = MockLibraryUtil.compileLibraryToJar(workDir.absolutePath + File.separator + "oldModuleLib/src", "module-lib", false)
|
||||
|
||||
AbstractKotlinJpsBuildTestCase.addDependency(JpsJavaDependencyScope.COMPILE, Lists.newArrayList(findModule("module1"), findModule("module2")), false, "module-lib", libraryJar)
|
||||
|
||||
@@ -559,10 +559,10 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
result.assertSuccessful()
|
||||
}
|
||||
|
||||
public fun testDependencyToOldKotlinLib() {
|
||||
fun testDependencyToOldKotlinLib() {
|
||||
initProject()
|
||||
|
||||
val libraryJar = MockLibraryUtil.compileLibraryToJar(workDir.getAbsolutePath() + File.separator + "oldModuleLib/src", "module-lib", false)
|
||||
val libraryJar = MockLibraryUtil.compileLibraryToJar(workDir.absolutePath + File.separator + "oldModuleLib/src", "module-lib", false)
|
||||
|
||||
AbstractKotlinJpsBuildTestCase.addDependency(JpsJavaDependencyScope.COMPILE, Lists.newArrayList(findModule("module")), false, "module-lib", libraryJar)
|
||||
|
||||
@@ -572,7 +572,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
result.assertSuccessful()
|
||||
}
|
||||
|
||||
public fun testAccessToInternalInProductionFromTests() {
|
||||
fun testAccessToInternalInProductionFromTests() {
|
||||
initProject()
|
||||
|
||||
val result = makeAll()
|
||||
@@ -608,17 +608,17 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
return result
|
||||
}
|
||||
|
||||
public fun testReexportedDependency() {
|
||||
fun testReexportedDependency() {
|
||||
initProject()
|
||||
AbstractKotlinJpsBuildTestCase.addKotlinRuntimeDependency(JpsJavaDependencyScope.COMPILE, ContainerUtil.filter(myProject.getModules(), object : Condition<JpsModule> {
|
||||
AbstractKotlinJpsBuildTestCase.addKotlinRuntimeDependency(JpsJavaDependencyScope.COMPILE, ContainerUtil.filter(myProject.modules, object : Condition<JpsModule> {
|
||||
override fun value(module: JpsModule): Boolean {
|
||||
return module.getName() == "module2"
|
||||
return module.name == "module2"
|
||||
}
|
||||
}), true)
|
||||
makeAll().assertSuccessful()
|
||||
}
|
||||
|
||||
public fun testCancelLongKotlinCompilation() {
|
||||
fun testCancelLongKotlinCompilation() {
|
||||
generateLongKotlinFile("Foo.kt", "foo", "Foo")
|
||||
initProject()
|
||||
|
||||
@@ -636,28 +636,28 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
buildResult.assertSuccessful()
|
||||
assert(interval < 8000) { "expected time for canceled compilation < 8000 ms, but $interval" }
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesNotExistInOutput(module, "foo/Foo.class")
|
||||
|
||||
val expectedLog = workDir.getAbsolutePath() + File.separator + "expected.log"
|
||||
val expectedLog = workDir.absolutePath + File.separator + "expected.log"
|
||||
checkFullLog(logger, File(expectedLog))
|
||||
}
|
||||
|
||||
public fun testCancelKotlinCompilation() {
|
||||
fun testCancelKotlinCompilation() {
|
||||
initProject()
|
||||
makeAll().assertSuccessful()
|
||||
|
||||
val module = myProject.getModules().get(0)
|
||||
val module = myProject.modules.get(0)
|
||||
assertFilesExistInOutput(module, "foo/Bar.class")
|
||||
|
||||
val buildResult = BuildResult()
|
||||
val canceledStatus = object: CanceledStatus {
|
||||
var checkFromIndex = 0;
|
||||
|
||||
public override fun isCanceled(): Boolean {
|
||||
override fun isCanceled(): Boolean {
|
||||
val messages = buildResult.getMessages(BuildMessage.Kind.INFO)
|
||||
for (i in checkFromIndex..messages.size - 1) {
|
||||
if (messages.get(i).getMessageText().startsWith("Kotlin JPS plugin version")) return true;
|
||||
if (messages.get(i).messageText.startsWith("Kotlin JPS plugin version")) return true;
|
||||
}
|
||||
|
||||
checkFromIndex = messages.size;
|
||||
@@ -672,7 +672,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertFilesNotExistInOutput(module, "foo/Bar.class")
|
||||
}
|
||||
|
||||
public fun testFileDoesNotExistWarning() {
|
||||
fun testFileDoesNotExistWarning() {
|
||||
initProject()
|
||||
|
||||
AbstractKotlinJpsBuildTestCase.addDependency(
|
||||
@@ -697,7 +697,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
public fun testDoNotCreateUselessKotlinIncrementalCaches() {
|
||||
fun testDoNotCreateUselessKotlinIncrementalCaches() {
|
||||
initProject()
|
||||
makeAll().assertSuccessful()
|
||||
|
||||
@@ -706,7 +706,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertFalse(File(storageRoot, "targets/java-production/kotlinProject/kotlin").exists())
|
||||
}
|
||||
|
||||
public fun testDoNotCreateUselessKotlinIncrementalCachesForDependentTargets() {
|
||||
fun testDoNotCreateUselessKotlinIncrementalCachesForDependentTargets() {
|
||||
initProject()
|
||||
makeAll().assertSuccessful()
|
||||
|
||||
@@ -741,16 +741,16 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
}
|
||||
|
||||
private fun checkFullLog(logger: TestProjectBuilderLogger, expectedLogFile: File) {
|
||||
UsefulTestCase.assertSameLinesWithFile(expectedLogFile.getAbsolutePath(), logger.getFullLog(getOrCreateProjectDir(), myDataStorageRoot))
|
||||
UsefulTestCase.assertSameLinesWithFile(expectedLogFile.absolutePath, logger.getFullLog(orCreateProjectDir, myDataStorageRoot))
|
||||
}
|
||||
|
||||
private fun assertCanceled(buildResult: BuildResult) {
|
||||
val list = buildResult.getMessages(BuildMessage.Kind.INFO)
|
||||
assertTrue("The build has been canceled".equals(list.last().getMessageText()))
|
||||
assertTrue("The build has been canceled".equals(list.last().messageText))
|
||||
}
|
||||
|
||||
private fun generateLongKotlinFile(filePath: String, packagename: String, className: String) {
|
||||
val file = File(workDir.getAbsolutePath() + File.separator + "src" + File.separator + filePath)
|
||||
val file = File(workDir.absolutePath + File.separator + "src" + File.separator + filePath)
|
||||
FileUtilRt.createIfNotExists(file)
|
||||
val writer = BufferedWriter(FileWriter(file))
|
||||
try {
|
||||
@@ -769,8 +769,8 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
}
|
||||
|
||||
private fun findModule(name: String): JpsModule {
|
||||
for (module in myProject.getModules()) {
|
||||
if (module.getName() == name) {
|
||||
for (module in myProject.modules) {
|
||||
if (module.name == name) {
|
||||
return module
|
||||
}
|
||||
}
|
||||
@@ -802,7 +802,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
}
|
||||
|
||||
private fun packagePartClass(moduleName: String, fileName: String, packageClassFqName: String): String {
|
||||
val path = FileUtilRt.toSystemIndependentName(File(workDir, fileName).getAbsolutePath())
|
||||
val path = FileUtilRt.toSystemIndependentName(File(workDir, fileName).absolutePath)
|
||||
val fakeVirtualFile = object : LightVirtualFile(path.substringAfterLast('/')) {
|
||||
override fun getPath(): String {
|
||||
// strip extra "/" from the beginning
|
||||
@@ -833,7 +833,7 @@ public class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
Operation.CHANGE ->
|
||||
touch(file)
|
||||
Operation.DELETE ->
|
||||
assertTrue(file.delete(), "Can not delete file \"" + file.getAbsolutePath() + "\"")
|
||||
assertTrue(file.delete(), "Can not delete file \"" + file.absolutePath + "\"")
|
||||
else ->
|
||||
fail("Unknown operation")
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ import org.jetbrains.kotlin.daemon.common.*
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
|
||||
public class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
workDir = KotlinTestUtils.tmpDirForTest(this)
|
||||
}
|
||||
|
||||
public fun testLoadingKotlinFromDifferentModules() {
|
||||
fun testLoadingKotlinFromDifferentModules() {
|
||||
val aFile = createFile("m1/K.kt",
|
||||
"""
|
||||
package m1;
|
||||
@@ -65,7 +65,7 @@ public class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
}
|
||||
|
||||
// TODO: add JS tests
|
||||
public fun testDaemon() {
|
||||
fun testDaemon() {
|
||||
System.setProperty(COMPILE_DAEMON_ENABLED_PROPERTY, "")
|
||||
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "")
|
||||
// spaces in the name to test proper file name handling
|
||||
|
||||
+3
-3
@@ -57,7 +57,7 @@ fun getDirectoryString(dir: File, interestingPaths: List<String>): String {
|
||||
|
||||
val children = listFiles!!.sortedWith(compareBy ({ it.isDirectory }, { it.name } ))
|
||||
for (child in children) {
|
||||
if (child.isDirectory()) {
|
||||
if (child.isDirectory) {
|
||||
p.println(child.name)
|
||||
addDirContent(child)
|
||||
}
|
||||
@@ -86,7 +86,7 @@ fun getDirectoryString(dir: File, interestingPaths: List<String>): String {
|
||||
fun getAllRelativePaths(dir: File): Set<String> {
|
||||
val result = HashSet<String>()
|
||||
FileUtil.processFilesRecursively(dir) {
|
||||
if (it!!.isFile()) {
|
||||
if (it!!.isFile) {
|
||||
result.add(FileUtil.getRelativePath(dir, it)!!)
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ fun classFileToString(classFile: File): String {
|
||||
val traceVisitor = TraceClassVisitor(PrintWriter(out))
|
||||
ClassReader(classFile.readBytes()).accept(traceVisitor, 0)
|
||||
|
||||
val classHeader = LocalFileKotlinClass.create(classFile)?.getClassHeader()
|
||||
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader
|
||||
|
||||
val annotationDataEncoded = classHeader?.annotationData
|
||||
if (annotationDataEncoded != null) {
|
||||
|
||||
@@ -28,9 +28,9 @@ import org.jetbrains.kotlin.test.MockLibraryUtil
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import java.io.File
|
||||
|
||||
public abstract class AbstractProtoComparisonTest : UsefulTestCase() {
|
||||
abstract class AbstractProtoComparisonTest : UsefulTestCase() {
|
||||
|
||||
public fun doTest(testDataPath: String) {
|
||||
fun doTest(testDataPath: String) {
|
||||
val testDir = KotlinTestUtils.tmpDir("testDirectory")
|
||||
|
||||
val oldClassFiles = compileFileAndGetClasses(testDataPath, testDir, "old")
|
||||
|
||||
@@ -30,22 +30,22 @@ import java.io.File
|
||||
* To test this, we compile a Kotlin+Java module (in two modes: CLI and module-based) where a runtime Java class was replaced
|
||||
* with a "newer" version in sources, and check that this class resolves to the one from sources by calling a method absent in the runtime
|
||||
*/
|
||||
public class ClasspathOrderTest : TestCaseWithTmpdir() {
|
||||
class ClasspathOrderTest : TestCaseWithTmpdir() {
|
||||
companion object {
|
||||
val sourceDir = File(KotlinTestUtils.getTestDataPathBase() + "/classpathOrder").getAbsoluteFile()
|
||||
val sourceDir = File(KotlinTestUtils.getTestDataPathBase() + "/classpathOrder").absoluteFile
|
||||
}
|
||||
|
||||
public fun testClasspathOrderForCLI() {
|
||||
MockLibraryUtil.compileKotlin(sourceDir.getPath(), tmpdir)
|
||||
fun testClasspathOrderForCLI() {
|
||||
MockLibraryUtil.compileKotlin(sourceDir.path, tmpdir)
|
||||
}
|
||||
|
||||
public fun testClasspathOrderForModuleScriptBuild() {
|
||||
fun testClasspathOrderForModuleScriptBuild() {
|
||||
val xmlContent = KotlinModuleXmlBuilder().addModule(
|
||||
"name",
|
||||
File(tmpdir, "output").getAbsolutePath(),
|
||||
File(tmpdir, "output").absolutePath,
|
||||
listOf(sourceDir),
|
||||
listOf(JvmSourceRoot(sourceDir)),
|
||||
listOf(PathUtil.getKotlinPathsForDistDirectory().getRuntimePath()),
|
||||
listOf(PathUtil.getKotlinPathsForDistDirectory().runtimePath),
|
||||
JavaModuleBuildTargetType.PRODUCTION,
|
||||
setOf(),
|
||||
emptyList()
|
||||
@@ -54,6 +54,6 @@ public class ClasspathOrderTest : TestCaseWithTmpdir() {
|
||||
val xml = File(tmpdir, "module.xml")
|
||||
xml.writeText(xmlContent)
|
||||
|
||||
MockLibraryUtil.compileKotlinModule(xml.getAbsolutePath())
|
||||
MockLibraryUtil.compileKotlinModule(xml.absolutePath)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user