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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. sonarqube {
  2. properties {
  3. property 'sonar.projectName', "${projectTitle} :: Application"
  4. }
  5. }
  6. configurations {
  7. zip
  8. ce
  9. jsw
  10. scanner
  11. server
  12. jdbc_mssql {
  13. transitive = false
  14. }
  15. jdbc_mysql {
  16. transitive = false
  17. }
  18. jdbc_postgresql {
  19. transitive = false
  20. }
  21. jdbc_h2 {
  22. transitive = false
  23. }
  24. bundledPlugin {
  25. transitive = false
  26. }
  27. }
  28. dependencies {
  29. // please keep list ordered
  30. compile 'org.elasticsearch.client:transport'
  31. compile project(':server:sonar-main')
  32. compile project(':server:sonar-process')
  33. compileOnly 'com.google.code.findbugs:jsr305'
  34. ce project(':server:sonar-ce')
  35. jsw 'tanukisoft:wrapper:3.2.3'
  36. scanner project(path: ':sonar-scanner-engine-shaded', configuration: 'shadow')
  37. server project(':server:sonar-server')
  38. jdbc_h2 'com.h2database:h2'
  39. jdbc_mssql 'com.microsoft.sqlserver:mssql-jdbc'
  40. jdbc_mysql 'mysql:mysql-connector-java'
  41. jdbc_postgresql 'org.postgresql:postgresql'
  42. bundledPlugin 'org.sonarsource.dotnet:sonar-csharp-plugin:7.1.0.5212@jar'
  43. bundledPlugin 'org.sonarsource.flex:sonar-flex-plugin:2.4.0.1222@jar'
  44. bundledPlugin 'org.sonarsource.go:sonar-go-plugin:1.0.0.1404@jar'
  45. bundledPlugin 'org.sonarsource.java:sonar-java-plugin:5.3.0.13828@jar'
  46. bundledPlugin 'org.sonarsource.javascript:sonar-javascript-plugin:4.1.0.6085@jar'
  47. bundledPlugin 'org.sonarsource.php:sonar-php-plugin:2.13.0.3107@jar'
  48. bundledPlugin 'org.sonarsource.python:sonar-python-plugin:1.10.0.2131@jar'
  49. bundledPlugin 'org.sonarsource.scm.git:sonar-scm-git-plugin:1.4.0.1037@jar'
  50. bundledPlugin 'org.sonarsource.scm.svn:sonar-scm-svn-plugin:1.7.0.1017@jar'
  51. bundledPlugin 'org.sonarsource.typescript:sonar-typescript-plugin:1.6.0.2388@jar'
  52. bundledPlugin 'org.sonarsource.xml:sonar-xml-plugin:1.5.0.1373@jar'
  53. bundledPlugin 'org.sonarsource.ldap:sonar-ldap-plugin:2.2.0.608@jar'
  54. testCompile 'junit:junit'
  55. testCompile 'org.assertj:assertj-core'
  56. testCompile 'org.mockito:mockito-core'
  57. }
  58. jar {
  59. manifest {
  60. attributes(
  61. 'Class-Path': configurations.compile.collect { "common/${it.getName()}" }.join(' '),
  62. 'Main-Class': 'org.sonar.application.App'
  63. )
  64. }
  65. }
  66. task zip(type: Zip) {
  67. duplicatesStrategy DuplicatesStrategy.EXCLUDE
  68. def archiveDir = "sonarqube-$version"
  69. into("${archiveDir}/") {
  70. from file('src/main/assembly')
  71. exclude 'elasticsearch/modules/lang-expression/**'
  72. exclude 'elasticsearch/modules/lang-groovy/**'
  73. exclude 'elasticsearch/modules/lang-mustache/**'
  74. exclude 'elasticsearch/modules/lang-painless/**'
  75. exclude 'elasticsearch/modules/transport-netty3/**'
  76. }
  77. // Create the empty dir (plugins) required by elasticsearch
  78. into("${archiveDir}/elasticsearch/") {
  79. from "$buildDir/elasticsearch"
  80. }
  81. into("${archiveDir}/lib/") {
  82. from jar
  83. }
  84. into("${archiveDir}/extensions/plugins/") {
  85. from configurations.bundledPlugin
  86. }
  87. into("${archiveDir}/lib/jsw/") {
  88. from configurations.jsw
  89. }
  90. into("${archiveDir}/lib/scanner/") {
  91. from configurations.scanner
  92. }
  93. into("${archiveDir}/lib/common/") {
  94. from configurations.ce + configurations.server + configurations.compile
  95. }
  96. into("${archiveDir}/web/") {
  97. from tasks.getByPath(':server:sonar-web:yarn_run').outputs
  98. from tasks.getByPath(':server:sonar-bitbucketcloud:yarn_run').outputs
  99. from tasks.getByPath(':server:sonar-vsts:yarn_run').outputs
  100. }
  101. into("${archiveDir}/lib/jdbc/mssql/") {
  102. from configurations.jdbc_mssql
  103. }
  104. into("${archiveDir}/lib/jdbc/mysql/") {
  105. from configurations.jdbc_mysql
  106. }
  107. into("${archiveDir}/lib/jdbc/postgresql/") {
  108. from configurations.jdbc_postgresql
  109. }
  110. into("${archiveDir}/lib/jdbc/h2/") {
  111. from configurations.jdbc_h2
  112. }
  113. }
  114. // Create the empty dir required by elasticsearch
  115. zip.doFirst {
  116. new File(buildDir, 'elasticsearch/plugins').mkdirs()
  117. }
  118. // Check the size of the archive
  119. zip.doLast {
  120. def minLength = 150000000
  121. def maxLength = 170000000
  122. def length = new File(distsDir, archiveName).length()
  123. if (length < minLength)
  124. throw new GradleException("$archiveName size ($length) too small. Min is $minLength")
  125. if (length > maxLength)
  126. throw new GradleException("$distsDir/$archiveName size ($length) too large. Max is $maxLength")
  127. }
  128. assemble.dependsOn zip
  129. // the script start.sh unpacks OSS distribution into $buildDir/distributions/sonarqube-oss.
  130. // This directory should be deleted when the zip is changed.
  131. task cleanLocalUnzippedDir(dependsOn: zip) {
  132. def unzippedDir = file("$buildDir/distributions/sonarqube-oss/sonarqube-$version")
  133. inputs.files(file("$buildDir/distributions/sonar-application-${version}.zip"))
  134. outputs.upToDateWhen { true }
  135. doLast {
  136. println("delete directory ${unzippedDir}")
  137. project.delete(unzippedDir)
  138. }
  139. }
  140. assemble.dependsOn cleanLocalUnzippedDir
  141. artifacts { zip zip }
  142. artifactoryPublish.skip = false
  143. publishing {
  144. publications {
  145. mavenJava(MavenPublication) {
  146. artifact zip
  147. }
  148. }
  149. }