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

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