Is there anything FIR/IR plugins should explicitly...
# compiler
z
Is there anything FIR/IR plugins should explicitly do to be mindful of incremental compilation? I sporadically see failures like this but not sure if this is an issue with my gradle project setup or the plugin itself
Copy code
Caused by: java.lang.AssertionError: java.lang.Exception: Could not close incremental caches in /Users/zacsweers/path-to-project/build/kotlin/compileTestKotlinJvm/cacheable/caches-jvm/jvm/kotlin: class-fq-name-to-source.tab, source-to-classes.tab, internal-name-to-source.tab
        at org.jetbrains.kotlin.com.google.common.io.Closer.close(Closer.java:236)
        at org.jetbrains.kotlin.incremental.IncrementalCachesManager.close(IncrementalCachesManager.kt:55)
        at kotlin.io.CloseableKt.closeFinally(Closeable.kt:56)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:293)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:129)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:674)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:91)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1659)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
Got a bit longer of trace that suggests this is related to generating top-level classes
Copy code
Suppressed: java.lang.IllegalStateException: Expected absolute path but found relative path: __GENERATED DECLARATIONS__.kt
                at org.jetbrains.kotlin.incremental.storage.RelocatableFileToPathConverter.toPath(RelocatableFileToPathConverter.kt:20)
                at org.jetbrains.kotlin.incremental.storage.FileDescriptor.save(FileToPathConverter.kt:33)
                at org.jetbrains.kotlin.incremental.storage.FileDescriptor.save(FileToPathConverter.kt:30)
                at org.jetbrains.kotlin.incremental.storage.AppendableCollectionExternalizer.save(LazyStorage.kt:151)
                at org.jetbrains.kotlin.incremental.storage.AppendableCollectionExternalizer.save(LazyStorage.kt:142)
                at org.jetbrains.kotlin.com.intellij.util.io.PersistentMapImpl.doPut(PersistentMapImpl.java:443)
                at org.jetbrains.kotlin.com.intellij.util.io.PersistentMapImpl.put(PersistentMapImpl.java:422)
d
Not supported yet
j
@dmitriy.novozhilov As in incremental compilation is not support in modules which use a plugin containing a FirDeclarationGenerationExtension?
d
It doesn't work properly in a general case. But if your plugin is local enough (like the
kotlinx.serialization
) and you lookup for declarations from the same file as the class you are generating something for then IC should work
z
What about a file referenced from a class in another file? Or if it’s only IR doing the referencing?
d
TBH I don't know. The IC was properly checked only for official plugins. So for all other cases it could work or could not