Plugins: Include license and notice files in zip (#23191)
This commit adds the elasticsearch LICENSE.txt to all plugins that released with elasticsearch, as well as a generated NOTICE.txt specific to the dependencies of each plugin.
This commit is contained in:
parent
ac3cc9641b
commit
6cdf4f3f72
|
@ -19,6 +19,7 @@
|
|||
package org.elasticsearch.gradle.plugin
|
||||
|
||||
import org.elasticsearch.gradle.BuildPlugin
|
||||
import org.elasticsearch.gradle.NoticeTask
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
import org.elasticsearch.gradle.test.RunTask
|
||||
import org.gradle.api.Project
|
||||
|
@ -71,6 +72,7 @@ public class PluginBuildPlugin extends BuildPlugin {
|
|||
project.integTest.clusterConfig.plugin(project.path)
|
||||
project.tasks.run.clusterConfig.plugin(project.path)
|
||||
addZipPomGeneration(project)
|
||||
addNoticeGeneration(project)
|
||||
}
|
||||
|
||||
project.namingConventions {
|
||||
|
@ -244,4 +246,23 @@ public class PluginBuildPlugin extends BuildPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addNoticeGeneration(Project project) {
|
||||
File licenseFile = project.pluginProperties.extension.licenseFile
|
||||
if (licenseFile != null) {
|
||||
project.bundlePlugin.into('/') {
|
||||
from(licenseFile.parentFile) {
|
||||
include(licenseFile.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
File noticeFile = project.pluginProperties.extension.licenseFile
|
||||
if (noticeFile != null) {
|
||||
NoticeTask generateNotice = project.tasks.create('generateNotice', NoticeTask.class)
|
||||
generateNotice.dependencies(project)
|
||||
project.bundlePlugin.into('/') {
|
||||
from(generateNotice)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,17 @@ class PluginPropertiesExtension {
|
|||
@Input
|
||||
boolean hasClientJar = false
|
||||
|
||||
/** A license file that should be included in the built plugin zip. */
|
||||
@Input
|
||||
File licenseFile = null
|
||||
|
||||
/**
|
||||
* A notice file that should be included in the built plugin zip. This will be
|
||||
* extended with notices from the {@code licenses/} directory.
|
||||
*/
|
||||
@Input
|
||||
File noticeFile = null
|
||||
|
||||
PluginPropertiesExtension(Project project) {
|
||||
name = project.name
|
||||
version = project.version
|
||||
|
|
|
@ -26,5 +26,8 @@ configure(subprojects.findAll { it.parent.path == project.path }) {
|
|||
esplugin {
|
||||
// for local ES plugins, the name of the plugin is the same as the directory
|
||||
name project.name
|
||||
|
||||
licenseFile rootProject.file('LICENSE.txt')
|
||||
noticeFile rootProject.file('NOTICE.txt')
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue