2017-01-17 14:45:00 +00:00
description = 'Builds the Machine Learning Java classes and UI'
2016-09-16 17:30:45 +01:00
2016-10-31 13:05:32 +00:00
import org.gradle.plugins.ide.eclipse.model.SourceFolder
2016-11-17 14:07:20 +00:00
import org.elasticsearch.gradle.precommit.LicenseHeadersTask
2016-11-22 08:29:13 +00:00
import org.elasticsearch.gradle.VersionProperties
2017-01-20 15:11:21 +00:00
if ( project . projectDir . name ! = 'prelert-legacy' ) {
throw new GradleException ( 'You must checkout prelert-legacy in the following directory: <path to Elasticsearch checkout>/../elasticsearch-extra/prelert-legacy' )
}
2016-11-17 14:07:20 +00:00
2017-01-19 16:14:08 +00:00
String mlAwsAccessKey = System . env . PRELERT_AWS_ACCESS_KEY_ID
if ( mlAwsAccessKey = = null & & project . hasProperty ( "PRELERT_AWS_ACCESS_KEY_ID" ) ) {
mlAwsAccessKey = PRELERT_AWS_ACCESS_KEY_ID
2016-12-01 16:18:29 +00:00
}
2017-01-19 16:14:08 +00:00
String mlAwsSecretKey = System . env . PRELERT_AWS_SECRET_ACCESS_KEY
if ( mlAwsSecretKey = = null & & project . hasProperty ( "PRELERT_AWS_SECRET_ACCESS_KEY" ) ) {
mlAwsSecretKey = PRELERT_AWS_SECRET_ACCESS_KEY
2016-12-01 16:18:29 +00:00
}
2017-01-17 14:45:00 +00:00
String envCppLocalDists = System . env . CPP_LOCAL_DISTS
if ( envCppLocalDists ! = null ) {
project . ext . cppLocalDists = envCppLocalDists
} else if ( project . hasProperty ( "CPP_LOCAL_DISTS" ) ) {
project . ext . cppLocalDists = CPP_LOCAL_DISTS
2017-01-13 17:42:11 +00:00
} else {
2017-01-17 14:45:00 +00:00
project . ext . cppLocalDists = ''
2017-01-13 17:42:11 +00:00
}
2016-12-02 13:12:57 +00:00
allprojects {
2017-01-10 13:40:16 +00:00
group = 'org.elasticsearch.ml'
2016-11-17 14:07:20 +00:00
}
2016-09-16 17:30:45 +01:00
2016-11-22 08:29:13 +00:00
task bundlePack ( type: Zip ) {
2017-01-23 14:09:22 +00:00
onlyIf { project ( ':prelert-legacy:kibana' ) . bundlePlugin . enabled }
dependsOn ':prelert-legacy:elasticsearch:bundlePlugin'
dependsOn ':prelert-legacy:kibana:bundlePlugin'
from { zipTree ( project ( ':prelert-legacy:elasticsearch' ) . bundlePlugin . outputs . files . singleFile ) }
from { zipTree ( project ( ':prelert-legacy:kibana' ) . bundlePlugin . outputs . files . singleFile ) }
2016-11-22 08:29:13 +00:00
destinationDir file ( 'build/distributions' )
2017-01-19 16:14:08 +00:00
baseName = 'ml'
2017-01-20 15:11:21 +00:00
version = VersionProperties . elasticsearch
}
subprojects {
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-11-22 08:29:13 +00:00
}
task assemble ( dependsOn: bundlePack ) {
group = 'Build'
description = 'Assembles the outputs of this project.'
}
2017-01-23 14:09:22 +00:00
task test ( dependsOn: [ ':prelert-legacy:elasticsearch:test' , ':prelert-legacy:kibana:test' ] ) {
2016-12-01 15:48:51 +00:00
group = 'Build'
description = 'Assembles and tests this project.'
}
2016-11-22 08:29:13 +00:00
task clean ( type: Delete ) {
group = 'Build'
description = 'Deletes the build directory'
delete 'build'
}
2016-09-16 17:30:45 +01:00
subprojects {
2017-01-20 15:11:21 +00:00
tasks . withType ( LicenseHeadersTask . class ) {
approvedLicenses = [ 'Elasticsearch Confidential' ]
additionalLicense 'ESCON' , 'Elasticsearch Confidential' , 'ELASTICSEARCH CONFIDENTIAL'
}
ext . projectSubstitutions + = [ "org.elasticsearch.plugin:ml-api:${version}" : ':prelert-legacy:elasticsearch' ]
}
allprojects {
repositories {
2016-11-07 09:27:22 +00:00
if ( System . getProperty ( "repos.mavenlocal" ) ! = null ) {
// with -Drepos.mavenlocal=true we can force checking the local .m2 repo which is useful for building against
// elasticsearch snapshots
mavenLocal ( )
}
2017-01-19 15:22:55 +00:00
maven {
url "s3://prelert-artifacts/maven"
credentials ( AwsCredentials ) {
2017-01-19 16:14:08 +00:00
accessKey "${mlAwsAccessKey}"
secretKey "${mlAwsSecretKey}"
2017-01-19 15:22:55 +00:00
}
}
2016-11-07 09:27:22 +00:00
mavenCentral ( )
maven {
name 'sonatype-snapshots'
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
jcenter ( )
2016-09-16 17:30:45 +01:00
}
2016-10-31 13:05:32 +00:00
}