description = 'Builds the Machine Learning Java classes and UI' import org.gradle.plugins.ide.eclipse.model.SourceFolder import org.elasticsearch.gradle.precommit.LicenseHeadersTask import org.elasticsearch.gradle.VersionProperties if (project.projectDir.name != 'prelert-legacy') { throw new GradleException('You must checkout prelert-legacy in the following directory: /../elasticsearch-extra/prelert-legacy') } 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 } 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 } 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 } else { project.ext.cppLocalDists = '' } allprojects { group = 'org.elasticsearch.ml' } task bundlePack(type: Zip) { onlyIf { project('kibana').bundlePlugin.enabled } 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') baseName = 'ml' 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') } } } } } } task assemble(dependsOn: bundlePack) { group = 'Build' description = 'Assembles the outputs of this project.' } task test(dependsOn: [':elasticsearch:test', ':kibana:test']) { group = 'Build' description = 'Assembles and tests this project.' } task clean(type: Delete) { group = 'Build' description = 'Deletes the build directory' delete 'build' } subprojects { 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 { 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() } maven { url "s3://prelert-artifacts/maven" credentials(AwsCredentials) { accessKey "${mlAwsAccessKey}" secretKey "${mlAwsSecretKey}" } } mavenCentral() maven { name 'sonatype-snapshots' url "https://oss.sonatype.org/content/repositories/snapshots/" } jcenter() } }