Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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