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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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.2.1.2009'
  29. dotnetVersion = '7.7.0.7192'
  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.2.611@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.java:sonar-java-plugin:5.8.0.15699@jar'
  53. bundledPlugin 'org.sonarsource.jacoco:sonar-jacoco-plugin:1.0.1.143@jar'
  54. bundledPlugin 'org.sonarsource.javascript:sonar-javascript-plugin:5.0.0.6962@jar'
  55. bundledPlugin "org.sonarsource.slang:sonar-kotlin-plugin:${slangVersion}@jar"
  56. bundledPlugin "org.sonarsource.slang:sonar-ruby-plugin:${slangVersion}@jar"
  57. bundledPlugin 'org.sonarsource.ldap:sonar-ldap-plugin:2.2.0.608@jar'
  58. bundledPlugin 'org.sonarsource.php:sonar-php-plugin:2.14.0.3569@jar'
  59. bundledPlugin 'org.sonarsource.python:sonar-python-plugin:1.10.0.2131@jar'
  60. bundledPlugin 'org.sonarsource.scm.git:sonar-scm-git-plugin:1.6.0.1349@jar'
  61. bundledPlugin 'org.sonarsource.scm.svn:sonar-scm-svn-plugin:1.9.0.1295@jar'
  62. bundledPlugin 'org.sonarsource.typescript:sonar-typescript-plugin:1.8.0.3332@jar'
  63. bundledPlugin 'org.sonarsource.xml:sonar-xml-plugin:1.5.1.1452@jar'
  64. testCompile 'junit:junit'
  65. testCompile 'org.assertj:assertj-core'
  66. testCompile 'org.mockito:mockito-core'
  67. }
  68. jar {
  69. manifest {
  70. attributes(
  71. 'Class-Path': configurations.compile.resolvedConfiguration.files.collect { "common/${it.getName()}" }.join(' '),
  72. 'Main-Class': 'org.sonar.application.App'
  73. )
  74. }
  75. }
  76. task zip(type: Zip, dependsOn: [configurations.compile]) {
  77. duplicatesStrategy DuplicatesStrategy.EXCLUDE
  78. def archiveDir = "sonarqube-$version"
  79. into("${archiveDir}/") {
  80. from file('src/main/assembly')
  81. exclude 'elasticsearch/modules/lang-expression/**'
  82. exclude 'elasticsearch/modules/lang-groovy/**'
  83. exclude 'elasticsearch/modules/lang-mustache/**'
  84. exclude 'elasticsearch/modules/lang-painless/**'
  85. exclude 'elasticsearch/modules/transport-netty3/**'
  86. }
  87. // Create the empty dir (plugins) required by elasticsearch
  88. into("${archiveDir}/elasticsearch/") {
  89. from "$buildDir/elasticsearch"
  90. }
  91. into("${archiveDir}/lib/") {
  92. from jar
  93. }
  94. into("${archiveDir}/extensions/plugins/") {
  95. from configurations.bundledPlugin
  96. }
  97. into("${archiveDir}/lib/jsw/") {
  98. from configurations.jsw
  99. }
  100. into("${archiveDir}/lib/scanner/") {
  101. from configurations.scanner
  102. }
  103. into("${archiveDir}/lib/common/") {
  104. from configurations.compile
  105. }
  106. into("${archiveDir}/web/") {
  107. // FIXME use configurations.web with correct artifacts
  108. from tasks.getByPath(':server:sonar-web:yarn_run').outputs
  109. from tasks.getByPath(':server:sonar-vsts:yarn_run').outputs
  110. if (official) {
  111. from project(':private:branding').file('.')
  112. }
  113. }
  114. into("${archiveDir}/lib/jdbc/mssql/") {
  115. from configurations.jdbc_mssql
  116. }
  117. into("${archiveDir}/lib/jdbc/mysql/") {
  118. from configurations.jdbc_mysql
  119. }
  120. into("${archiveDir}/lib/jdbc/postgresql/") {
  121. from configurations.jdbc_postgresql
  122. }
  123. into("${archiveDir}/lib/jdbc/h2/") {
  124. from configurations.jdbc_h2
  125. }
  126. }
  127. // Create the empty dir required by elasticsearch
  128. zip.doFirst {
  129. new File(buildDir, 'elasticsearch/plugins').mkdirs()
  130. }
  131. // Check the size of the archive
  132. zip.doLast {
  133. def minLength = 170000000
  134. def maxLength = 175000000
  135. def length = new File(distsDir, archiveName).length()
  136. if (length < minLength)
  137. throw new GradleException("$archiveName size ($length) too small. Min is $minLength")
  138. if (length > maxLength)
  139. throw new GradleException("$distsDir/$archiveName size ($length) too large. Max is $maxLength")
  140. }
  141. assemble.dependsOn zip
  142. // the script start.sh unpacks OSS distribution into $buildDir/distributions/sonarqube-oss.
  143. // This directory should be deleted when the zip is changed.
  144. task cleanLocalUnzippedDir(dependsOn: zip) {
  145. def unzippedDir = file("$buildDir/distributions/sonarqube-$version")
  146. inputs.files(file("$buildDir/distributions/sonar-application-${version}.zip"))
  147. outputs.upToDateWhen { true }
  148. doLast {
  149. println("delete directory ${unzippedDir}")
  150. project.delete(unzippedDir)
  151. }
  152. }
  153. assemble.dependsOn cleanLocalUnzippedDir
  154. artifacts { zip zip }
  155. artifactoryPublish.skip = false
  156. publishing {
  157. publications {
  158. mavenJava(MavenPublication) {
  159. artifact zip
  160. }
  161. }
  162. }