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

com.avito.android.ExportCodeOwnershipInfoTask.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

There is a newer version: 2024.32
Show newest version
package com.avito.android

import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.tasks.TaskAction
import java.io.File

public abstract class ExportCodeOwnershipInfoTask : DefaultTask() {

    @TaskAction
    public fun printOwnership() {
        val file = File(project.projectDir.toString(), "ownership.csv").apply {
            if (exists()) delete()
            createNewFile()
        }

        project.subprojects { subproject ->
            file.appendText(subproject.formatToCsvLine())
        }
    }

    private fun Project.formatToCsvLine(): String {
        val ownersCell = extensions.ownership.owners.joinToString(
            separator = ",",
            prefix = "\"",
            postfix = "\"",
            transform = { it.toString() }
        )
        return "$path,$ownersCell\n"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy