2017-08-24 22:47:10 -07:00
import org.elasticsearch.gradle.BuildPlugin
2018-01-26 21:48:30 -08:00
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
2017-11-21 08:45:10 +00:00
import org.elasticsearch.gradle.Version
2016-09-29 12:03:14 +02:00
import org.elasticsearch.gradle.precommit.LicenseHeadersTask
2016-04-25 16:21:05 -07:00
2017-02-10 11:02:42 -08:00
if ( project . projectDir . name ! = 'x-pack-elasticsearch' ) {
2017-02-14 17:16:18 -05:00
throw new GradleException ( 'You must checkout x-pack-elasticsearch in the following directory: <path to Elasticsearch checkout>/../elasticsearch-extra/x-pack-elasticsearch' )
2015-11-16 12:45:03 -08:00
}
2018-01-04 16:42:12 -05:00
task wrapper ( type: Wrapper )
2018-01-26 21:48:30 -08:00
Project xpackRootProject = project
2016-02-04 13:07:01 -08:00
subprojects {
2017-12-12 13:23:29 -07:00
group = 'org.elasticsearch.plugin'
2018-01-26 21:48:30 -08:00
ext . xpackRootProject = xpackRootProject
ext . xpackProject = { String projectName - > xpackRootProject . project ( projectName ) }
// helper method to find the path to a module
ext . xpackModule = { String moduleName - > xpackProject ( "plugin:${moduleName}" ) . path }
2017-12-12 13:23:29 -07:00
2016-11-24 00:05:15 -08:00
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' )
}
}
}
2016-02-04 13:21:18 -08:00
}
2016-02-04 13:07:01 -08:00
}
2017-08-24 22:47:10 -07:00
plugins . withType ( BuildPlugin ) . whenPluginAdded {
2018-01-26 21:48:30 -08:00
project . licenseFile = xpackRootProject . file ( 'LICENSE.txt' )
project . noticeFile = xpackRootProject . file ( 'NOTICE.txt' )
}
plugins . withType ( PluginBuildPlugin ) . whenPluginAdded {
project . esplugin . licenseFile = xpackRootProject . file ( 'LICENSE.txt' )
project . esplugin . noticeFile = xpackRootProject . file ( 'NOTICE.txt' )
2017-08-24 22:47:10 -07:00
}
2016-02-04 13:07:01 -08:00
}
2016-09-29 12:03:14 +02:00
File checkstyleSuppressions = file ( 'dev-tools/checkstyle_suppressions.xml' )
subprojects {
tasks . withType ( Checkstyle ) {
inputs . file ( checkstyleSuppressions )
2017-02-10 11:02:42 -08:00
// Use x-pack-elasticsearch specific suppressions file rather than the open source one.
2016-09-29 12:03:14 +02:00
configProperties = [
suppressions: checkstyleSuppressions
]
}
tasks . withType ( LicenseHeadersTask . class ) {
2017-12-13 10:19:31 -05:00
approvedLicenses = [ 'Elasticsearch Confidential' , 'Generated' ]
2016-09-29 12:03:14 +02:00
additionalLicense 'ESCON' , 'Elasticsearch Confidential' , 'ELASTICSEARCH CONFIDENTIAL'
}
2018-01-26 21:48:30 -08:00
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-core:${version}" : xpackModule ( 'core' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-deprecation:${version}" : xpackModule ( 'deprecation' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-graph:${version}" : xpackModule ( 'graph' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-logstash:${version}" : xpackModule ( 'logstash' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-ml:${version}" : xpackModule ( 'ml' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-monitoring:${version}" : xpackModule ( 'monitoring' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-security:${version}" : xpackModule ( 'security' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-upgrade:${version}" : xpackModule ( 'upgrade' ) ]
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:x-pack-watcher:${version}" : xpackModule ( 'watcher' ) ]
2017-05-30 09:04:27 -04:00
2018-02-09 15:03:08 -06:00
bwcVersions . snapshotProjectNames . each { snapshotName - >
Version snapshot = bwcVersions . getSnapshotForProject ( snapshotName )
2018-02-10 09:52:36 -06:00
if ( snapshot ! = null & & snapshot . onOrAfter ( "6.3.0" ) ) {
2018-02-09 15:03:08 -06:00
String snapshotProject = ":x-pack-elasticsearch:plugin:bwc:${snapshotName}"
project ( snapshotProject ) . ext . bwcVersion = snapshot
ext . projectSubstitutions [ "org.elasticsearch.plugin:x-pack:${snapshot}" ] = snapshotProject
2017-05-30 09:04:27 -04:00
}
2017-05-18 10:33:53 -07:00
}
2016-09-29 12:03:14 +02:00
}