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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. sonarqube {
  2. properties {
  3. property 'sonar.projectName', "${projectTitle} :: Application"
  4. }
  5. }
  6. configurations {
  7. zip
  8. jsw
  9. scanner
  10. web
  11. jdbc_mssql {
  12. transitive = false
  13. }
  14. jdbc_mysql {
  15. transitive = false
  16. }
  17. jdbc_postgresql {
  18. transitive = false
  19. }
  20. jdbc_h2 {
  21. transitive = false
  22. }
  23. bundledPlugin {
  24. transitive = false
  25. }
  26. }
  27. ext {
  28. slangVersion = '1.5.0.315'
  29. dotnetVersion = '7.11.0.8083'
  30. }
  31. dependencies {
  32. // please keep list ordered
  33. compile 'org.elasticsearch.client:transport'
  34. compile project(':server:sonar-ce')
  35. compile project(':server:sonar-main')
  36. compile project(':server:sonar-process')
  37. compile project(':server:sonar-server')
  38. compileOnly 'com.google.code.findbugs:jsr305'
  39. jsw 'tanukisoft:wrapper:3.2.3'
  40. scanner project(path: ':sonar-scanner-engine-shaded', configuration: 'shadow')
  41. web project(':server:sonar-vsts')
  42. web project(':server:sonar-web')
  43. jdbc_h2 'com.h2database:h2'
  44. jdbc_mssql 'com.microsoft.sqlserver:mssql-jdbc'
  45. jdbc_mysql 'mysql:mysql-connector-java'
  46. jdbc_postgresql 'org.postgresql:postgresql'
  47. bundledPlugin 'org.sonarsource.css:sonar-css-plugin:1.0.3.724@jar'
  48. bundledPlugin "org.sonarsource.dotnet:sonar-csharp-plugin:${dotnetVersion}@jar"
  49. bundledPlugin "org.sonarsource.dotnet:sonar-vbnet-plugin:${dotnetVersion}@jar"
  50. bundledPlugin 'org.sonarsource.flex:sonar-flex-plugin:2.4.0.1222@jar'
  51. bundledPlugin 'org.sonarsource.go:sonar-go-plugin:1.1.0.1612@jar'
  52. bundledPlugin 'org.sonarsource.html:sonar-html-plugin:3.1.0.1615@jar'
  53. bundledPlugin 'org.sonarsource.java:sonar-java-plugin:5.11.0.17289@jar'
  54. bundledPlugin 'org.sonarsource.jacoco:sonar-jacoco-plugin:1.0.1.143@jar'
  55. bundledPlugin 'org.sonarsource.javascript:sonar-javascript-plugin:5.1.1.7506@jar'
  56. bundledPlugin 'org.sonarsource.ldap:sonar-ldap-plugin:2.2.0.608@jar'
  57. bundledPlugin 'org.sonarsource.php:sonar-php-plugin:3.0.0.4537@jar'
  58. bundledPlugin 'org.sonarsource.python:sonar-python-plugin:1.13.0.2922@jar'
  59. bundledPlugin "org.sonarsource.slang:sonar-kotlin-plugin:${slangVersion}@jar"
  60. bundledPlugin "org.sonarsource.slang:sonar-ruby-plugin:${slangVersion}@jar"
  61. bundledPlugin 'org.sonarsource.scm.git:sonar-scm-git-plugin:1.8.0.1574@jar'
  62. bundledPlugin 'org.sonarsource.scm.svn:sonar-scm-svn-plugin:1.9.0.1295@jar'
  63. bundledPlugin "org.sonarsource.slang:sonar-scala-plugin:${slangVersion}@jar"
  64. bundledPlugin 'org.sonarsource.typescript:sonar-typescript-plugin:1.9.0.3766@jar'
  65. bundledPlugin 'org.sonarsource.xml:sonar-xml-plugin:2.0.1.2020@jar'
  66. testCompile 'junit:junit'
  67. testCompile 'org.assertj:assertj-core'
  68. testCompile 'org.mockito:mockito-core'
  69. }
  70. jar {
  71. manifest {
  72. attributes(
  73. 'Class-Path': configurations.compile.resolvedConfiguration.files.collect { "common/${it.getName()}" }.join(' '),
  74. 'Main-Class': 'org.sonar.application.App'
  75. )
  76. }
  77. }
  78. task zip(type: Zip, dependsOn: [configurations.compile]) {
  79. duplicatesStrategy DuplicatesStrategy.EXCLUDE
  80. def archiveDir = "sonarqube-$version"
  81. into("${archiveDir}/") {
  82. from file('src/main/assembly')
  83. exclude 'elasticsearch-patch'
  84. // elasticsearch script will be replaced by patched version below
  85. exclude 'elasticsearch/bin/elasticsearch'
  86. exclude 'elasticsearch/bin/elasticsearch.bat'
  87. exclude 'elasticsearch/bin/elasticsearch-env.bat'
  88. exclude 'elasticsearch/bin/elasticsearch-service.bat'
  89. exclude 'elasticsearch/bin/elasticsearch-service-*.exe'
  90. exclude 'elasticsearch/bin/elasticsearch-certgen*'
  91. exclude 'elasticsearch/bin/elasticsearch-certutil*'
  92. exclude 'elasticsearch/bin/elasticsearch-cli*'
  93. exclude 'elasticsearch/bin/elasticsearch-croneval*'
  94. exclude 'elasticsearch/bin/elasticsearch-keystore*'
  95. exclude 'elasticsearch/bin/elasticsearch-migrate*'
  96. exclude 'elasticsearch/bin/elasticsearch-plugin*'
  97. exclude 'elasticsearch/bin/elasticsearch-saml-metadata*'
  98. exclude 'elasticsearch/bin/elasticsearch-setup-passwords*'
  99. exclude 'elasticsearch/bin/elasticsearch-shard*'
  100. exclude 'elasticsearch/bin/elasticsearch-sql-cli*'
  101. exclude 'elasticsearch/bin/elasticsearch-syskeygen*'
  102. exclude 'elasticsearch/bin/elasticsearch-translog*'
  103. exclude 'elasticsearch/bin/elasticsearch-users*'
  104. exclude 'elasticsearch/bin/x-pack/**'
  105. exclude 'elasticsearch/bin/x-pack*'
  106. exclude 'elasticsearch/lib/tools/**'
  107. exclude 'elasticsearch/modules/aggs-matrix-stats/**'
  108. exclude 'elasticsearch/modules/ingest-common/**'
  109. exclude 'elasticsearch/modules/lang-expression/**'
  110. exclude 'elasticsearch/modules/lang-groovy/**'
  111. exclude 'elasticsearch/modules/lang-mustache/**'
  112. exclude 'elasticsearch/modules/rank-eval/**'
  113. exclude 'elasticsearch/modules/tribe/**'
  114. exclude 'elasticsearch/modules/x-pack-*/**'
  115. }
  116. into("${archiveDir}/elasticsearch/") {
  117. from file('src/main/assembly/elasticsearch-patch')
  118. include 'bin/elasticsearch'
  119. }
  120. // Create the empty dir (plugins) required by elasticsearch
  121. into("${archiveDir}/elasticsearch/") {
  122. from "$buildDir/elasticsearch"
  123. }
  124. into("${archiveDir}/lib/") {
  125. from jar
  126. }
  127. into("${archiveDir}/extensions/plugins/") {
  128. from configurations.bundledPlugin
  129. }
  130. into("${archiveDir}/lib/jsw/") {
  131. from configurations.jsw
  132. }
  133. into("${archiveDir}/lib/scanner/") {
  134. from configurations.scanner
  135. }
  136. into("${archiveDir}/lib/common/") {
  137. from configurations.compile
  138. }
  139. into("${archiveDir}/web/") {
  140. // FIXME use configurations.web with correct artifacts
  141. from tasks.getByPath(':server:sonar-web:yarn_run').outputs
  142. from tasks.getByPath(':server:sonar-vsts:yarn_run').outputs
  143. if (official) {
  144. from project(':private:branding').file('.')
  145. }
  146. }
  147. into("${archiveDir}/lib/jdbc/mssql/") {
  148. from configurations.jdbc_mssql
  149. }
  150. into("${archiveDir}/lib/jdbc/mysql/") {
  151. from configurations.jdbc_mysql
  152. }
  153. into("${archiveDir}/lib/jdbc/postgresql/") {
  154. from configurations.jdbc_postgresql
  155. }
  156. into("${archiveDir}/lib/jdbc/h2/") {
  157. from configurations.jdbc_h2
  158. }
  159. }
  160. // Create the empty dir required by elasticsearch
  161. zip.doFirst {
  162. new File(buildDir, 'elasticsearch/plugins').mkdirs()
  163. }
  164. // Check the size of the archive
  165. zip.doLast {
  166. def minLength = 191000000
  167. def maxLength = 198000000
  168. def length = new File(distsDir, archiveName).length()
  169. if (length < minLength)
  170. throw new GradleException("$archiveName size ($length) too small. Min is $minLength")
  171. if (length > maxLength)
  172. throw new GradleException("$distsDir/$archiveName size ($length) too large. Max is $maxLength")
  173. }
  174. assemble.dependsOn zip
  175. // the script start.sh unpacks OSS distribution into $buildDir/distributions/sonarqube-oss.
  176. // This directory should be deleted when the zip is changed.
  177. task cleanLocalUnzippedDir(dependsOn: zip) {
  178. def unzippedDir = file("$buildDir/distributions/sonarqube-$version")
  179. inputs.files(file("$buildDir/distributions/sonar-application-${version}.zip"))
  180. outputs.upToDateWhen { true }
  181. doLast {
  182. println("delete directory ${unzippedDir}")
  183. project.delete(unzippedDir)
  184. }
  185. }
  186. assemble.dependsOn cleanLocalUnzippedDir
  187. artifacts { zip zip }
  188. artifactoryPublish.skip = false
  189. publishing {
  190. publications {
  191. mavenJava(MavenPublication) {
  192. artifact zip
  193. }
  194. }
  195. }