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