diff options
author | Zipeng WU <zipeng.wu@sonarsource.com> | 2022-11-16 16:31:40 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-11-17 20:03:07 +0000 |
commit | fe9d9764559b5bd09b4acf6cfd9da2614e561cad (patch) | |
tree | 8b6ad1a45f5837f63cb403912f7bb3c533637bb8 | |
parent | 317ada58ae514beeb7865d67dae54f271f6d26ae (diff) | |
download | sonarqube-fe9d9764559b5bd09b4acf6cfd9da2614e561cad.tar.gz sonarqube-fe9d9764559b5bd09b4acf6cfd9da2614e561cad.zip |
SONAR-17611 Only run downloadLicenses task if release flag is set
-rw-r--r-- | sonar-application/build.gradle | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle index d9da90d312c..2192a0fbdec 100644 --- a/sonar-application/build.gradle +++ b/sonar-application/build.gradle @@ -116,38 +116,42 @@ downloadLicenses { dependencyConfiguration = 'appLicenses' } -task zip(type: Zip, dependsOn: [configurations.compileClasspath, tasks.downloadLicenses, downloadElasticSearch, verifyElasticSearchDownload]) { +task zip(type: Zip, dependsOn: [configurations.compileClasspath, downloadElasticSearch, verifyElasticSearchDownload]) { duplicatesStrategy DuplicatesStrategy.EXCLUDE def archiveDir = "sonarqube-$project.version" - 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]] + if(release) { + dependsOn tasks.downloadLicenses + 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) } - 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' - exclude 'bin/windows-x86-64/lib/SonarServiceWrapperTemplate.xml' - exclude 'bin/windows-x86-64/StartSonar.bat' - exclude 'elasticsearch-patch' - exclude 'bin/linux-x86-64/sonar.sh' - exclude 'bin/macosx-universal-64/sonar.sh' + from(file('src/main/assembly')) { + exclude 'conf/sonar.properties' + exclude 'bin/windows-x86-64/lib/SonarServiceWrapperTemplate.xml' + exclude 'bin/windows-x86-64/StartSonar.bat' + exclude 'elasticsearch-patch' + exclude 'bin/linux-x86-64/sonar.sh' + exclude 'bin/macosx-universal-64/sonar.sh' + } } } + from(tarTree(downloadElasticSearch.dest)) { eachFile { fcd -> def path = fcd.relativePath.segments - fcd.relativeSourcePath.segments + fcd.relativeSourcePath.segments.drop(1) |