All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avito.android.diff.report.file.FileOwnersDiffReporter.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

The newest version!
package com.avito.android.diff.report.file

import com.avito.android.diff.formatter.OwnersDiffMessageFormatter
import com.avito.android.diff.model.OwnersDiff
import com.avito.android.diff.report.OwnersDiffReporter
import java.io.File

public class FileOwnersDiffReporter(
    private val parentDir: File,
    private val messageFormatter: OwnersDiffMessageFormatter
) : OwnersDiffReporter {

    override fun reportDiffFound(diffs: OwnersDiff) {
        if (diffs.isEmpty()) return
        val file = File(parentDir, "ownership_diff_report.txt").apply {
            if (exists()) delete()
            createNewFile()
        }
        val formattedOwners = messageFormatter.formatDiffMessage(diffs)
        file.appendText(formattedOwners)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy