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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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.4.0.155'
  29. dotnetVersion = '7.10.0.7896'
  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.10.1.16922@jar'
  54. bundledPlugin 'org.sonarsource.jacoco:sonar-jacoco-plugin:1.0.1.143@jar'
  55. bundledPlugin 'org.sonarsource.javascript:sonar-javascript-plugin:5.0.0.6962@jar'
  56. bundledPlugin 'org.sonarsource.ldap:sonar-ldap-plugin:2.2.0.608@jar'
  57. bundledPlugin 'org.sonarsource.php:sonar-php-plugin:2.16.0.4355@jar'
  58. bundledPlugin 'org.sonarsource.python:sonar-python-plugin:1.11.0.2473@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.7.0.1491@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/modules/lang-expression/**'
  84. exclude 'elasticsearch/modules/lang-groovy/**'
  85. exclude 'elasticsearch/modules/lang-mustache/**'
  86. exclude 'elasticsearch/modules/lang-painless/**'
  87. exclude 'elasticsearch/modules/transport-netty3/**'
  88. }
  89. // Create the empty dir (plugins) required by elasticsearch
  90. into("${archiveDir}/elasticsearch/") {
  91. from "$buildDir/elasticsearch"
  92. }
  93. into("${archiveDir}/lib/") {
  94. from jar
  95. }
  96. into("${archiveDir}/extensions/plugins/") {
  97. from configurations.bundledPlugin
  98. }
  99. into("${archiveDir}/lib/jsw/") {
  100. from configurations.jsw
  101. }
  102. into("${archiveDir}/lib/scanner/") {
  103. from configurations.scanner
  104. }
  105. into("${archiveDir}/lib/common/") {
  106. from configurations.compile
  107. }
  108. into("${archiveDir}/web/") {
  109. // FIXME use configurations.web with correct artifacts
  110. from tasks.getByPath(':server:sonar-web:yarn_run').outputs
  111. from tasks.getByPath(':server:sonar-vsts:yarn_run').outputs
  112. if (official) {
  113. from project(':private:branding').file('.')
  114. }
  115. }
  116. into("${archiveDir}/lib/jdbc/mssql/") {
  117. from configurations.jdbc_mssql
  118. }
  119. into("${archiveDir}/lib/jdbc/mysql/") {
  120. from configurations.jdbc_mysql
  121. }
  122. into("${archiveDir}/lib/jdbc/postgresql/") {
  123. from configurations.jdbc_postgresql
  124. }
  125. into("${archiveDir}/lib/jdbc/h2/") {
  126. from configurations.jdbc_h2
  127. }
  128. }
  129. // Create the empty dir required by elasticsearch
  130. zip.doFirst {
  131. new File(buildDir, 'elasticsearch/plugins').mkdirs()
  132. }
  133. // Check the size of the archive
  134. zip.doLast {
  135. def minLength = 185000000
  136. def maxLength = 190000000
  137. def length = new File(distsDir, archiveName).length()
  138. if (length < minLength)
  139. throw new GradleException("$archiveName size ($length) too small. Min is $minLength")
  140. if (length > maxLength)
  141. throw new GradleException("$distsDir/$archiveName size ($length) too large. Max is $maxLength")
  142. }
  143. assemble.dependsOn zip
  144. // the script start.sh unpacks OSS distribution into $buildDir/distributions/sonarqube-oss.
  145. // This directory should be deleted when the zip is changed.
  146. task cleanLocalUnzippedDir(dependsOn: zip) {
  147. def unzippedDir = file("$buildDir/distributions/sonarqube-$version")
  148. inputs.files(file("$buildDir/distributions/sonar-application-${version}.zip"))
  149. outputs.upToDateWhen { true }
  150. doLast {
  151. println("delete directory ${unzippedDir}")
  152. project.delete(unzippedDir)
  153. }
  154. }
  155. assemble.dependsOn cleanLocalUnzippedDir
  156. artifacts { zip zip }
  157. artifactoryPublish.skip = false
  158. publishing {
  159. publications {
  160. mavenJava(MavenPublication) {
  161. artifact zip
  162. }
  163. }
  164. }