formatting clean up
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
e101f88b50
commit
2f3ff10204
@@ -37,32 +37,32 @@ import kotlin.collections.HashSet
|
||||
const val DELETE_MODULE_FILE_PROPERTY = "kotlin.delete.module.file.after.build"
|
||||
|
||||
fun makeModuleFile(
|
||||
name: String,
|
||||
isTest: Boolean,
|
||||
outputDir: File,
|
||||
sourcesToCompile: Iterable<File>,
|
||||
commonSources: Iterable<File>,
|
||||
javaSourceRoots: Iterable<JvmSourceRoot>,
|
||||
classpath: Iterable<File>,
|
||||
friendDirs: Iterable<File>
|
||||
name: String,
|
||||
isTest: Boolean,
|
||||
outputDir: File,
|
||||
sourcesToCompile: Iterable<File>,
|
||||
commonSources: Iterable<File>,
|
||||
javaSourceRoots: Iterable<JvmSourceRoot>,
|
||||
classpath: Iterable<File>,
|
||||
friendDirs: Iterable<File>
|
||||
): File {
|
||||
val builder = KotlinModuleXmlBuilder()
|
||||
builder.addModule(
|
||||
name,
|
||||
outputDir.absolutePath,
|
||||
// important to transform file to absolute paths,
|
||||
// otherwise compiler will use module file's parent as base path (a temporary file; see below)
|
||||
// (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths)
|
||||
sourcesToCompile.map { it.absoluteFile },
|
||||
javaSourceRoots,
|
||||
classpath,
|
||||
commonSources.map { it.absoluteFile },
|
||||
null,
|
||||
"java-production",
|
||||
isTest,
|
||||
// this excludes the output directories from the class path, to be removed for true incremental compilation
|
||||
setOf(outputDir),
|
||||
friendDirs
|
||||
name,
|
||||
outputDir.absolutePath,
|
||||
// important to transform file to absolute paths,
|
||||
// otherwise compiler will use module file's parent as base path (a temporary file; see below)
|
||||
// (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths)
|
||||
sourcesToCompile.map { it.absoluteFile },
|
||||
javaSourceRoots,
|
||||
classpath,
|
||||
commonSources.map { it.absoluteFile },
|
||||
null,
|
||||
"java-production",
|
||||
isTest,
|
||||
// this excludes the output directories from the class path, to be removed for true incremental compilation
|
||||
setOf(outputDir),
|
||||
friendDirs
|
||||
)
|
||||
|
||||
val scriptFile = File.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml")
|
||||
@@ -83,9 +83,9 @@ private fun sanitizeJavaIdentifier(string: String) =
|
||||
}
|
||||
|
||||
fun makeCompileServices(
|
||||
incrementalCaches: Map<TargetId, IncrementalCache>,
|
||||
lookupTracker: LookupTracker,
|
||||
compilationCanceledStatus: CompilationCanceledStatus?
|
||||
incrementalCaches: Map<TargetId, IncrementalCache>,
|
||||
lookupTracker: LookupTracker,
|
||||
compilationCanceledStatus: CompilationCanceledStatus?
|
||||
): Services =
|
||||
with(Services.Builder()) {
|
||||
register(LookupTracker::class.java, lookupTracker)
|
||||
@@ -105,12 +105,14 @@ fun updateIncrementalCache(
|
||||
for (generatedFile in generatedFiles) {
|
||||
when {
|
||||
generatedFile is GeneratedJvmClass -> cache.saveFileToCache(generatedFile, changesCollector)
|
||||
generatedFile.outputFile.isModuleMappingFile() -> cache.saveModuleMappingToCache(generatedFile.sourceFiles, generatedFile.outputFile)
|
||||
generatedFile.outputFile.isModuleMappingFile() -> cache.saveModuleMappingToCache(
|
||||
generatedFile.sourceFiles,
|
||||
generatedFile.outputFile
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
javaChangesTracker?.javaClassesUpdates?.forEach {
|
||||
(source, serializedJavaClass) ->
|
||||
javaChangesTracker?.javaClassesUpdates?.forEach { (source, serializedJavaClass) ->
|
||||
cache.saveJavaClassProto(source, serializedJavaClass, changesCollector)
|
||||
}
|
||||
|
||||
@@ -118,9 +120,9 @@ fun updateIncrementalCache(
|
||||
}
|
||||
|
||||
fun LookupStorage.update(
|
||||
lookupTracker: LookupTracker,
|
||||
filesToCompile: Iterable<File>,
|
||||
removedFiles: Iterable<File>
|
||||
lookupTracker: LookupTracker,
|
||||
filesToCompile: Iterable<File>,
|
||||
removedFiles: Iterable<File>
|
||||
) {
|
||||
if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker::class.java}")
|
||||
|
||||
@@ -130,8 +132,8 @@ fun LookupStorage.update(
|
||||
}
|
||||
|
||||
data class DirtyData(
|
||||
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
|
||||
val dirtyClassesFqNames: Collection<FqName> = emptyList()
|
||||
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
|
||||
val dirtyClassesFqNames: Collection<FqName> = emptyList()
|
||||
)
|
||||
|
||||
fun ChangesCollector.getDirtyData(
|
||||
@@ -213,8 +215,8 @@ fun mapClassesFqNamesToFiles(
|
||||
}
|
||||
|
||||
fun withSubtypes(
|
||||
typeFqName: FqName,
|
||||
caches: Iterable<IncrementalCacheCommon>
|
||||
typeFqName: FqName,
|
||||
caches: Iterable<IncrementalCacheCommon>
|
||||
): Set<FqName> {
|
||||
val types = LinkedList(listOf(typeFqName))
|
||||
val subtypes = hashSetOf<FqName>()
|
||||
@@ -223,9 +225,9 @@ fun withSubtypes(
|
||||
val unprocessedType = types.pollFirst()
|
||||
|
||||
caches.asSequence()
|
||||
.flatMap { it.getSubtypesOf(unprocessedType) }
|
||||
.filter { it !in subtypes }
|
||||
.forEach { types.addLast(it) }
|
||||
.flatMap { it.getSubtypesOf(unprocessedType) }
|
||||
.filter { it !in subtypes }
|
||||
.forEach { types.addLast(it) }
|
||||
|
||||
subtypes.add(unprocessedType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user