com.vgaidarji.dependencies.overview.DependenciesOverviewTask.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dependencies-overview Show documentation
Show all versions of dependencies-overview Show documentation
Generates project dependencies overview report (JSON, Markdown, etc.) from project dependencies
package com.vgaidarji.dependencies.overview
import com.vgaidarji.dependencies.overview.writer.DependenciesWriter
import com.vgaidarji.dependencies.overview.writer.JsonWriter
import com.vgaidarji.dependencies.overview.writer.MarkdownWriter
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
open class DependenciesOverviewTask : DefaultTask() {
var writers: List>
var artifactsResolver: ArtifactsResolver
init {
description = "Generates project dependencies overview table from project dependencies"
group = "documentation"
artifactsResolver = ArtifactsResolver(project)
writers = listOf(JsonWriter(), MarkdownWriter())
}
@TaskAction
fun generate() {
val extension = project.extensions.getByName(DependenciesOverviewPlugin.EXTENSION)
as DependenciesOverviewExtension
if (extension.output.json) {
(writers.find { it is JsonWriter } as JsonWriter)
.write(extension.output.folder, artifactsResolver.resolve())
}
if (extension.output.markdown) {
(writers.find { it is MarkdownWriter } as MarkdownWriter)
.write(extension.output.folder, artifactsResolver.resolve())
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy