2017-01-17 09:45:00 -05:00
description = 'Builds the Machine Learning Java classes and UI'
2016-09-16 12:30:45 -04:00
2016-10-31 09:05:32 -04:00
import org.gradle.plugins.ide.eclipse.model.SourceFolder
2016-11-17 09:07:20 -05:00
import org.elasticsearch.gradle.precommit.LicenseHeadersTask
2016-11-22 03:29:13 -05:00
import org.elasticsearch.gradle.VersionProperties
2017-01-20 10:11:21 -05: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 09:07:20 -05:00
2017-01-19 11:14:08 -05: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 11:18:29 -05:00
}
2017-01-19 11:14:08 -05: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 11:18:29 -05:00
}
2017-01-17 09:45:00 -05: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 12:42:11 -05:00
} else {
2017-01-17 09:45:00 -05:00
project . ext . cppLocalDists = ''
2017-01-13 12:42:11 -05:00
}
2016-12-02 08:12:57 -05:00
allprojects {
2017-01-10 08:40:16 -05:00
group = 'org.elasticsearch.ml'
2016-11-17 09:07:20 -05:00
}
2016-09-16 12:30:45 -04:00
2016-11-22 03:29:13 -05:00
task bundlePack ( type: Zip ) {
2016-12-01 10:48:51 -05:00
onlyIf { project ( 'kibana' ) . bundlePlugin . enabled }
2016-11-22 03:29:13 -05:00
dependsOn 'elasticsearch:bundlePlugin'
dependsOn 'kibana:bundlePlugin'
from { zipTree ( project ( 'elasticsearch' ) . bundlePlugin . outputs . files . singleFile ) }
from { zipTree ( project ( 'kibana' ) . bundlePlugin . outputs . files . singleFile ) }
destinationDir file ( 'build/distributions' )
2017-01-19 11:14:08 -05:00
baseName = 'ml'
2017-01-20 10:11:21 -05: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 03:29:13 -05:00
}
task assemble ( dependsOn: bundlePack ) {
group = 'Build'
description = 'Assembles the outputs of this project.'
}
2017-01-17 09:45:00 -05:00
task test ( dependsOn: [ ':elasticsearch:test' , ':kibana:test' ] ) {
2016-12-01 10:48:51 -05:00
group = 'Build'
description = 'Assembles and tests this project.'
}
2016-11-22 03:29:13 -05:00
task clean ( type: Delete ) {
group = 'Build'
description = 'Deletes the build directory'
delete 'build'
}
2016-09-16 12:30:45 -04:00
subprojects {
2017-01-20 10:11:21 -05: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 04:27:22 -05: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 10:22:55 -05:00
maven {
url "s3://prelert-artifacts/maven"
credentials ( AwsCredentials ) {
2017-01-19 11:14:08 -05:00
accessKey "${mlAwsAccessKey}"
secretKey "${mlAwsSecretKey}"
2017-01-19 10:22:55 -05:00
}
}
2016-11-07 04:27:22 -05:00
mavenCentral ( )
maven {
name 'sonatype-snapshots'
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
jcenter ( )
2016-09-16 12:30:45 -04:00
}
2016-10-31 09:05:32 -04:00
}