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

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