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

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