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

com.vgaidarji.dependencies.overview.writer.DependenciesWriter.kt Maven / Gradle / Ivy

Go to download

Generates project dependencies overview report (JSON, Markdown, etc.) from project dependencies

There is a newer version: 1.0.1
Show newest version
package com.vgaidarji.dependencies.overview.writer

import java.io.File

interface DependenciesWriter {
    /**
     * Writes given artifacts to file.
     */
    fun write(artifacts: T)

    /**
     * Writes given artifacts to file.
     */
    fun write(folder: String?, artifacts: T)

    /**
     * Writes given content to file.
     * @param fileName Destination file name (relative to the project)
     * @param content Content to be written in destination file
     */
    fun writeToFile(fileName: String, content: String) {
        writeToFile(null, fileName, content)
    }

    /**
     * Writes given content to file.
     * @param folder Destination folder. Pass null to create file in root folder.
     * @param fileName Destination file name
     * @param content Content to be written in destination file
     */
    fun writeToFile(folder: String?, fileName: String, content: String) {
        folder?.let { File(it).mkdirs() }
        File(folder, fileName).printWriter().use { out ->
            out.println(content)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy