Merge pull request elastic/elasticsearch#3635 from rjernst/reorg
Reorganize src roots Original commit: elastic/x-pack-elasticsearch@ac87e6c257
This commit is contained in:
commit
21522c8538
22
build.gradle
22
build.gradle
|
@ -1,4 +1,5 @@
|
|||
import org.elasticsearch.gradle.VersionProperties
|
||||
import org.elasticsearch.gradle.precommit.LicenseHeadersTask
|
||||
|
||||
if (project.projectDir.name != 'x-plugins') {
|
||||
throw new GradleException('You must checkout x-plugins in a directory named x-plugins next to elasticsearch')
|
||||
|
@ -15,9 +16,9 @@ subprojects {
|
|||
|
||||
task bundlePack(type: Zip) {
|
||||
onlyIf { project('kibana').bundlePlugin.enabled }
|
||||
dependsOn 'elasticsearch:x-pack:bundlePlugin'
|
||||
dependsOn 'elasticsearch:bundlePlugin'
|
||||
dependsOn 'kibana:bundlePlugin'
|
||||
from { zipTree(project('elasticsearch:x-pack').bundlePlugin.outputs.files.singleFile) }
|
||||
from { zipTree(project('elasticsearch').bundlePlugin.outputs.files.singleFile) }
|
||||
from { zipTree(project('kibana').bundlePlugin.outputs.files.singleFile) }
|
||||
destinationDir file('build/distributions')
|
||||
baseName = 'x-pack'
|
||||
|
@ -39,3 +40,20 @@ task clean(type: Delete) {
|
|||
description = 'Deletes the build directory'
|
||||
delete 'build'
|
||||
}
|
||||
|
||||
File checkstyleSuppressions = file('dev-tools/checkstyle_suppressions.xml')
|
||||
subprojects {
|
||||
tasks.withType(Checkstyle) {
|
||||
inputs.file(checkstyleSuppressions)
|
||||
// Use x-pack specific suppressions file rather than the open source one.
|
||||
configProperties = [
|
||||
suppressions: checkstyleSuppressions
|
||||
]
|
||||
}
|
||||
|
||||
tasks.withType(LicenseHeadersTask.class) {
|
||||
approvedLicenses = ['Elasticsearch Confidential']
|
||||
additionalLicense 'ESCON', 'Elasticsearch Confidential', 'ELASTICSEARCH CONFIDENTIAL'
|
||||
}
|
||||
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-api:${version}": ':x-plugins:elasticsearch' ]
|
||||
}
|
||||
|
|
|
@ -1,18 +1,251 @@
|
|||
import org.elasticsearch.gradle.precommit.LicenseHeadersTask
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.StandardCopyOption
|
||||
import org.elasticsearch.gradle.MavenFilteringHack
|
||||
import org.elasticsearch.gradle.test.NodeInfo
|
||||
|
||||
File checkstyleSuppressions = file('checkstyle_suppressions.xml')
|
||||
subprojects {
|
||||
tasks.withType(Checkstyle) {
|
||||
inputs.file(checkstyleSuppressions)
|
||||
// Use x-pack specific suppressions file rather than the open source one.
|
||||
configProperties = [
|
||||
suppressions: checkstyleSuppressions
|
||||
group 'org.elasticsearch.plugin'
|
||||
|
||||
apply plugin: 'elasticsearch.esplugin'
|
||||
esplugin {
|
||||
name 'x-pack'
|
||||
description 'Elasticsearch Expanded Pack Plugin'
|
||||
classname 'org.elasticsearch.xpack.XPackPlugin'
|
||||
}
|
||||
|
||||
ext.versions = [
|
||||
okhttp: '2.7.5'
|
||||
]
|
||||
|
||||
// TODO: fix this! https://github.com/elastic/x-plugins/issues/1066
|
||||
ext.compactProfile = 'full'
|
||||
|
||||
dependencyLicenses.enabled = false
|
||||
|
||||
licenseHeaders {
|
||||
approvedLicenses << 'BCrypt (BSD-like)'
|
||||
additionalLicense 'BCRYP', 'BCrypt (BSD-like)', 'Copyright (c) 2006 Damien Miller <djm@mindrot.org>'
|
||||
}
|
||||
|
||||
tasks.withType(LicenseHeadersTask.class) {
|
||||
approvedLicenses = ['Elasticsearch Confidential']
|
||||
additionalLicense 'ESCON', 'Elasticsearch Confidential', 'ELASTICSEARCH CONFIDENTIAL'
|
||||
dependencies {
|
||||
// security deps
|
||||
compile project(path: ':modules:transport-netty3', configuration: 'runtime')
|
||||
compile project(path: ':modules:transport-netty4', configuration: 'runtime')
|
||||
compile 'dk.brics.automaton:automaton:1.11-8'
|
||||
compile 'com.unboundid:unboundid-ldapsdk:3.1.1'
|
||||
compile 'org.bouncycastle:bcprov-jdk15on:1.55'
|
||||
compile 'org.bouncycastle:bcpkix-jdk15on:1.55'
|
||||
testCompile 'com.google.jimfs:jimfs:1.1'
|
||||
|
||||
// watcher deps
|
||||
compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:r239'
|
||||
compile 'com.google.guava:guava:16.0.1' // needed by watcher for the html sanitizer and security tests for jimfs
|
||||
compile 'com.sun.mail:javax.mail:1.5.3'
|
||||
// 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'
|
||||
|
||||
testCompile 'org.subethamail:subethasmtp:3.1.7'
|
||||
// needed for subethasmtp, has @GuardedBy annotation
|
||||
testCompile 'com.google.code.findbugs:jsr305:3.0.1'
|
||||
|
||||
// monitoring deps
|
||||
compile "org.elasticsearch.client:rest:${version}"
|
||||
compile "org.elasticsearch.client:sniffer:${version}"
|
||||
|
||||
// common test deps
|
||||
testCompile 'org.elasticsearch:securemock:1.2'
|
||||
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}"
|
||||
testCompile 'com.squareup.okio:okio:1.6.0'
|
||||
}
|
||||
ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-api:${version}": ':x-plugins:elasticsearch:x-pack' ]
|
||||
|
||||
// make LicenseSigner available for testing signed licenses
|
||||
sourceSets.test.java {
|
||||
srcDir '../license-tools/src/main/java'
|
||||
}
|
||||
|
||||
compileJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked"
|
||||
compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked"
|
||||
|
||||
ext.expansions = [
|
||||
'project.version': version,
|
||||
]
|
||||
|
||||
processResources {
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude '**/public.key'
|
||||
inputs.properties(expansions)
|
||||
MavenFilteringHack.filter(it, expansions)
|
||||
}
|
||||
boolean snapshot = "true".equals(System.getProperty("build.snapshot", "true"))
|
||||
if (snapshot) {
|
||||
from 'keys/dev/public.key'
|
||||
} else {
|
||||
from 'keys/prod/public.key'
|
||||
}
|
||||
}
|
||||
|
||||
forbiddenPatterns {
|
||||
exclude '**/*.key'
|
||||
exclude '**/*.p12'
|
||||
exclude '**/*.der'
|
||||
exclude '**/*.zip'
|
||||
}
|
||||
|
||||
// TODO: standardize packaging config for plugins
|
||||
bundlePlugin {
|
||||
from(project(':x-plugins').projectDir) {
|
||||
include 'LICENSE.txt'
|
||||
}
|
||||
from(projectDir) {
|
||||
include 'NOTICE.txt'
|
||||
}
|
||||
from('bin/x-pack') {
|
||||
into 'bin'
|
||||
}
|
||||
from('config/x-pack') {
|
||||
into 'config'
|
||||
}
|
||||
}
|
||||
|
||||
// add api jar for extension authors to compile against
|
||||
// note this is just the normal x-pack jar for now, with a different name
|
||||
project.afterEvaluate {
|
||||
task apiJar {
|
||||
dependsOn('generatePomFileForApijarPublication', project.jar)
|
||||
doFirst {
|
||||
Path jarFile = project.jar.outputs.files.singleFile.toPath()
|
||||
String apiFileName = jarFile.fileName.toString().replace(project.version, "api-${project.version}")
|
||||
Files.copy(jarFile, jarFile.resolveSibling(apiFileName), StandardCopyOption.REPLACE_EXISTING)
|
||||
|
||||
/*String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom')
|
||||
String apiPomFileName = apiFileName.replace('.jar', '.pom')
|
||||
Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(apiPomFileName),
|
||||
StandardCopyOption.REPLACE_EXISTING)
|
||||
*/
|
||||
}
|
||||
}
|
||||
assemble.dependsOn(apiJar)
|
||||
project.publishing {
|
||||
publications {
|
||||
apijar(MavenPublication) {
|
||||
from project.components.java
|
||||
artifactId = 'x-pack-api'
|
||||
pom.withXml { XmlProvider xml ->
|
||||
Node root = xml.asNode()
|
||||
root.appendNode('name', project.pluginProperties.extension.name)
|
||||
root.appendNode('description', project.pluginProperties.extension.description)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
integTest {
|
||||
// TODO: fix this rest test to not depend on a hardcoded port!
|
||||
systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*'
|
||||
cluster {
|
||||
setting 'xpack.monitoring.collection.interval', '3s'
|
||||
waitCondition = { NodeInfo node, AntBuilder ant ->
|
||||
File tmpFile = new File(node.cwd, 'wait.success')
|
||||
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()}/_cluster/health?wait_for_nodes=${numNodes}").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) {
|
||||
if (i == 9) {
|
||||
logger.error("final attempt of calling cluster health failed", e)
|
||||
} else {
|
||||
logger.debug("failed to call cluster health", e)
|
||||
}
|
||||
} finally {
|
||||
if (httpURLConnection != null) {
|
||||
httpURLConnection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
// did not start, so wait a bit before trying again
|
||||
Thread.sleep(500L);
|
||||
}
|
||||
return tmpFile.exists()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// normal es plugins do not publish the jar but we need to since users need it for Transport Clients and extensions
|
||||
archives jar
|
||||
testArtifacts testJar
|
||||
}
|
||||
|
||||
// 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',
|
||||
|
||||
// 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'
|
||||
]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue