Repository: JetBrains/kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt (Kotlin)

Code before:
    @get:PathSensitive(PathSensitivity.RELATIVE)
    val r8Outputs: FileCollection = objects.fileCollection()
        .from(originalFile.asFile.map { it.parentFile })
        .asFileTree

    @get:InputFile
    @get:PathSensitive(PathSensitivity.RELATIVE)
    abstract val composeMapping: RegularFileProperty

    @get:OutputFile
    abstract val output: RegularFileProperty

    @get:OutputDirectory
    val outputDir: Provider<File> = providers.provider { output.get().asFile.parentFile }

    @TaskAction
    fun taskAction() {
        /*
         * Read the proguard file generated by R8, calculate the new SHA-256 hash for the header, and append Compose mapping.
         */
        val newHeader = buildHeader()

        val originalFile = originalFile.get().asFile

        val outputFile = output.get().asFile
        val outputDir = outputDir.get()

        outputFile.bufferedWriter().use { writer ->
            writer.append(newHeader)

            var skippingHeader = true
            originalFile.forEachLine {
                if (skippingHeader && it.startsWith("#")) {
                    return@forEachLine
                }
                skippingHeader = false

                writer.appendLine(it)
            }

            val composeMapping = composeMapping.get().asFile
            composeMapping.forEachLine {
                writer.appendLine(it)
            }
        }

        r8Outputs.forEach {
            if (it == originalFile) return@forEach
            it.copyTo(File(outputDir, it.name), overwrite = true)
        }
    }

Review comment (suggestion):
```suggestion
        val outputDir = outputDir.get().asFile
```

Code after:
    @get:PathSensitive(PathSensitivity.RELATIVE)
    val r8Outputs: FileCollection = objects.fileCollection()
        .from(originalFile.asFile.map { it.parentFile })
        .asFileTree

    @get:InputFile
    @get:PathSensitive(PathSensitivity.RELATIVE)
    abstract val composeMapping: RegularFileProperty

    @get:OutputFile
    abstract val output: RegularFileProperty

    @get:OutputDirectory
    val outputDir: Provider<File> = providers.provider { output.get().asFile.parentFile }

    @TaskAction
    fun taskAction() {
        /*
         * Read the proguard file generated by R8, calculate the new SHA-256 hash for the header, and append Compose mapping.
         */
        val newHeader = buildHeader()

        val originalFile = originalFile.get().asFile

        val outputFile = output.get().asFile
        val outputDir = outputDir.get()

        outputDir.deleteRecursively()
        outputDir.mkdirs()

        outputFile.bufferedWriter().use { writer ->
            writer.append(newHeader)

            var skippingHeader = true
            originalFile.forEachLine {
                if (skippingHeader && it.startsWith("#")) {
                    return@forEachLine
                }
                skippingHeader = false

                writer.appendLine(it)
            }

            val composeMapping = composeMapping.get().asFile
            composeMapping.forEachLine {
                writer.appendLine(it)
            }
        }

        r8Outputs.forEach {
            if (it == originalFile) return@forEach