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

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