You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. buildscript {
  2. repositories {
  3. maven {
  4. url 'https://plugins.gradle.org/m2/'
  5. }
  6. }
  7. dependencies {
  8. // check updates with https://plugins.gradle.org/
  9. // Ordered alphabeticly to avoid duplication
  10. classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
  11. classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.4'
  12. classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
  13. classpath 'io.spring.gradle:dependency-management-plugin:1.0.4.RELEASE'
  14. classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.6.2'
  15. classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
  16. }
  17. }
  18. // Analyze SonarQube with SonarQube!
  19. apply plugin: 'org.sonarqube'
  20. sonarqube {
  21. properties {
  22. property 'sonar.projectName', projectTitle
  23. }
  24. }
  25. allprojects {
  26. apply plugin: 'com.jfrog.artifactory'
  27. apply plugin: 'maven-publish'
  28. // Replaces the version defined in sources, usually x.y-SNAPSHOT, by a version identifying the build.
  29. def buildNumber = System.getProperty("buildNumber")
  30. if (version.endsWith('-SNAPSHOT') && buildNumber != null) {
  31. version = version.replace('-SNAPSHOT', ".0.$buildNumber")
  32. }
  33. ext {
  34. release = project.hasProperty('release') && project.getProperty('release')
  35. }
  36. repositories {
  37. def repository = project.hasProperty('cix') ? 'sonarsource-qa' : 'sonarsource'
  38. maven {
  39. url "https://repox.sonarsource.com/${repository}"
  40. def artifactoryUsername = System.env.'ARTIFACTORY_PRIVATE_USERNAME'
  41. def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD'
  42. if (artifactoryUsername && artifactoryPassword) {
  43. credentials {
  44. username artifactoryUsername
  45. password artifactoryPassword
  46. }
  47. }
  48. }
  49. }
  50. }
  51. subprojects {
  52. apply plugin: 'io.spring.dependency-management'
  53. apply plugin: 'java'
  54. // protobuf must be applied after java
  55. apply plugin: 'com.google.protobuf'
  56. apply plugin: "jacoco"
  57. apply plugin: 'idea'
  58. // do not deploy to Artifactory by default
  59. artifactoryPublish.skip = true
  60. ext {
  61. elasticsearchVersion = '5.6.3'
  62. protobufVersion = '3.5.1'
  63. }
  64. sonarqube {
  65. properties {
  66. property 'sonar.moduleKey', project.group + ':' + project.name
  67. }
  68. }
  69. // Central place for definition dependency versions and exclusions.
  70. dependencyManagement {
  71. dependencies {
  72. // please keep this list alphabetically ordered
  73. dependencySet(group: 'ch.qos.logback', version: '1.2.3') {
  74. entry 'logback-access'
  75. entry 'logback-classic'
  76. entry 'logback-core'
  77. }
  78. dependency('commons-beanutils:commons-beanutils:1.8.3') {
  79. exclude 'commons-logging:commons-logging'
  80. }
  81. dependency 'commons-codec:commons-codec:1.8'
  82. dependency 'commons-dbcp:commons-dbcp:1.4'
  83. dependency 'commons-dbutils:commons-dbutils:1.5'
  84. dependency 'commons-io:commons-io:2.4'
  85. dependency 'commons-lang:commons-lang:2.6'
  86. dependencySet(group: 'com.fasterxml.jackson.core', version: '2.6.6') {
  87. entry 'jackson-core'
  88. entry 'jackson-databind'
  89. entry 'jackson-annotations'
  90. }
  91. dependency 'com.github.kevinsawicki:http-request:5.4.1'
  92. dependency 'com.github.tlrx:elasticsearch-test:1.2.1'
  93. dependency 'com.googlecode.java-diff-utils:diffutils:1.2'
  94. dependency('com.googlecode.json-simple:json-simple:1.1.1') {
  95. exclude 'junit:junit'
  96. }
  97. dependency 'com.google.code.findbugs:jsr305:3.0.2'
  98. dependency 'com.google.code.gson:gson:2.3.1'
  99. dependency 'com.google.guava:guava:18.0'
  100. dependency "com.google.protobuf:protobuf-java:${protobufVersion}"
  101. dependency 'com.h2database:h2:1.3.176'
  102. dependencySet(group: 'com.hazelcast', version: '3.8.6') {
  103. entry 'hazelcast'
  104. entry 'hazelcast-client'
  105. }
  106. dependency 'com.ibm.icu:icu4j:3.4.4'
  107. dependency 'com.microsoft.sqlserver:mssql-jdbc:6.2.2.jre8'
  108. dependency 'com.oracle.jdbc:ojdbc8:12.2.0.1.0'
  109. dependencySet(group: 'com.squareup.okhttp3', version: '3.7.0') {
  110. entry 'okhttp'
  111. entry 'mockwebserver'
  112. }
  113. dependency 'com.tngtech.java:junit-dataprovider:1.9.2'
  114. dependency 'io.jsonwebtoken:jjwt:0.9.0'
  115. dependency 'javax.servlet:javax.servlet-api:3.0.1'
  116. dependency 'javax.xml.bind:jaxb-api:2.3.0'
  117. dependency 'junit:junit:4.12'
  118. dependency 'mysql:mysql-connector-java:5.1.42'
  119. dependency 'net.jpountz.lz4:lz4:1.3.0'
  120. dependency 'org.apache.commons:commons-csv:1.4'
  121. dependency 'org.apache.commons:commons-email:1.5'
  122. dependency('org.apache.httpcomponents:httpclient:4.5.2'){
  123. exclude 'commons-logging:commons-logging'
  124. }
  125. // Be aware that Log4j is used by Elasticsearch client
  126. dependencySet(group: 'org.apache.logging.log4j', version: '2.8.2') {
  127. entry 'log4j-api'
  128. entry 'log4j-to-slf4j'
  129. entry 'log4j-core'
  130. }
  131. dependencySet(group: 'org.apache.tomcat.embed', version: '8.5.23') {
  132. entry 'tomcat-embed-core'
  133. entry('tomcat-embed-jasper') {
  134. exclude 'org.eclipse.jdt.core.compiler:ecj'
  135. }
  136. }
  137. dependency 'org.assertj:assertj-core:3.9.0'
  138. dependency 'org.assertj:assertj-guava:3.1.0'
  139. dependency('org.codehaus.sonar:sonar-channel:4.1') {
  140. exclude 'org.slf4j:slf4j-api'
  141. }
  142. dependency 'org.codehaus.sonar:sonar-classloader:1.0'
  143. dependency('org.codehaus.woodstox:woodstox-core-lgpl:4.4.0') {
  144. exclude 'javax.xml.stream:stax-api'
  145. }
  146. dependency 'org.codehaus.sonar.runner:sonar-runner-api:2.4'
  147. dependency('org.codehaus.sonar:sonar-squid:4.1') {
  148. exclude 'org.codehaus.sonar:sonar-check-api'
  149. }
  150. dependency('org.codehaus.staxmate:staxmate:2.0.1') {
  151. exclude 'org.codehaus.woodstox:stax2-api'
  152. exclude 'stax:stax-api'
  153. exclude 'org.codehaus.woodstox:woodstox-core-asl'
  154. }
  155. dependency('org.codehaus.woodstox:stax2-api:3.1.4') {
  156. exclude 'stax:stax-api'
  157. }
  158. dependency('org.dbunit:dbunit:2.4.5') {
  159. exclude 'commons-lang:commons-lang'
  160. exclude 'xerces:xmlParserAPIs'
  161. exclude 'xerces:xercesImpl'
  162. }
  163. dependency 'org.eclipse.jetty:jetty-server:8.1.12.v20130726'
  164. dependency 'org.eclipse.jetty:test-jetty-servlet:8.1.12.v20130726'
  165. dependency("org.elasticsearch.client:transport:${elasticsearchVersion}") {
  166. exclude 'org.elasticsearch.plugin:lang-mustache-client'
  167. exclude 'org.elasticsearch.plugin:transport-netty3-client'
  168. exclude 'commons-logging:commons-logging'
  169. exclude 'org.elasticsearch.plugin:reindex-client'
  170. }
  171. dependency 'org.freemarker:freemarker:2.3.20'
  172. dependency 'org.hamcrest:hamcrest-all:1.3'
  173. dependency('org.mockito:mockito-core:2.13.0') {
  174. exclude 'org.hamcrest:hamcrest-core'
  175. }
  176. dependency 'org.mybatis:mybatis:3.4.4'
  177. dependency 'org.nanohttpd:nanohttpd:2.3.0'
  178. dependency 'org.picocontainer:picocontainer:2.15'
  179. dependencySet(group: 'org.slf4j', version: '1.7.25') {
  180. entry 'slf4j-api'
  181. entry 'jul-to-slf4j'
  182. entry 'log4j-over-slf4j'
  183. }
  184. dependency 'org.postgresql:postgresql:42.2.1'
  185. dependency 'org.reflections:reflections:0.9.9'
  186. dependency 'org.simpleframework:simple:4.1.21'
  187. dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.16.1.1446'
  188. dependency('org.sonarsource:sonar-persistit:3.3.2') {
  189. exclude 'commons-logging:commons-logging'
  190. }
  191. dependency 'org.sonarsource.update-center:sonar-update-center-common:1.18.0.487'
  192. dependency 'org.subethamail:subethasmtp:3.1.7'
  193. dependency 'xml-apis:xml-apis:1.4.01'
  194. // please keep this list alphabetically ordered
  195. }
  196. }
  197. sourceCompatibility = 1.8
  198. tasks.withType(JavaCompile) {
  199. options.encoding = 'UTF-8'
  200. }
  201. tasks.withType(Javadoc) {
  202. options.addStringOption('Xdoclint:none', '-quiet')
  203. }
  204. task sourcesJar(type: Jar, dependsOn: classes) {
  205. classifier = 'sources'
  206. from sourceSets.main.allSource
  207. }
  208. task javadocJar(type: Jar, dependsOn: javadoc) {
  209. classifier = 'javadoc'
  210. from javadoc.destinationDir
  211. }
  212. test {
  213. systemProperty 'java.awt.headless', true
  214. jacoco.enabled = project.hasProperty('jacocoEnabled')
  215. testLogging {
  216. exceptionFormat 'full' // log the full stack trace (default is the 1st line of the stack trace)
  217. events "skipped", "failed" // verbose log for failed and skipped tests (by default the name of the tests are not logged)
  218. }
  219. }
  220. def protoMainSrc = 'src/main/protobuf'
  221. def protoTestSrc = 'src/test/protobuf'
  222. if (file(protoMainSrc).exists() || file(protoTestSrc).exists()) {
  223. sourceSets.main.proto.srcDir protoMainSrc // in addition to the default 'src/main/proto'
  224. sourceSets.test.proto.srcDir protoTestSrc // in addition to the default 'src/test/proto'
  225. protobuf {
  226. protoc {
  227. artifact = "com.google.protobuf:protoc:${protobufVersion}"
  228. }
  229. }
  230. idea {
  231. module {
  232. sourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
  233. testSourceDirs += file("${protobuf.generatedFilesBaseDir}/test/java")
  234. }
  235. }
  236. }
  237. if (release) {
  238. jar {
  239. // do not break incremental build on non-release versions
  240. manifest {
  241. attributes(
  242. 'Version': "${version}",
  243. 'Implementation-Build': 'git rev-parse HEAD'.execute().text.trim(),
  244. 'Build-Time': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  245. )
  246. }
  247. }
  248. }
  249. }
  250. artifactory {
  251. clientConfig.setIncludeEnvVars(true)
  252. clientConfig.setEnvVarsExcludePatterns('*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*')
  253. contextUrl = System.getenv('ARTIFACTORY_URL')
  254. publish {
  255. repository {
  256. repoKey = System.getenv('ARTIFACTORY_DEPLOY_REPO')
  257. username = System.getenv('ARTIFACTORY_DEPLOY_USERNAME')
  258. password = System.getenv('ARTIFACTORY_DEPLOY_PASSWORD')
  259. }
  260. defaults {
  261. properties = [
  262. 'vcs.revision': System.getenv('GIT_COMMIT'),
  263. 'vcs.branch': System.getenv('GIT_BRANCH'),
  264. 'build.name': 'sonarqube',
  265. 'build.number': (System.getenv('BUILD_ID') ?: System.getenv('BUILD_NUMBER'))
  266. ]
  267. publications('mavenJava')
  268. publishPom = true
  269. publishIvy = false
  270. }
  271. }
  272. clientConfig.info.setBuildNumber(System.getenv('BUILD_NUMBER'))
  273. // Define the artifacts to be deployed to https://sonarsource.bintray.com on releases
  274. clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH', "${project.group}:sonar-application:zip")
  275. // The name of this variable is important because it's used by the delivery process when extracting version from Artifactory build info.
  276. clientConfig.info.addEnvironmentProperty('PROJECT_VERSION', "${version}")
  277. }