build.gradle 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*
  2. * Licensed to Elasticsearch under one or more contributor
  3. * license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright
  5. * ownership. Elasticsearch licenses this file to you under
  6. * the Apache License, Version 2.0 (the "License"); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. import com.carrotsearch.gradle.junit4.RandomizedTestingTask
  20. import org.elasticsearch.gradle.BuildPlugin
  21. apply plugin: 'elasticsearch.build'
  22. apply plugin: 'com.bmuschko.nexus'
  23. apply plugin: 'nebula.optional-base'
  24. apply plugin: 'nebula.maven-base-publish'
  25. apply plugin: 'nebula.maven-scm'
  26. publishing {
  27. publications {
  28. nebula {
  29. artifactId 'elasticsearch'
  30. }
  31. }
  32. }
  33. archivesBaseName = 'elasticsearch'
  34. dependencies {
  35. // lucene
  36. compile "org.apache.lucene:lucene-core:${versions.lucene}"
  37. compile "org.apache.lucene:lucene-analyzers-common:${versions.lucene}"
  38. compile "org.apache.lucene:lucene-backward-codecs:${versions.lucene}"
  39. compile "org.apache.lucene:lucene-grouping:${versions.lucene}"
  40. compile "org.apache.lucene:lucene-highlighter:${versions.lucene}"
  41. compile "org.apache.lucene:lucene-join:${versions.lucene}"
  42. compile "org.apache.lucene:lucene-memory:${versions.lucene}"
  43. compile "org.apache.lucene:lucene-misc:${versions.lucene}"
  44. compile "org.apache.lucene:lucene-queries:${versions.lucene}"
  45. compile "org.apache.lucene:lucene-queryparser:${versions.lucene}"
  46. compile "org.apache.lucene:lucene-sandbox:${versions.lucene}"
  47. compile "org.apache.lucene:lucene-spatial:${versions.lucene}"
  48. compile "org.apache.lucene:lucene-spatial-extras:${versions.lucene}"
  49. compile "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
  50. compile "org.apache.lucene:lucene-suggest:${versions.lucene}"
  51. compile 'org.elasticsearch:securesm:1.0'
  52. // utilities
  53. compile 'net.sf.jopt-simple:jopt-simple:4.9'
  54. compile 'com.carrotsearch:hppc:0.7.1'
  55. // time handling, remove with java 8 time
  56. compile 'joda-time:joda-time:2.8.2'
  57. // joda 2.0 moved to using volatile fields for datetime
  58. // When updating to a new version, make sure to update our copy of BaseDateTime
  59. compile 'org.joda:joda-convert:1.2'
  60. // json and yaml
  61. compile "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
  62. compile "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}"
  63. compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}"
  64. compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
  65. // network stack
  66. compile 'io.netty:netty:3.10.5.Final'
  67. // percentiles aggregation
  68. compile 'com.tdunning:t-digest:3.0'
  69. // precentil ranks aggregation
  70. compile 'org.hdrhistogram:HdrHistogram:2.1.6'
  71. // lucene spatial
  72. compile "org.locationtech.spatial4j:spatial4j:${versions.spatial4j}", optional
  73. compile "com.vividsolutions:jts:${versions.jts}", optional
  74. // logging
  75. compile "log4j:log4j:${versions.log4j}", optional
  76. compile "log4j:apache-log4j-extras:${versions.log4j}", optional
  77. compile "net.java.dev.jna:jna:${versions.jna}", optional
  78. if (isEclipse == false || project.path == ":core-tests") {
  79. testCompile("org.elasticsearch.test:framework:${version}") {
  80. // tests use the locally compiled version of core
  81. exclude group: 'org.elasticsearch', module: 'elasticsearch'
  82. }
  83. }
  84. }
  85. if (isEclipse) {
  86. // in eclipse the project is under a fake root, we need to change around the source sets
  87. sourceSets {
  88. if (project.path == ":core") {
  89. main.java.srcDirs = ['java']
  90. main.resources.srcDirs = ['resources']
  91. } else {
  92. test.java.srcDirs = ['java']
  93. test.resources.srcDirs = ['resources']
  94. }
  95. }
  96. }
  97. compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
  98. compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
  99. forbiddenPatterns {
  100. exclude '**/*.json'
  101. exclude '**/*.jmx'
  102. exclude '**/org/elasticsearch/cluster/routing/shard_routes.txt'
  103. }
  104. thirdPartyAudit.excludes = [
  105. // uses internal java api: sun.security.x509 (X509CertInfo, X509CertImpl, X500Name)
  106. 'org.jboss.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator',
  107. // classes are missing!
  108. // from com.fasterxml.jackson.dataformat.yaml.YAMLMapper (jackson-dataformat-yaml)
  109. 'com.fasterxml.jackson.databind.ObjectMapper',
  110. // from org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder (netty)
  111. 'com.google.protobuf.CodedInputStream',
  112. // from org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender (netty)
  113. 'com.google.protobuf.CodedOutputStream',
  114. // from org.jboss.netty.handler.codec.protobuf.ProtobufDecoder (netty)
  115. 'com.google.protobuf.ExtensionRegistry',
  116. 'com.google.protobuf.MessageLite$Builder',
  117. 'com.google.protobuf.MessageLite',
  118. 'com.google.protobuf.Parser',
  119. // from org.apache.log4j.receivers.net.JMSReceiver (log4j-extras)
  120. 'javax.jms.Message',
  121. 'javax.jms.MessageListener',
  122. 'javax.jms.ObjectMessage',
  123. 'javax.jms.TopicConnection',
  124. 'javax.jms.TopicConnectionFactory',
  125. 'javax.jms.TopicPublisher',
  126. 'javax.jms.TopicSession',
  127. 'javax.jms.TopicSubscriber',
  128. // from org.apache.log4j.net.SMTPAppender (log4j)
  129. 'javax.mail.Authenticator',
  130. 'javax.mail.Message$RecipientType',
  131. 'javax.mail.Message',
  132. 'javax.mail.Multipart',
  133. 'javax.mail.PasswordAuthentication',
  134. 'javax.mail.Session',
  135. 'javax.mail.Transport',
  136. 'javax.mail.internet.InternetAddress',
  137. 'javax.mail.internet.InternetHeaders',
  138. 'javax.mail.internet.MimeBodyPart',
  139. 'javax.mail.internet.MimeMessage',
  140. 'javax.mail.internet.MimeMultipart',
  141. 'javax.mail.internet.MimeUtility',
  142. // from org.jboss.netty.channel.socket.http.HttpTunnelingServlet (netty)
  143. 'javax.servlet.ServletConfig',
  144. 'javax.servlet.ServletException',
  145. 'javax.servlet.ServletOutputStream',
  146. 'javax.servlet.http.HttpServlet',
  147. 'javax.servlet.http.HttpServletRequest',
  148. 'javax.servlet.http.HttpServletResponse',
  149. // from org.jboss.netty.logging.CommonsLoggerFactory (netty)
  150. 'org.apache.commons.logging.Log',
  151. 'org.apache.commons.logging.LogFactory',
  152. // from org.jboss.netty.handler.ssl.OpenSslEngine (netty)
  153. 'org.apache.tomcat.jni.Buffer',
  154. 'org.apache.tomcat.jni.Library',
  155. 'org.apache.tomcat.jni.Pool',
  156. 'org.apache.tomcat.jni.SSL',
  157. 'org.apache.tomcat.jni.SSLContext',
  158. // from org.jboss.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator (netty)
  159. 'org.bouncycastle.asn1.x500.X500Name',
  160. 'org.bouncycastle.cert.X509v3CertificateBuilder',
  161. 'org.bouncycastle.cert.jcajce.JcaX509CertificateConverter',
  162. 'org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder',
  163. 'org.bouncycastle.jce.provider.BouncyCastleProvider',
  164. 'org.bouncycastle.operator.jcajce.JcaContentSignerBuilder',
  165. // from org.jboss.netty.handler.ssl.JettyNpnSslEngine (netty)
  166. 'org.eclipse.jetty.npn.NextProtoNego$ClientProvider',
  167. 'org.eclipse.jetty.npn.NextProtoNego$ServerProvider',
  168. 'org.eclipse.jetty.npn.NextProtoNego',
  169. // from org.jboss.netty.logging.JBossLoggerFactory (netty)
  170. 'org.jboss.logging.Logger',
  171. // from org.jboss.netty.handler.codec.marshalling.ChannelBufferByteInput (netty)
  172. 'org.jboss.marshalling.ByteInput',
  173. // from org.jboss.netty.handler.codec.marshalling.ChannelBufferByteOutput (netty)
  174. 'org.jboss.marshalling.ByteOutput',
  175. // from org.jboss.netty.handler.codec.marshalling.CompatibleMarshallingEncoder (netty)
  176. 'org.jboss.marshalling.Marshaller',
  177. // from org.jboss.netty.handler.codec.marshalling.ContextBoundUnmarshallerProvider (netty)
  178. 'org.jboss.marshalling.MarshallerFactory',
  179. 'org.jboss.marshalling.MarshallingConfiguration',
  180. 'org.jboss.marshalling.Unmarshaller',
  181. // from org.locationtech.spatial4j.io.GeoJSONReader (spatial4j)
  182. 'org.noggit.JSONParser',
  183. // from org.jboss.netty.container.osgi.NettyBundleActivator (netty)
  184. 'org.osgi.framework.BundleActivator',
  185. 'org.osgi.framework.BundleContext',
  186. // from org.jboss.netty.logging.OsgiLoggerFactory$1 (netty)
  187. 'org.osgi.framework.ServiceReference',
  188. 'org.osgi.service.log.LogService',
  189. 'org.osgi.util.tracker.ServiceTracker',
  190. 'org.osgi.util.tracker.ServiceTrackerCustomizer',
  191. // from org.netty.util.internal.logging.InternalLoggerFactory (netty) - it's optional
  192. 'org.slf4j.Logger',
  193. 'org.slf4j.LoggerFactory',
  194. ]
  195. // dependency license are currently checked in distribution
  196. dependencyLicenses.enabled = false
  197. if (isEclipse == false || project.path == ":core-tests") {
  198. task integTest(type: RandomizedTestingTask,
  199. group: JavaBasePlugin.VERIFICATION_GROUP,
  200. description: 'Multi-node tests',
  201. dependsOn: test.dependsOn) {
  202. configure(BuildPlugin.commonTestConfig(project))
  203. classpath = project.test.classpath
  204. testClassesDir = project.test.testClassesDir
  205. include '**/*IT.class'
  206. }
  207. check.dependsOn integTest
  208. integTest.mustRunAfter test
  209. }