com.datadog.gradle.plugin.licenses.DependencyLicensesPlugin.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dependency-license Show documentation
Show all versions of dependency-license Show documentation
This plugin generates the OSS licenses csv file for all dependencies.
The newest version!
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2016-Present Datadog, Inc.
*/
package com.datadog.gradle.plugin.licenses
import com.datadog.gradle.plugin.licenses.tasks.CheckDependencyLicensesTask
import com.datadog.gradle.plugin.licenses.tasks.UpdateDependencyLicensesTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import java.io.File
/**
* Plugin generating and verifying the OSS licenses of the dependencies in a Gradle project.
*/
class DependencyLicensesPlugin : Plugin {
/**
* Apply this plugin to the given target object.
*
* @param target The target object
*/
override fun apply(target: Project) {
val extension = target.extensions
.create(EXT_NAME, DependencyLicensesExtension::class.java)
extension.csvFile = File(
target.rootDir,
DependencyLicensesExtension.DEFAULT_TP_LICENSE_FILENAME,
)
target.tasks
.register(TASK_UPDATE_NAME, UpdateDependencyLicensesTask::class.java) {
this.extension = extension
}
target.tasks
.register(TASK_CHECK_NAME, CheckDependencyLicensesTask::class.java) {
this.extension = extension
}
}
companion object {
internal const val EXT_NAME = "dependencyLicenses"
internal const val TASK_UPDATE_NAME = "updateDependencyLicenses"
internal const val TASK_CHECK_NAME = "checkDependencyLicenses"
}
}