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 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. buildscript {
  2. repositories {
  3. maven {
  4. url 'https://repox.jfrog.io/repox/plugins.gradle.org/'
  5. }
  6. }
  7. dependencies {
  8. // Ordered alphabeticly to avoid duplication
  9. classpath 'com.github.ben-manes:gradle-versions-plugin:0.28.0'
  10. classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
  11. classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
  12. classpath 'com.moowork.gradle:gradle-node-plugin:1.3.1'
  13. classpath 'gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.14.0'
  14. classpath 'io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE'
  15. classpath 'net.rdrei.android.buildtimetracker:gradle-plugin:0.11.1'
  16. classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.15.1'
  17. classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8'
  18. }
  19. }
  20. // display a summary of task durations at the end of the build
  21. if (project.hasProperty('time-tracker')) {
  22. apply plugin: 'build-time-tracker'
  23. buildtimetracker {
  24. reporters {
  25. summary {
  26. ordered true
  27. threshold 1000
  28. barstyle 'ascii'
  29. }
  30. }
  31. }
  32. }
  33. if (!JavaVersion.current().java11Compatible) {
  34. throw new GradleException("JDK 11+ is required to perform this build. It's currently " + System.getProperty("java.home") + ".")
  35. }
  36. allprojects {
  37. apply plugin: 'com.jfrog.artifactory'
  38. apply plugin: 'maven-publish'
  39. ext.versionInSources = version
  40. ext.buildNumber = System.getProperty("buildNumber")
  41. // when no buildNumber is provided, then project version must end with '-SNAPSHOT'
  42. if (ext.buildNumber == null) {
  43. version = "${version}-SNAPSHOT".toString()
  44. ext.versionWithoutBuildNumber = version
  45. } else {
  46. ext.versionWithoutBuildNumber = version
  47. version = (version.toString().count('.') == 1 ? "${version}.0.${ext.buildNumber}" : "${version}.${ext.buildNumber}").toString()
  48. }
  49. ext {
  50. release = project.hasProperty('release') && project.getProperty('release')
  51. official = project.hasProperty('official') && project.getProperty('official')
  52. }
  53. repositories {
  54. def repository = project.hasProperty('qa') ? 'sonarsource-qa' : 'sonarsource'
  55. maven {
  56. url "https://repox.jfrog.io/repox/${repository}"
  57. // The environment variables ARTIFACTORY_PRIVATE_USERNAME and ARTIFACTORY_PRIVATE_PASSWORD are used on QA env (Jenkins)
  58. // On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties
  59. def artifactoryUsername = System.env.'ARTIFACTORY_PRIVATE_USERNAME' ?: (project.hasProperty('artifactoryUsername') ? project.getProperty('artifactoryUsername') : '')
  60. def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD' ?: (project.hasProperty('artifactoryPassword') ? project.getProperty('artifactoryPassword') : '')
  61. if (artifactoryUsername && artifactoryPassword) {
  62. credentials {
  63. username artifactoryUsername
  64. password artifactoryPassword
  65. }
  66. }
  67. }
  68. }
  69. task allDependencies {
  70. dependsOn 'dependencies'
  71. }
  72. }
  73. apply plugin: 'org.sonarqube'
  74. sonarqube {
  75. properties {
  76. property 'sonar.projectName', projectTitle
  77. property 'sonar.projectVersion', "${versionInSources}-SNAPSHOT"
  78. property 'sonar.buildString', version
  79. }
  80. }
  81. subprojects {
  82. apply plugin: 'com.github.hierynomus.license'
  83. apply plugin: 'io.spring.dependency-management'
  84. apply plugin: 'jacoco'
  85. apply plugin: 'java'
  86. apply plugin: 'idea'
  87. sourceCompatibility = 1.8
  88. targetCompatibility = 1.8
  89. // do not deploy to Artifactory by default
  90. artifactoryPublish.skip = true
  91. def testFixtureSrc = 'src/testFixtures'
  92. if (file(testFixtureSrc).exists()) {
  93. apply plugin: 'java-test-fixtures'
  94. }
  95. ext {
  96. protobufVersion = '3.11.4'
  97. }
  98. sonarqube {
  99. properties {
  100. property 'sonar.moduleKey', project.group + ':' + project.name
  101. }
  102. }
  103. // Central place for definition dependency versions and exclusions.
  104. dependencyManagement {
  105. dependencies {
  106. // bundled plugin list -- keep it alphabetically ordered
  107. // comment is used by the Plugin Update bot to identify bundled plugins to check updates for
  108. //
  109. // !!! do not use variable for version number, bot in charge of updating plugin does not support them !!
  110. //
  111. // comment format is: // bundled_plugin:[updateCenterKey]:[githubRepository]
  112. // updateCenterKey: Update Center Plugin key, last release will be resolved from repox when not provided
  113. // githubRepository: name of github repository of the plugin in the SonarSource organisation
  114. dependency 'com.sonarsource.abap:sonar-abap-plugin:3.8.0.2034' // bundled_plugin:abap:sonar-abap
  115. dependency 'com.sonarsource.cobol:sonar-cobol-plugin:4.4.0.3403' // bundled_plugin:cobol:sonar-cobol
  116. dependency 'com.sonarsource.cpp:sonar-cfamily-plugin:6.7.0.15300' // bundled_plugin:cpp:sonar-cpp
  117. dependency 'com.sonarsource.pli:sonar-pli-plugin:1.10.0.1880' // bundled_plugin:pli:sonar-pli
  118. dependency 'com.sonarsource.plsql:sonar-plsql-plugin:3.4.1.2576' // bundled_plugin:plsql:sonar-plsql
  119. dependency 'com.sonarsource.plugins.vb:sonar-vb-plugin:2.6.0.1875' // bundled_plugin:vb:sonar-vb
  120. dependency 'com.sonarsource.rpg:sonar-rpg-plugin:2.3.0.1187' // bundled_plugin:rpg:sonar-rpg
  121. dependency 'com.sonarsource.security:sonar-security-csharp-frontend-plugin:8.2.1.1259' // bundled_plugin::sonar-security
  122. dependency 'com.sonarsource.security:sonar-security-java-frontend-plugin:8.2.1.1259' // bundled_plugin::sonar-security
  123. dependency 'com.sonarsource.security:sonar-security-php-frontend-plugin:8.2.1.1259' // bundled_plugin::sonar-security
  124. dependency 'com.sonarsource.security:sonar-security-plugin:8.2.1.1259' // bundled_plugin::sonar-security
  125. dependency 'com.sonarsource.security:sonar-security-python-frontend-plugin:8.2.1.1259' // bundled_plugin::sonar-security
  126. dependency 'com.sonarsource.slang:sonar-apex-plugin:1.7.0.883' // bundled_plugin:sonarapex:slang-enterprise
  127. dependency 'com.sonarsource.swift:sonar-swift-plugin:4.2.2.77' // bundled_plugin:swift:sonar-swift
  128. dependency 'com.sonarsource.tsql:sonar-tsql-plugin:1.4.0.3334' // bundled_plugin:tsql:sonar-tsql
  129. dependency 'org.sonarsource.css:sonar-css-plugin:1.2.0.1325' // bundled_plugin:cssfamily:sonar-css
  130. dependency 'org.sonarsource.dotnet:sonar-csharp-plugin:8.4.0.15306' // bundled_plugin:csharp:sonar-dotnet
  131. dependency 'org.sonarsource.dotnet:sonar-vbnet-plugin:8.4.0.15306' // bundled_plugin:vbnet:sonar-dotnet
  132. dependency 'org.sonarsource.flex:sonar-flex-plugin:2.5.1.1831' // bundled_plugin:flex:sonar-flex
  133. dependency 'org.sonarsource.html:sonar-html-plugin:3.2.0.2082' // bundled_plugin:web:sonar-html
  134. dependency 'org.sonarsource.jacoco:sonar-jacoco-plugin:1.0.2.475' // bundled_plugin:jacoco:sonar-jacoco
  135. dependency 'org.sonarsource.java:sonar-java-plugin:6.1.0.20866' // bundled_plugin:java:sonar-java
  136. dependency 'org.sonarsource.javascript:sonar-javascript-plugin:6.2.0.12043' // bundled_plugin:javascript:SonarJS
  137. dependency 'org.sonarsource.php:sonar-php-plugin:3.3.0.5166' // bundled_plugin:php:sonar-php
  138. dependency 'org.sonarsource.python:sonar-python-plugin:2.5.0.5733' // bundled_plugin:python:sonar-python
  139. dependency 'org.sonarsource.scm.git:sonar-scm-git-plugin:1.9.1.1834' // bundled_plugin:scmgit:sonar-scm-git
  140. dependency 'org.sonarsource.scm.svn:sonar-scm-svn-plugin:1.9.0.1295' // bundled_plugin:scmsvn:sonar-scm-svn
  141. dependency 'org.sonarsource.slang:sonar-go-plugin:1.6.0.719' // bundled_plugin:go:slang-enterprise
  142. dependency 'org.sonarsource.slang:sonar-kotlin-plugin:1.5.0.315' // bundled_plugin:kotlin:slang-enterprise
  143. dependency 'org.sonarsource.slang:sonar-ruby-plugin:1.5.0.315' // bundled_plugin:ruby:slang-enterprise
  144. dependency 'org.sonarsource.slang:sonar-scala-plugin:1.5.0.315' // bundled_plugin:sonarscala:slang-enterprise
  145. dependency 'org.sonarsource.typescript:sonar-typescript-plugin:2.1.0.4359' // bundled_plugin:typescript:SonarTS
  146. dependency 'org.sonarsource.xml:sonar-xml-plugin:2.0.1.2020' // bundled_plugin:xml:sonar-xml
  147. // please keep this list alphabetically ordered
  148. dependencySet(group: 'ch.qos.logback', version: '1.2.3') {
  149. entry 'logback-access'
  150. entry 'logback-classic'
  151. entry 'logback-core'
  152. }
  153. dependency('commons-beanutils:commons-beanutils:1.8.3') {
  154. exclude 'commons-logging:commons-logging'
  155. }
  156. dependency 'commons-codec:commons-codec:1.14'
  157. dependency 'commons-dbutils:commons-dbutils:1.7'
  158. dependency 'commons-io:commons-io:2.6'
  159. dependency 'commons-lang:commons-lang:2.6'
  160. dependencySet(group: 'com.fasterxml.jackson.core', version: '2.10.3') {
  161. entry 'jackson-core'
  162. entry 'jackson-annotations'
  163. entry 'jackson-databind'
  164. }
  165. dependency 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
  166. dependencySet(group: 'com.github.scribejava', version: '6.9.0') {
  167. entry 'scribejava-apis'
  168. entry 'scribejava-core'
  169. }
  170. // This project is no longer maintained and was forked
  171. // by https://github.com/java-diff-utils/java-diff-utils
  172. // (io.github.java-diff-utils:java-diff-utils).
  173. dependency 'com.googlecode.java-diff-utils:diffutils:1.2'
  174. dependency('com.googlecode.json-simple:json-simple:1.1.1') {
  175. exclude 'junit:junit'
  176. }
  177. dependency 'com.google.code.findbugs:jsr305:3.0.2'
  178. dependency 'com.google.code.gson:gson:2.8.6'
  179. dependency('com.google.guava:guava:28.2-jre') {
  180. exclude 'com.google.errorprone:error_prone_annotations'
  181. exclude 'com.google.guava:listenablefuture'
  182. exclude 'com.google.j2objc:j2objc-annotations'
  183. exclude 'org.checkerframework:checker-qual'
  184. exclude 'org.codehaus.mojo:animal-sniffer-annotations'
  185. }
  186. dependency "com.google.protobuf:protobuf-java:${protobufVersion}"
  187. // Do not upgrade H2 to 1.4.200 because of instability: https://github.com/h2database/h2database/issues/2205
  188. dependency 'com.h2database:h2:1.4.199'
  189. dependencySet(group: 'com.hazelcast', version: '3.12.6') {
  190. entry 'hazelcast'
  191. entry 'hazelcast-client'
  192. }
  193. dependency 'com.ibm.icu:icu4j:3.4.4'
  194. dependency 'com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre11'
  195. dependency 'com.oracle.database.jdbc:ojdbc8:19.3.0.0'
  196. dependencySet(group: 'com.squareup.okhttp3', version: '3.14.7') {
  197. entry 'okhttp'
  198. entry 'mockwebserver'
  199. }
  200. dependency 'com.tngtech.java:junit-dataprovider:1.13.1'
  201. dependency 'info.picocli:picocli:3.6.1'
  202. dependencySet(group: 'io.jsonwebtoken', version: '0.11.1') {
  203. entry 'jjwt-api'
  204. entry 'jjwt-impl'
  205. entry 'jjwt-jackson'
  206. }
  207. dependency 'io.netty:netty-all:4.1.48.Final'
  208. dependency 'com.sun.mail:javax.mail:1.5.6'
  209. dependency 'javax.annotation:javax.annotation-api:1.3.2'
  210. dependency 'javax.servlet:javax.servlet-api:3.1.0'
  211. dependency 'javax.xml.bind:jaxb-api:2.3.0'
  212. dependency 'junit:junit:4.13'
  213. dependency 'org.junit.jupiter:junit-jupiter-api:5.6.0'
  214. dependency 'net.jpountz.lz4:lz4:1.3.0'
  215. dependency 'net.lightbody.bmp:littleproxy:1.1.0-beta-bmp-17'
  216. dependency 'org.awaitility:awaitility:4.0.2'
  217. dependency 'org.apache.commons:commons-csv:1.7'
  218. dependency 'org.apache.commons:commons-email:1.5'
  219. dependency 'org.apache.commons:commons-dbcp2:2.7.0'
  220. dependency('org.apache.httpcomponents:httpclient:4.5.12'){
  221. exclude 'commons-logging:commons-logging'
  222. }
  223. // Be aware that Log4j is used by Elasticsearch client
  224. dependencySet(group: 'org.apache.logging.log4j', version: '2.8.2') {
  225. entry 'log4j-api'
  226. entry 'log4j-to-slf4j'
  227. entry 'log4j-core'
  228. }
  229. dependencySet(group: 'org.apache.tomcat.embed', version: '8.5.53') {
  230. entry 'tomcat-embed-core'
  231. entry('tomcat-embed-jasper') {
  232. exclude 'org.eclipse.jdt.core.compiler:ecj'
  233. }
  234. }
  235. dependency 'org.assertj:assertj-core:3.15.0'
  236. dependency 'org.assertj:assertj-guava:3.3.0'
  237. dependency('org.codehaus.sonar:sonar-channel:4.2') {
  238. exclude 'org.slf4j:slf4j-api'
  239. }
  240. dependency 'org.codehaus.sonar:sonar-classloader:1.0'
  241. dependency('org.codehaus.woodstox:woodstox-core-lgpl:4.4.1') {
  242. exclude 'javax.xml.stream:stax-api'
  243. }
  244. dependency 'org.codehaus.sonar.runner:sonar-runner-api:2.4'
  245. dependency('org.codehaus.sonar:sonar-squid:4.1') {
  246. exclude 'org.codehaus.sonar:sonar-check-api'
  247. }
  248. dependency('org.codehaus.staxmate:staxmate:2.0.1') {
  249. exclude 'org.codehaus.woodstox:stax2-api'
  250. exclude 'stax:stax-api'
  251. exclude 'org.codehaus.woodstox:woodstox-core-asl'
  252. }
  253. dependency('org.codehaus.woodstox:stax2-api:3.1.4') {
  254. exclude 'stax:stax-api'
  255. }
  256. dependencySet(group: 'org.eclipse.jetty', version: '9.4.6.v20170531') {
  257. entry 'jetty-proxy'
  258. entry 'jetty-server'
  259. entry 'jetty-servlet'
  260. }
  261. dependency('org.elasticsearch.client:transport:6.8.4') {
  262. exclude 'org.elasticsearch.plugin:lang-mustache-client'
  263. exclude 'commons-logging:commons-logging'
  264. exclude 'org.elasticsearch.plugin:reindex-client'
  265. exclude 'org.elasticsearch.plugin:rank-eval-client'
  266. }
  267. dependency 'org.elasticsearch:mocksocket:1.0'
  268. dependency 'org.codelibs.elasticsearch.module:analysis-common:6.8.4'
  269. dependency 'org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r'
  270. dependency 'org.hamcrest:hamcrest-all:1.3'
  271. dependency 'org.jsoup:jsoup:1.13.1'
  272. dependency 'org.mindrot:jbcrypt:0.4'
  273. dependency('org.mockito:mockito-core:3.3.3') {
  274. exclude 'org.hamcrest:hamcrest-core'
  275. }
  276. dependency 'org.mybatis:mybatis:3.5.4'
  277. dependency 'org.nanohttpd:nanohttpd:2.3.1'
  278. dependency 'org.picocontainer:picocontainer:2.15'
  279. dependencySet(group: 'org.slf4j', version: '1.7.30') {
  280. entry 'jcl-over-slf4j'
  281. entry 'jul-to-slf4j'
  282. entry 'log4j-over-slf4j'
  283. entry 'slf4j-api'
  284. }
  285. dependency 'org.postgresql:postgresql:42.2.11'
  286. dependency 'org.reflections:reflections:0.9.12'
  287. dependency 'org.simpleframework:simple:4.1.21'
  288. dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.27.0.2172'
  289. dependency 'org.sonarsource.update-center:sonar-update-center-common:1.23.0.723'
  290. dependency 'org.subethamail:subethasmtp:3.1.7'
  291. dependency 'org.yaml:snakeyaml:1.26'
  292. dependency 'xml-apis:xml-apis:1.4.01'
  293. // please keep this list alphabetically ordered
  294. }
  295. }
  296. // global exclusions
  297. configurations.all {
  298. // do not conflict with com.sun.mail:javax.mail
  299. exclude group: 'javax.mail', module: 'mail'
  300. }
  301. tasks.withType(JavaCompile) {
  302. options.compilerArgs.addAll(['--release', '8'])
  303. options.encoding = 'UTF-8'
  304. }
  305. tasks.withType(Javadoc) {
  306. options.addStringOption('Xdoclint:none', '-quiet')
  307. options.encoding = 'UTF-8'
  308. title = project.name + ' ' + versionWithoutBuildNumber
  309. }
  310. task sourcesJar(type: Jar, dependsOn: classes) {
  311. classifier = 'sources'
  312. from sourceSets.main.allSource
  313. }
  314. task javadocJar(type: Jar, dependsOn: javadoc) {
  315. classifier = 'javadoc'
  316. from javadoc.destinationDir
  317. }
  318. // generate code before opening project in IDE (Eclipse or Intellij)
  319. task ide() {
  320. // empty by default. Dependencies are added to the task
  321. // when needed (see protobuf modules for example)
  322. }
  323. jacocoTestReport {
  324. reports {
  325. xml.enabled true
  326. csv.enabled false
  327. html.enabled false
  328. }
  329. }
  330. normalization {
  331. runtimeClasspath {
  332. // Following classpath resources contain volatile data that changes in each CI build (build number, commit id, time),
  333. // so we exclude them from calculation of build cache key of test tasks:
  334. ignore 'META-INF/MANIFEST.MF'
  335. ignore 'sonar-api-version.txt'
  336. ignore 'sq-version.txt'
  337. }
  338. }
  339. test {
  340. jvmArgs '-Dfile.encoding=UTF8'
  341. maxHeapSize = '1G'
  342. systemProperty 'java.awt.headless', true
  343. testLogging {
  344. events "skipped", "failed" // verbose log for failed and skipped tests (by default the name of the tests are not logged)
  345. exceptionFormat 'full' // log the full stack trace (default is the 1st line of the stack trace)
  346. }
  347. jacoco {
  348. enabled = true // do not disable recording of code coverage, so that remote Gradle cache entry can be used locally
  349. includes = ['com.sonar.*', 'com.sonarsource.*', 'org.sonar.*', 'org.sonarqube.*', 'org.sonarsource.*']
  350. }
  351. if (project.hasProperty('maxParallelTests')) {
  352. maxParallelForks = project.maxParallelTests as int
  353. }
  354. if (project.hasProperty('parallelTests')) {
  355. // See https://guides.gradle.org/performance/#parallel_test_execution
  356. maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
  357. }
  358. }
  359. def protoMainSrc = 'src/main/protobuf'
  360. def protoTestSrc = 'src/test/protobuf'
  361. if (file(protoMainSrc).exists() || file(protoTestSrc).exists()) {
  362. // protobuf must be applied after java
  363. apply plugin: 'com.google.protobuf'
  364. sourceSets.main.proto.srcDir protoMainSrc // in addition to the default 'src/main/proto'
  365. sourceSets.test.proto.srcDir protoTestSrc // in addition to the default 'src/test/proto'
  366. protobuf {
  367. protoc {
  368. artifact = "com.google.protobuf:protoc:${protobufVersion}"
  369. }
  370. }
  371. jar {
  372. exclude('**/*.proto')
  373. }
  374. idea {
  375. module {
  376. sourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
  377. testSourceDirs += file("${protobuf.generatedFilesBaseDir}/test/java")
  378. generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
  379. generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/test/java")
  380. }
  381. }
  382. ide.dependsOn(['generateProto', 'generateTestProto'])
  383. }
  384. if (file('package.json').exists()) {
  385. apply plugin: 'com.moowork.node'
  386. node {
  387. version = '10.15.3'
  388. yarnVersion = '1.22.0'
  389. download = true
  390. }
  391. }
  392. if (official) {
  393. jar {
  394. // do not break incremental build on non official versions
  395. manifest {
  396. attributes(
  397. 'Version': "${version}",
  398. 'Implementation-Build': System.getenv('GIT_SHA1'),
  399. 'Build-Time': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  400. )
  401. }
  402. }
  403. }
  404. license {
  405. header = rootProject.file('HEADER')
  406. strictCheck true
  407. mapping {
  408. java = 'SLASHSTAR_STYLE'
  409. js = 'SLASHSTAR_STYLE'
  410. ts = 'SLASHSTAR_STYLE'
  411. tsx = 'SLASHSTAR_STYLE'
  412. css = 'SLASHSTAR_STYLE'
  413. }
  414. includes(['**/*.java', '**/*.js', '**/*.ts', '**/*.tsx', '**/*.css'])
  415. }
  416. publishing {
  417. publications {
  418. mavenJava(MavenPublication) {
  419. pom {
  420. name = 'SonarQube'
  421. description = project.description
  422. url = 'http://www.sonarqube.org/'
  423. organization {
  424. name = 'SonarSource'
  425. url = 'http://www.sonarsource.com'
  426. }
  427. licenses {
  428. license {
  429. name = 'GNU LGPL 3'
  430. url = 'http://www.gnu.org/licenses/lgpl.txt'
  431. distribution = 'repo'
  432. }
  433. }
  434. scm {
  435. url = 'https://github.com/SonarSource/sonarqube'
  436. }
  437. developers {
  438. developer {
  439. id = 'sonarsource-team'
  440. name = 'SonarSource Team'
  441. }
  442. }
  443. }
  444. }
  445. }
  446. }
  447. }
  448. // Yarn doesn't support concurrent access to its global cache,
  449. // i.e. parallel execution of several "yarn install" tasks,
  450. // since these tasks are independent, we can establish arbitrary total order
  451. // to prevent their concurrent execution.
  452. // Note that "task1.mustRunAfter(task2)" ordering has an effect only when both
  453. // tasks are scheduled for execution, therefore should be established between
  454. // all pairs of "yarn install" tasks to define their total order and to prevent
  455. // their concurrent execution even in case when one or more of these tasks not
  456. // scheduled.
  457. def yarnInstallTasks = allprojects.findResults { it -> it.tasks.findByName('yarn') }
  458. yarnInstallTasks.drop(1).eachWithIndex { it, i -> it.mustRunAfter(yarnInstallTasks[0..i]) }
  459. // by default, Yarn will update lock file if it is not up to date with "package.json"
  460. // using option "--frozen-lockfile" will disable this behavior and "yarn install" will fail if lock file is out of date
  461. // all "yarn install" tasks should be executed with this option for reproducibility of builds
  462. // and to prevent developers from forgetting to update lock file when they update "package.json"
  463. yarnInstallTasks.each { it -> it.args = ['--frozen-lockfile'] }
  464. artifactory {
  465. clientConfig.setIncludeEnvVars(true)
  466. clientConfig.setEnvVarsExcludePatterns('*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*,*key*,*KEY*')
  467. contextUrl = System.getenv('ARTIFACTORY_URL')
  468. publish {
  469. repository {
  470. repoKey = System.getenv('ARTIFACTORY_DEPLOY_REPO')
  471. username = System.getenv('ARTIFACTORY_DEPLOY_USERNAME') ?: project.properties.artifactoryUsername
  472. password = System.getenv('ARTIFACTORY_DEPLOY_PASSWORD') ?: project.properties.artifactoryPaswword
  473. }
  474. defaults {
  475. properties = [
  476. 'build.name': 'sonar-enterprise',
  477. 'build.number': System.getenv('BUILD_NUMBER'),
  478. 'pr.branch.target': System.getenv('GITHUB_BASE_BRANCH'),
  479. 'pr.number': System.getenv('PULL_REQUEST'),
  480. 'vcs.branch': System.getenv('GITHUB_BRANCH'),
  481. 'vcs.revision': System.getenv('GIT_SHA1'),
  482. 'version': version
  483. ]
  484. publications('mavenJava')
  485. publishPom = true
  486. publishIvy = false
  487. }
  488. }
  489. clientConfig.info.setBuildName('sonar-enterprise')
  490. clientConfig.info.setBuildNumber(System.getenv('BUILD_NUMBER'))
  491. // Define the artifacts to be deployed to https://binaries.sonarsource.com on releases
  492. clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH',
  493. "${project.group}:sonar-application:zip," +
  494. "com.sonarsource.sonarqube:sonarqube-developer:zip," +
  495. "com.sonarsource.sonarqube:sonarqube-datacenter:zip," +
  496. "com.sonarsource.sonarqube:sonarqube-enterprise:zip")
  497. // The name of this variable is important because it's used by the delivery process when extracting version from Artifactory build info.
  498. clientConfig.info.addEnvironmentProperty('PROJECT_VERSION', "${version}")
  499. }
  500. // https://github.com/ben-manes/gradle-versions-plugin
  501. apply plugin: 'com.github.ben-manes.versions'
  502. dependencyUpdates {
  503. rejectVersionIf {
  504. // Exclude dev versions from the list of dependency upgrades, for
  505. // example to replace:
  506. // org.slf4j:log4j-over-slf4j [1.7.25 -> 1.8.0-beta4]
  507. // by
  508. // org.slf4j:log4j-over-slf4j [1.7.25 -> 1.7.26]
  509. boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview', 'jre12'].any { qualifier ->
  510. it.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
  511. }
  512. // Exclude upgrades on new major versions :
  513. // com.hazelcast:hazelcast [3.12.3 -> 4.0.0]
  514. rejected |= !it.candidate.version.substring(0, 2).equals(it.currentVersion.substring(0, 2))
  515. rejected
  516. }
  517. }