OpenSearch/build.gradle

75 lines
3.6 KiB
Groovy

import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.precommit.LicenseHeadersTask
if (project.projectDir.name != 'x-pack-elasticsearch') {
throw new GradleException('You must checkout x-pack-elasticsearch in the following directory: <path to Elasticsearch checkout>/../elasticsearch-extra/x-pack-elasticsearch')
}
task wrapper(type: Wrapper)
subprojects {
group = 'org.elasticsearch.plugin'
plugins.withType(MavenPublishPlugin).whenPluginAdded {
publishing {
publications {
// add license information to generated poms
all {
pom.withXml { XmlProvider xml ->
Node node = xml.asNode()
Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', 'Elastic Commercial Software End User License Agreement')
license.appendNode('url', 'https://www.elastic.co/eula/')
license.appendNode('distribution', 'repo')
Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'Elastic')
developer.appendNode('url', 'http://www.elastic.co')
}
}
}
}
}
plugins.withType(BuildPlugin).whenPluginAdded {
project.licenseFile = project(':x-pack-elasticsearch').file('LICENSE.txt')
project.noticeFile = project(':x-pack-elasticsearch').file('NOTICE.txt')
}
}
File checkstyleSuppressions = file('dev-tools/checkstyle_suppressions.xml')
subprojects {
tasks.withType(Checkstyle) {
inputs.file(checkstyleSuppressions)
// Use x-pack-elasticsearch specific suppressions file rather than the open source one.
configProperties = [
suppressions: checkstyleSuppressions
]
}
tasks.withType(LicenseHeadersTask.class) {
approvedLicenses = ['Elasticsearch Confidential', 'Generated']
additionalLicense 'ESCON', 'Elasticsearch Confidential', 'ELASTICSEARCH CONFIDENTIAL'
}
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-api:${version}": ':x-pack-elasticsearch:plugin:core']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-core:${version}": ':x-pack-elasticsearch:plugin:core']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-deprecation:${version}": ':x-pack-elasticsearch:plugin:deprecation']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-graph:${version}": ':x-pack-elasticsearch:plugin:graph']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-logstash:${version}": ':x-pack-elasticsearch:plugin:logstash']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-ml:${version}": ':x-pack-elasticsearch:plugin:ml']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-monitoring:${version}": ':x-pack-elasticsearch:plugin:monitoring']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-security:${version}": ':x-pack-elasticsearch:plugin:security']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-upgrade:${version}": ':x-pack-elasticsearch:plugin:upgrade']
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-watcher:${version}": ':x-pack-elasticsearch:plugin:watcher']
for (final Version version : versionCollection.versionsIndexCompatibleWithCurrent) {
if (version.branch != null) {
final String snapshotProject = ":x-pack-elasticsearch:plugin:bwc-snapshot-dummy-projects:bwc-snapshot-${version.branch}"
project(snapshotProject).ext.bwcVersion = version
ext.projectSubstitutions["org.elasticsearch.plugin:x-pack:${version}"] = snapshotProject
}
}
}