@@ -166,6 +166,9 @@ class IncrementalContext(
166
166
167
167
private val baseDir = options.projectBaseDir
168
168
169
+ private val logsDir = File (baseDir, " build" ).apply { mkdir() }
170
+ private val buildTime = Date ().time
171
+
169
172
private val modified = options.knownModified.map{ it.relativeTo(baseDir) }.toSet()
170
173
private val removed = options.knownRemoved.map { it.relativeTo(baseDir) }.toSet()
171
174
@@ -262,17 +265,15 @@ class IncrementalContext(
262
265
if (! options.incrementalLog)
263
266
return
264
267
265
- val logFile = File (options.projectBaseDir, " build/kspDirtySetByDeps.log" )
266
- logFile.appendText(" All Files\n " )
267
- ksFiles.forEach { logFile.appendText(" ${it.relativeFile} \n " ) }
268
+ val logFile = File (logsDir, " kspDirtySetByDeps.log" )
269
+ logFile.appendText(" === Build $buildTime ===\n " )
268
270
logFile.appendText(" Modified\n " )
269
- options.knownModified .forEach { logFile.appendText(" $it \n " ) }
271
+ modified .forEach { logFile.appendText(" $it \n " ) }
270
272
logFile.appendText(" Removed\n " )
271
- options.knownRemoved .forEach { logFile.appendText(" $it \n " ) }
273
+ removed .forEach { logFile.appendText(" $it \n " ) }
272
274
logFile.appendText(" Dirty\n " )
273
275
dirtyFiles.forEach { logFile.appendText(" ${it} \n " ) }
274
- val percentage = " %.2f" .format(dirtyFiles.size.toDouble() / ksFiles.size.toDouble() * 100 )
275
- logFile.appendText(" \n Dirty / All: $percentage %\n\n " )
276
+ logFile.appendText(" \n " )
276
277
}
277
278
278
279
fun logDirtyFilesByOutputs (dirtyFiles : Collection <File >) {
@@ -289,7 +290,8 @@ class IncrementalContext(
289
290
}
290
291
val outputsToRemove = allOutputs - validOutputs
291
292
292
- val logFile = File (options.projectBaseDir, " build/kspDirtySetByOutputs.log" )
293
+ val logFile = File (logsDir, " kspDirtySetByOutputs.log" )
294
+ logFile.appendText(" === Build $buildTime ===\n " )
293
295
logFile.appendText(" Dirty sources\n " )
294
296
dirtyFiles.forEach { logFile.appendText(" $it \n " ) }
295
297
logFile.appendText(" Outputs to remove\n " )
@@ -301,7 +303,8 @@ class IncrementalContext(
301
303
if (! options.incrementalLog)
302
304
return
303
305
304
- val logFile = File (options.projectBaseDir, " build/kspSourceToOutputs.log" )
306
+ val logFile = File (logsDir, " kspSourceToOutputs.log" )
307
+ logFile.appendText(" === Build $buildTime ===\n " )
305
308
logFile.appendText(" All outputs\n " )
306
309
sourceToOutputsMap.keys.forEach { source ->
307
310
logFile.appendText(" $source :\n " )
@@ -316,12 +319,16 @@ class IncrementalContext(
316
319
if (! options.incrementalLog)
317
320
return
318
321
319
- val logFile = File (options.projectBaseDir, " build/kspDirtySet.log" )
322
+ val logFile = File (logsDir, " kspDirtySet.log" )
323
+ logFile.appendText(" === Build $buildTime ===\n " )
324
+ logFile.appendText(" All Files\n " )
325
+ ksFiles.forEach { logFile.appendText(" ${it.relativeFile} \n " ) }
320
326
logFile.appendText(" Dirty:\n " )
321
327
files.forEach {
322
328
logFile.appendText(" ${it.relativeFile} \n " )
323
329
}
324
- logFile.appendText(" \n " )
330
+ val percentage = " %.2f" .format(files.size.toDouble() / ksFiles.size.toDouble() * 100 )
331
+ logFile.appendText(" \n Dirty / All: $percentage %\n\n " )
325
332
}
326
333
327
334
// Beware: no side-effects here; Caches should only be touched in updateCaches.
0 commit comments