@@ -336,13 +336,34 @@ class IncrementalContext(
336
336
logFile.appendText(" \n Dirty / All: $percentage %\n\n " )
337
337
}
338
338
339
+ private val processingOptionsFile = File (options.cachesDir, " processing.options" )
340
+ private val processingOptionsString: String by lazy {
341
+ StringBuilder ().apply {
342
+ options.processingOptions.toSortedMap().forEach {
343
+ append(" ${it.key} : ${it.value} \n " )
344
+ }
345
+ }.toString()
346
+ }
347
+
348
+ private val isProcessingOptionsChanged: Boolean by lazy {
349
+ if (processingOptionsFile.exists() && processingOptionsFile.isFile) {
350
+ val fileContents = processingOptionsFile.readText()
351
+ processingOptionsString == fileContents
352
+ } else {
353
+ true
354
+ }
355
+ }
356
+
339
357
// Beware: no side-effects here; Caches should only be touched in updateCaches.
340
358
fun calcDirtyFiles (): Collection <KSFile > {
341
359
if (! isIncremental) {
342
360
cleanIncrementalCache()
343
361
return ksFiles
344
362
}
345
363
364
+ if (isProcessingOptionsChanged)
365
+ rebuild = true
366
+
346
367
if (! rebuild) {
347
368
val dirtyFilesByDeps = calcDirtySetByDeps()
348
369
@@ -415,10 +436,16 @@ class IncrementalContext(
415
436
}
416
437
}
417
438
439
+ fun updateProcessingOptions () {
440
+ if (isProcessingOptionsChanged)
441
+ processingOptionsFile.writeText(processingOptionsString)
442
+ }
443
+
418
444
// TODO: Don't do anything if processing failed.
419
445
private fun updateCaches (dirtyFiles : Collection <File >, outputs : Set <File >, sourceToOutputs : Map <File , Set <File >>) {
420
446
updateSourceToOutputs(dirtyFiles, outputs, sourceToOutputs)
421
447
updateLookupCache(dirtyFiles)
448
+ updateProcessingOptions()
422
449
423
450
// Update symbolsMap
424
451
if (! rebuild) {
0 commit comments