Skip to content

Commit 1f502fe

Browse files
Aleksei.CherepanovSpace Team
Aleksei.Cherepanov
authored and
Space Team
committed
[JPS] Properly register files to compile
JPS graph needs to know if Kotlin JPS tried to compile some files. Previously, we registered these files only iff compilation succeeded. Now we register them also in case when the compiler fails
1 parent 98e45b6 commit 1f502fe

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
464464

465465
cleanJsOutputs(context, kotlinChunk, incrementalCaches, kotlinDirtyFilesHolder)
466466

467-
if (LOG.isDebugEnabled) {
468-
LOG.debug("Compiling files: ${kotlinDirtyFilesHolder.allDirtyFiles}")
469-
}
467+
470468

471469
val reportService = JpsStatisticsReportService.getFromContext(context)
472470
reportService.reportCompilerArguments(chunk, kotlinChunk)
@@ -494,6 +492,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
494492
LOG.info("Compiled with errors")
495493
return ABORT
496494
} else {
495+
JavaBuilderUtil.registerSuccessfullyCompiled(context, kotlinDirtyFilesHolder.allDirtyFiles)
497496
LOG.info("Compiled successfully")
498497
}
499498

@@ -640,11 +639,23 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
640639
}
641640
}
642641

642+
registerFilesToCompile(dirtyFilesHolder, context)
643643
val isDoneSomething = representativeTarget.compileModuleChunk(commonArguments, dirtyFilesHolder, environment, buildMetricReporter)
644644

645645
return if (isDoneSomething) environment.outputItemsCollector else null
646646
}
647647

648+
private fun registerFilesToCompile(
649+
dirtyFilesHolder: KotlinDirtySourceFilesHolder,
650+
context: CompileContext,
651+
) {
652+
val allDirtyFiles = dirtyFilesHolder.allDirtyFiles
653+
if (LOG.isDebugEnabled) {
654+
LOG.debug("Compiling files: $allDirtyFiles")
655+
}
656+
JavaBuilderUtil.registerFilesToCompile(context, allDirtyFiles)
657+
}
658+
648659
private fun createCompileEnvironment(
649660
context: CompileContext,
650661
kotlinModuleBuilderTarget: KotlinModuleBuildTarget<*>,

jps/jps-plugin/src/org/jetbrains/kotlin/jps/targets/KotlinJvmModuleBuildTarget.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,6 @@ class KotlinJvmModuleBuildTarget(kotlinContext: KotlinCompileContext, jpsModuleB
422422
}
423423
}
424424
// important: in jps-dependency-graph you can't register additional dependencies after [callback.associate].
425-
426-
val allCompiled = dirtyFilesHolder.allDirtyFiles
427-
JavaBuilderUtil.registerFilesToCompile(localContext, allCompiled)
428-
JavaBuilderUtil.registerSuccessfullyCompiled(localContext, allCompiled)
429425
}
430426

431427
private fun processInlineConstTracker(inlineConstTracker: InlineConstTrackerImpl, sourceFile: File, output: GeneratedJvmClass, callback: Backend) {

0 commit comments

Comments
 (0)