-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
166 lines (143 loc) · 4.54 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
plugins {
id "java-library"
id "signing"
id "maven-publish"
id "jacoco"
id "com.github.hierynomus.license" version "0.16.1"
id "org.sonarqube" version "4.4.1.3373"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
id "com.github.ben-manes.versions" version "0.48.0"
id "org.sonatype.gradle.plugins.scan" version "2.6.1"
}
group 'com.github.kaklakariada'
version = '1.7.0'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
withJavadocJar()
withSourcesJar()
}
javadoc {
failOnError = false
options.addBooleanOption('html5', true)
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all'
options.encoding = 'UTF-8'
}
testing {
suites {
test {
useJUnitJupiter()
}
}
}
dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.squareup.okio:okio:3.6.0' // Fix CVE-2023-3635
implementation 'com.subshell.simpleframework:simple-xml:2.9.0'
implementation 'org.slf4j:slf4j-api:2.0.9'
testRuntimeOnly 'ch.qos.logback:logback-classic:1.4.11'
testImplementation 'org.mockito:mockito-core:5.6.0'
testImplementation 'org.assertj:assertj-core:3.24.2'
}
license {
header = file('gradle/license-header.txt')
exclude('**/deviceList*Payload.xml')
exclude('devicelist6840.xml')
exclude('**/FritzOS29/*.xml')
}
jacocoTestReport {
reports {
xml.required = true
}
}
sonar {
properties {
property("sonar.organization", "kaklakariada-github")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.gradle.skipCompile", "true")
}
}
rootProject.tasks["sonarqube"].dependsOn(tasks["jacocoTestReport"])
def getOptionalProperty(String name) {
if(project.hasProperty(name)) {
return project.property(name)
}
logger.info("Project property '${name}' not available. Please add it to ~/.gradle/gradle.properties")
return null
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'FritzBox Java API'
description = 'Java API for managing FritzBox HomeAutomation '
url = 'https://github.com/kaklakariada/fritzbox-java-api'
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/fritzbox-java-api.git'
developerConnection = 'scm:git:https://github.com/kaklakariada/fritzbox-java-api.git'
url = 'https://github.com/kaklakariada/fritzbox-java-api'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
allowInsecureProtocol = false
credentials(PasswordCredentials) {
username = getOptionalProperty("ossrhUsername")
password = getOptionalProperty("ossrhPassword")
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
nexusPublishing {
packageGroup = project.group
repositories {
sonatype {
stagingProfileId = "4f1b95618be44"
username = getOptionalProperty("ossrhUsername")
password = getOptionalProperty("ossrhPassword")
}
}
}
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)
}
}
ossIndexAudit {
allConfigurations = false
useCache = true
excludeVulnerabilityIds = []
printBanner = false
}
rootProject.tasks["build"].dependsOn(tasks["ossIndexAudit"])