forked from mc1arke/sonarqube-community-branch-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
158 lines (139 loc) · 4.86 KB
/
build.gradle
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
/*
* Copyright (C) 2020-2024 Michael Clarke
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
plugins {
id('java')
id('jacoco')
id('org.sonarqube') version('4.4.1.3373')
id('info.solidsoft.pitest') version('1.15.0')
id('com.github.johnrengelman.shadow') version('8.1.1')
id('net.researchgate.release') version('3.0.2')
}
group 'com.github.mc1arke.sonarqube.plugin'
repositories {
mavenCentral()
ivy {
url 'https://binaries.sonarsource.com/'
patternLayout({a ->
artifact '/Distribution/[module]/[module]-[revision].[ext]'
})
metadataSources(sources -> {
sources.artifact()
})
}
}
def sonarqubeVersion = '10.6.0.92116'
def sonarqubeLibDir = "${projectDir}/sonarqube-lib"
def sonarLibraries = "${sonarqubeLibDir}/sonarqube-${sonarqubeVersion}/lib"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
configurations {
zip
}
compileJava {
options.compilerArgs += '-proc:none'
options.encoding = 'UTF-8'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
dependencies {
compileOnly(fileTree(dir: sonarLibraries, include: '**/*.jar', exclude: 'extensions/*.jar'))
testImplementation(fileTree(dir: sonarLibraries, include: '**/*.jar', exclude: 'extensions/*.jar'))
testImplementation('org.mockito:mockito-core:5.13.0')
testImplementation('org.assertj:assertj-core:3.26.3')
testImplementation('org.wiremock:wiremock:3.9.1')
zip("sonarqube:sonarqube:${sonarqubeVersion}@zip")
implementation('org.bouncycastle:bcpkix-jdk15on:1.70')
implementation(files('lib/nodes-0.5.0.jar'))
runtimeOnly('com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2')
compileOnly('com.google.code.findbugs:jsr305:3.0.2')
implementation('org.javassist:javassist:3.30.2-GA')
implementation('com.squareup.okhttp3:logging-interceptor:4.12.0')
testImplementation(platform('org.junit:junit-bom:5.11.0'))
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation('junit:junit:4.13.2')
testRuntimeOnly('org.junit.vintage:junit-vintage-engine')
}
project.afterEvaluate {
if (file("${sonarLibraries}").exists()) {
return
}
project.getLogger().lifecycle('Extracting SonarQube libraries (this may take a while)...')
configurations.zip.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from zipTree(artifact.getFile())
into sonarqubeLibDir
}
}
}
jar {
manifest {
attributes 'Plugin-Description': 'Enables branch and pull request analysis in SonarQube Community Edition, without having to upgrade to Developer Edition',
'SonarLint-Supported': false,
'Plugin-Homepage': 'https://github.com/mc1arke/sonarqube-community-branch-plugin',
'Plugin-License': 'GNU LGPL 3',
'Plugin-Version': "${project.version}",
'Plugin-Organization': 'Michael Clarke',
'Sonar-Version': "9.14.0.375",
'Plugin-IssueTrackerUrl': 'https://github.com/mc1arke/sonarqube-community-branch-plugin/issues',
'Plugin-Key': 'communityBranchPlugin',
'Plugin-Class': 'com.github.mc1arke.sonarqube.plugin.CommunityBranchPluginBootstrap',
'Plugin-Name': 'Community Branch Plugin',
'Premain-Class': 'com.github.mc1arke.sonarqube.plugin.CommunityBranchAgent',
'Can-Retransform-Classes': 'true'
}
}
release {
git {
requireBranch.set('')
commitVersionFileOnly.set(true)
}
buildTasks.set(["assemble"])
}
tasks.jar.configure {
archiveClassifier = 'nodeps'
enabled = false
}
tasks.shadowJar.configure {
archiveClassifier = null
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
assemble.dependsOn('shadowJar')
pitest {
junit5PluginVersion = '1.2.1'
timestampedReports = false
avoidCallsTo = ['org.slf4j.Logger']
}
jacocoTestReport {
reports {
xml.required = true
}
}
plugins.withType(JacocoPlugin) {
tasks["test"].finalizedBy 'jacocoTestReport'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}