-
Notifications
You must be signed in to change notification settings - Fork 91
/
build.gradle
192 lines (164 loc) · 5.13 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
plugins {
id 'java'
id 'signing'
id 'maven-publish'
id 'jacoco'
id "com.github.hierynomus.license" version "0.16.1"
id "org.sonarqube" version "5.1.0.4882"
id 'com.github.johnrengelman.shadow' version '8.1.1'
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.gradle.crypto.checksum' version '1.4.0'
}
repositories {
mavenCentral()
maven {
url 'http://4thline.org/m2'
allowInsecureProtocol true
}
flatDir { dirs 'lib' }
}
version = '2.2.4'
group 'com.github.kaklakariada'
java {
toolchain {
def javaVersion = project.hasProperty('javaVersion') ? project.getProperty('javaVersion') : 11
languageVersion = JavaLanguageVersion.of(javaVersion)
}
withJavadocJar()
withSourcesJar()
}
javadoc {
failOnError = true
options.addBooleanOption('html5', true)
//options.addStringOption('Xwerror', '-quiet')
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all'
options.compilerArgs << '-Werror'
options.encoding = 'UTF-8'
}
test {
if (logger.infoEnabled) {
testLogging.showStandardStreams = true
}
jvmArgs '-XX:+HeapDumpOnOutOfMemoryError', '-enableassertions'
}
processResources {
rename(/(\w+)_en.properties/, '$1.properties')
rename(/(\w+)_zh_CN.properties/, '$1_zh.properties')
filter { line -> line.replaceAll(/@VERSION_NUMBER@/, project.version) }
}
shadowJar {
archiveBaseName = 'portmapper'
archiveVersion = null
}
def mainClass = 'org.chris.portmapper.PortMapperStarter'
jar {
manifest {
attributes 'Main-Class': mainClass
}
}
tasks["build"].dependsOn(shadowJar)
task createSha512ChecksumExecutableJar(type: org.gradle.crypto.checksum.Checksum, dependsOn: [tasks.shadowJar]) {
files = files(tasks.shadowJar.outputs.files)
outputDir = new File(project.buildDir, "libs-checksums")
algorithm = org.gradle.crypto.checksum.Checksum.Algorithm.SHA512
appendFileNameToChecksum = false
}
tasks.shadowJar.configure {
finalizedBy createSha512ChecksumExecutableJar
}
task run(type: JavaExec, dependsOn: shadowJar) {
classpath = shadowJar.outputs.files
mainClass = mainClass
workingDir = rootProject.projectDir
}
artifacts {
archives shadowJar
}
dependencies {
implementation 'args4j:args4j:2.37'
implementation 'org.slf4j:slf4j-api:2.0.16'
implementation 'org.slf4j:jul-to-slf4j:2.0.16'
implementation 'ch.qos.logback:logback-classic:1.5.8'
implementation 'com.miglayout:miglayout-swing:11.4.2'
implementation 'org.jdesktop.bsaf:bsaf:1.9.2'
implementation ':sbbi-upnplib:1.0.4'
implementation 'org.fourthline.cling:cling-support:2.1.2'
implementation 'org.bitlet:weupnp:0.1.4'
runtimeOnly 'commons-jxpath:commons-jxpath:1.1' // Version 1.1. required by sbbi
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.13.0'
}
license {
header = file('gradle/license-header.txt')
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
}
}
sonar {
properties {
property("sonar.organization", "kaklakariada-github")
property("sonar.host.url", "https://sonarcloud.io")
}
}
tasks["sonarqube"].dependsOn(tasks["jacocoTestReport"])
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'UPnP Portmapper'
description = 'A tool for managing port forwardings via UPnP'
url = 'https://github.com/kaklakariada/portmapper'
licenses {
license {
name = 'GNU General Public License, Version 3.0'
url = 'https://www.gnu.org/licenses/gpl-3.0.txt'
}
}
developers {
developer {
id = 'kaklakariada'
name = 'Christoph'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/kaklakariada/portmapper.git'
developerConnection = 'scm:git:https://github.com/kaklakariada/portmapper.git'
url = 'https://github.com/kaklakariada/portmapper'
}
}
}
}
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
nexusPublishing {
packageGroup = project.group
repositories {
sonatype {
stagingProfileId = "4f1b95618be44"
}
}
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
gradleReleaseChannel = "current"
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}