2015-11-25 18:28:45 -05:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2016-01-18 18:20:33 -05:00
|
|
|
import org.elasticsearch.gradle.test.NodeInfo
|
2016-06-14 13:13:31 -04:00
|
|
|
import java.nio.charset.StandardCharsets
|
|
|
|
|
2016-03-24 04:02:41 -04:00
|
|
|
group 'org.elasticsearch.plugin'
|
|
|
|
|
2015-11-25 18:28:45 -05:00
|
|
|
apply plugin: 'elasticsearch.esplugin'
|
|
|
|
esplugin {
|
2016-03-30 03:07:57 -04:00
|
|
|
name 'x-pack'
|
2015-11-25 18:28:45 -05:00
|
|
|
description 'Elasticsearch Expanded Pack Plugin'
|
|
|
|
classname 'org.elasticsearch.xpack.XPackPlugin'
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.versions = [
|
2016-04-22 03:45:46 -04:00
|
|
|
okhttp: '2.7.5'
|
2015-11-25 18:28:45 -05:00
|
|
|
]
|
|
|
|
|
2015-12-01 14:16:29 -05:00
|
|
|
// TODO: fix this! https://github.com/elastic/x-plugins/issues/1066
|
|
|
|
ext.compactProfile = 'full'
|
|
|
|
|
2016-07-25 21:06:16 -04:00
|
|
|
dependencyLicenses.enabled = false
|
|
|
|
|
2016-07-25 20:09:54 -04:00
|
|
|
licenseHeaders {
|
|
|
|
approvedLicenses << 'BCrypt (BSD-like)'
|
|
|
|
additionalLicense 'BCRYP', 'BCrypt (BSD-like)', 'Copyright (c) 2006 Damien Miller <djm@mindrot.org>'
|
|
|
|
}
|
2015-12-03 11:16:41 -05:00
|
|
|
|
2015-11-25 18:28:45 -05:00
|
|
|
dependencies {
|
2016-06-17 11:53:55 -04:00
|
|
|
// security deps
|
2016-07-14 22:03:29 -04:00
|
|
|
compile project(path: ':modules:transport-netty3', configuration: 'runtime')
|
2015-11-25 18:28:45 -05:00
|
|
|
compile 'dk.brics.automaton:automaton:1.11-8'
|
2016-06-16 14:34:04 -04:00
|
|
|
compile 'com.unboundid:unboundid-ldapsdk:3.1.1'
|
2016-04-12 09:19:07 -04:00
|
|
|
compile 'org.bouncycastle:bcprov-jdk15on:1.54'
|
|
|
|
compile 'org.bouncycastle:bcpkix-jdk15on:1.54'
|
2016-06-27 05:07:15 -04:00
|
|
|
testCompile 'com.google.jimfs:jimfs:1.1'
|
2015-11-25 18:28:45 -05:00
|
|
|
|
|
|
|
// watcher deps
|
|
|
|
compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:r239'
|
2016-06-17 11:53:55 -04:00
|
|
|
compile 'com.google.guava:guava:16.0.1' // needed by watcher for the html sanitizer and security tests for jimfs
|
2015-11-25 18:28:45 -05:00
|
|
|
compile 'com.sun.mail:javax.mail:1.5.3'
|
2016-05-21 14:54:09 -04:00
|
|
|
// HACK: java 9 removed javax.activation from the default modules, so instead of trying to add modules, which would have
|
|
|
|
// to be conditionalized for java 8/9, we pull in the classes directly
|
|
|
|
compile 'javax.activation:activation:1.1'
|
|
|
|
|
2015-11-25 18:28:45 -05:00
|
|
|
testCompile 'org.subethamail:subethasmtp:3.1.7'
|
2016-04-22 03:45:46 -04:00
|
|
|
// needed for subethasmtp, has @GuardedBy annotation
|
|
|
|
testCompile 'com.google.code.findbugs:jsr305:3.0.1'
|
2015-11-25 18:28:45 -05:00
|
|
|
|
|
|
|
// common test deps
|
2015-12-10 15:26:05 -05:00
|
|
|
testCompile 'org.elasticsearch:securemock:1.2'
|
2015-11-25 18:28:45 -05:00
|
|
|
testCompile 'org.slf4j:slf4j-log4j12:1.6.2'
|
|
|
|
testCompile 'org.slf4j:slf4j-api:1.6.2'
|
|
|
|
|
|
|
|
// mock web server
|
|
|
|
testCompile "com.squareup.okhttp:mockwebserver:${versions.okhttp}"
|
|
|
|
testCompile "com.squareup.okhttp:okhttp:${versions.okhttp}"
|
|
|
|
testCompile "com.squareup.okhttp:okhttp-ws:${versions.okhttp}"
|
2016-04-22 03:45:46 -04:00
|
|
|
testCompile 'com.squareup.okio:okio:1.6.0'
|
2015-11-25 18:28:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// we keep the source directories in the original structure of split plugins,
|
|
|
|
// in order to facilitate backports to 2.x. TODO: remove after 5.0 release
|
2016-06-28 04:57:24 -04:00
|
|
|
for (String module : ['', 'license-plugin/', 'security/', 'watcher/', 'monitoring/', 'graph/']) {
|
2015-11-25 18:28:45 -05:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java.srcDir("${module}src/main/java")
|
|
|
|
resources.srcDir("${module}src/main/resources")
|
|
|
|
}
|
|
|
|
test {
|
|
|
|
java.srcDir("${module}src/test/java")
|
|
|
|
resources.srcDir("${module}src/test/resources")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-28 01:38:18 -04:00
|
|
|
// make LicenseSigner available for testing signed licenses
|
|
|
|
sourceSets.test.java {
|
|
|
|
srcDir '../license-tools/src/main/java'
|
|
|
|
}
|
|
|
|
|
2015-11-25 18:28:45 -05:00
|
|
|
compileJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked"
|
|
|
|
compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked"
|
|
|
|
|
|
|
|
ext.expansions = [
|
|
|
|
'project.version': version,
|
|
|
|
]
|
|
|
|
|
|
|
|
processResources {
|
2015-12-01 07:23:32 -05:00
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
|
|
exclude '**/public.key'
|
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
|
}
|
2015-11-25 18:28:45 -05:00
|
|
|
String licenseKeyName = System.getProperty('license.key', 'dev')
|
|
|
|
String licenseKeyPath = "license-plugin/keys/${licenseKeyName}/public.key"
|
|
|
|
if (file(licenseKeyPath).exists() == false) {
|
|
|
|
throw new GradleException("no public key found for '${licenseKeyName}'")
|
2015-12-17 17:01:32 -05:00
|
|
|
}
|
|
|
|
from licenseKeyPath
|
2015-11-25 18:28:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
processTestResources {
|
2015-11-26 11:05:19 -05:00
|
|
|
from(sourceSets.test.resources.srcDirs) {
|
|
|
|
exclude '**/*.key'
|
|
|
|
exclude '**/*.jks'
|
|
|
|
exclude '**/*.p12'
|
|
|
|
inputs.properties(expansions)
|
|
|
|
MavenFilteringHack.filter(it, expansions)
|
|
|
|
}
|
2015-11-25 18:28:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
forbiddenPatterns {
|
|
|
|
exclude '**/*.key'
|
|
|
|
exclude '**/*.p12'
|
2016-04-12 09:19:07 -04:00
|
|
|
exclude '**/*.der'
|
2015-11-25 18:28:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: standardize packaging config for plugins
|
|
|
|
bundlePlugin {
|
2016-07-25 08:02:39 -04:00
|
|
|
from(project(':x-plugins').projectDir) {
|
2015-11-25 18:28:45 -05:00
|
|
|
include 'LICENSE.txt'
|
2016-07-25 08:02:39 -04:00
|
|
|
}
|
|
|
|
from(projectDir) {
|
2015-11-25 18:28:45 -05:00
|
|
|
include 'NOTICE.txt'
|
|
|
|
}
|
2016-03-30 03:07:57 -04:00
|
|
|
from('bin/x-pack') {
|
2016-02-21 16:56:44 -05:00
|
|
|
into 'bin'
|
|
|
|
}
|
2016-06-17 11:53:55 -04:00
|
|
|
from('security/bin/x-pack') {
|
2015-11-25 18:28:45 -05:00
|
|
|
into 'bin'
|
|
|
|
}
|
2016-06-17 11:53:55 -04:00
|
|
|
from('security/config/x-pack') {
|
2015-11-25 18:28:45 -05:00
|
|
|
into 'config'
|
|
|
|
}
|
2016-03-30 03:07:57 -04:00
|
|
|
from('watcher/bin/x-pack') {
|
2015-11-25 18:28:45 -05:00
|
|
|
into 'bin'
|
|
|
|
}
|
2015-12-11 21:23:01 -05:00
|
|
|
}
|
2015-12-01 09:57:01 -05:00
|
|
|
|
2015-12-11 21:23:01 -05:00
|
|
|
integTest {
|
2015-12-11 21:24:27 -05:00
|
|
|
// TODO: fix this rest test to not depend on a hardcoded port!
|
2016-05-09 07:27:54 -04:00
|
|
|
systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*'
|
2015-12-11 21:23:01 -05:00
|
|
|
cluster {
|
2016-07-07 17:59:39 -04:00
|
|
|
setting 'xpack.monitoring.collection.interval', '3s'
|
2016-01-18 18:20:33 -05:00
|
|
|
waitCondition = { NodeInfo node, AntBuilder ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
2016-06-14 13:13:31 -04:00
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
// we use custom wait logic here as the elastic user is not available immediately and ant.get will fail when a 401 is returned
|
|
|
|
HttpURLConnection httpURLConnection = null;
|
|
|
|
try {
|
|
|
|
httpURLConnection = (HttpURLConnection) new URL("http://${node.httpUri()}").openConnection();
|
|
|
|
httpURLConnection.setRequestProperty("Authorization", "Basic " +
|
|
|
|
Base64.getEncoder().encodeToString("elastic:changeme".getBytes(StandardCharsets.UTF_8)));
|
|
|
|
httpURLConnection.setRequestMethod("GET");
|
|
|
|
httpURLConnection.connect();
|
|
|
|
if (httpURLConnection.getResponseCode() == 200) {
|
|
|
|
tmpFile.withWriter StandardCharsets.UTF_8.name(), {
|
|
|
|
it.write(httpURLConnection.getInputStream().getText(StandardCharsets.UTF_8.name()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace()
|
|
|
|
} finally {
|
|
|
|
if (httpURLConnection != null) {
|
|
|
|
httpURLConnection.disconnect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// did not start, so wait a bit before trying again
|
|
|
|
Thread.sleep(500L);
|
|
|
|
}
|
2016-01-18 18:20:33 -05:00
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
2015-12-01 09:57:01 -05:00
|
|
|
}
|
2015-11-25 18:28:45 -05:00
|
|
|
}
|
2015-12-01 14:16:29 -05:00
|
|
|
|
|
|
|
// TODO: don't publish test artifacts just to run messy tests, fix the tests!
|
|
|
|
// https://github.com/elastic/x-plugins/issues/724
|
|
|
|
configurations {
|
|
|
|
testArtifacts.extendsFrom testRuntime
|
|
|
|
}
|
|
|
|
task testJar(type: Jar) {
|
|
|
|
classifier "test"
|
|
|
|
from sourceSets.test.output
|
|
|
|
}
|
|
|
|
artifacts {
|
2016-04-13 11:38:23 -04:00
|
|
|
// normal es plugins do not publish the jar but we need to since users need it for Transport Clients and extensions
|
|
|
|
archives jar
|
2015-12-01 14:16:29 -05:00
|
|
|
testArtifacts testJar
|
|
|
|
}
|
2015-12-16 18:57:05 -05:00
|
|
|
|
2016-01-18 18:20:33 -05:00
|
|
|
run {
|
2016-02-10 09:42:59 -05:00
|
|
|
setupCommand 'setupDummyUser', 'bin/x-pack/users', 'useradd', 'test_user', '-p', 'changeme', '-r', 'superuser'
|
2016-01-18 18:20:33 -05:00
|
|
|
}
|
|
|
|
|
2015-12-16 18:57:05 -05:00
|
|
|
// classes are missing, e.g. com.ibm.icu.lang.UCharacter
|
|
|
|
thirdPartyAudit.excludes = [
|
|
|
|
// uses internal java api: sun.misc.Unsafe
|
|
|
|
'com.google.common.cache.Striped64',
|
|
|
|
'com.google.common.cache.Striped64$1',
|
|
|
|
'com.google.common.cache.Striped64$Cell',
|
|
|
|
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator',
|
|
|
|
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1',
|
2016-05-22 01:42:15 -04:00
|
|
|
|
|
|
|
// pulled in as external dependency to work on java 9
|
|
|
|
'com.sun.activation.registries.LineTokenizer',
|
|
|
|
'com.sun.activation.registries.LogSupport',
|
|
|
|
'com.sun.activation.registries.MailcapFile',
|
|
|
|
'com.sun.activation.registries.MailcapParseException',
|
|
|
|
'com.sun.activation.registries.MailcapTokenizer',
|
|
|
|
'com.sun.activation.registries.MimeTypeEntry',
|
|
|
|
'com.sun.activation.registries.MimeTypeFile',
|
|
|
|
'javax.activation.ActivationDataFlavor',
|
|
|
|
'javax.activation.CommandInfo',
|
|
|
|
'javax.activation.CommandMap',
|
|
|
|
'javax.activation.CommandObject',
|
|
|
|
'javax.activation.DataContentHandler',
|
|
|
|
'javax.activation.DataContentHandlerFactory',
|
|
|
|
'javax.activation.DataHandler$1',
|
|
|
|
'javax.activation.DataHandler',
|
|
|
|
'javax.activation.DataHandlerDataSource',
|
|
|
|
'javax.activation.DataSource',
|
|
|
|
'javax.activation.DataSourceDataContentHandler',
|
|
|
|
'javax.activation.FileDataSource',
|
|
|
|
'javax.activation.FileTypeMap',
|
|
|
|
'javax.activation.MailcapCommandMap',
|
|
|
|
'javax.activation.MimeType',
|
|
|
|
'javax.activation.MimeTypeParameterList',
|
|
|
|
'javax.activation.MimeTypeParseException',
|
|
|
|
'javax.activation.MimetypesFileTypeMap',
|
|
|
|
'javax.activation.ObjectDataContentHandler',
|
|
|
|
'javax.activation.SecuritySupport$1',
|
|
|
|
'javax.activation.SecuritySupport$2',
|
|
|
|
'javax.activation.SecuritySupport$3',
|
|
|
|
'javax.activation.SecuritySupport$4',
|
|
|
|
'javax.activation.SecuritySupport$5',
|
|
|
|
'javax.activation.SecuritySupport',
|
|
|
|
'javax.activation.URLDataSource',
|
|
|
|
'javax.activation.UnsupportedDataTypeException'
|
2015-12-16 18:57:05 -05:00
|
|
|
]
|