aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application/build.gradle
diff options
context:
space:
mode:
authorZipeng WU <zipeng.wu@sonarsource.com>2021-10-25 13:33:30 +0200
committersonartech <sonartech@sonarsource.com>2021-10-26 20:03:36 +0000
commitd609879b84b61b8aa9c9c7c4bf95c10a07288823 (patch)
tree11c95b69cfc937b8c8328d3a75b5d685d8dff12e /sonar-application/build.gradle
parent85e535637a69b83d8a05932521ae2813f5d516b8 (diff)
downloadsonarqube-d609879b84b61b8aa9c9c7c4bf95c10a07288823.tar.gz
sonarqube-d609879b84b61b8aa9c9c7c4bf95c10a07288823.zip
SONAR-15485 handle Elastic license and prettify json
Diffstat (limited to 'sonar-application/build.gradle')
-rw-r--r--sonar-application/build.gradle18
1 files changed, 17 insertions, 1 deletions
diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle
index 578835e42da..2a70c75b0a4 100644
--- a/sonar-application/build.gradle
+++ b/sonar-application/build.gradle
@@ -1,3 +1,5 @@
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
@@ -104,6 +106,20 @@ task zip(type: Zip, dependsOn: [configurations.compileClasspath, tasks.downloadL
into("${archiveDir}/") {
from(tasks.downloadLicenses.outputs) {
include 'dependency-license.json'
+ eachFile { jsonFile ->
+ def json = new JsonSlurper().parse(jsonFile.file)
+ json.dependencies.each { dependency ->
+ if (dependency.licenses.size() > 1) {
+ def idx = dependency.licenses.findIndexOf { it.name == "Elastic License 2.0" }
+ if (idx >= 0) {
+ dependency.licenses = [dependency.licenses[idx]]
+ }
+ }
+ }
+ json.dependencies.sort { it.name }
+ def jsonText = JsonOutput.toJson(json)
+ jsonFile.file.text = JsonOutput.prettyPrint(jsonText)
+ }
}
from(file('src/main/assembly')) {
exclude 'conf/sonar.properties'
@@ -178,7 +194,7 @@ task zip(type: Zip, dependsOn: [configurations.compileClasspath, tasks.downloadL
'sqversion': version
])
}
-
+
into("${archiveDir}/elasticsearch/") {
from file('src/main/assembly/elasticsearch-patch')
include 'bin/elasticsearch'