-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
135 lines (120 loc) · 3.79 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
plugins {
id "java-library"
id "signing"
id "maven-publish"
id "jacoco"
id "org.sonarqube" version "5.1.0.4882"
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id "com.github.ben-manes.versions" version "0.51.0"
}
group 'org.itsallcode'
version = '0.8.2'
dependencies {
api 'org.hamcrest:hamcrest:3.0'
}
java {
toolchain {
def javaVersion = project.hasProperty('javaVersion') ? project.getProperty('javaVersion') : 11
languageVersion = JavaLanguageVersion.of(javaVersion)
}
withJavadocJar()
withSourcesJar()
}
testing {
suites {
test {
useJUnitJupiter()
targets {
all {
testTask.configure {
systemProperty 'java.util.logging.config.file', 'src/test/resources/logging.properties'
}
}
}
}
}
}
javadoc {
failOnError = true
options.addBooleanOption('html5', true)
// Workaround for https://github.com/gradle/gradle/issues/2354
options.addStringOption('Xwerror', '-quiet')
options.addStringOption('Xdoclint:all', '-quiet')
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all'
// module-info.java:8: warning: requires directive for an automatic module org.hamcrest
options.compilerArgs << '-Xlint:-requires-automatic'
// module-info.java:8: warning: requires transitive directive for an automatic module org.hamcrest
options.compilerArgs << '-Xlint:-requires-transitive-automatic'
options.compilerArgs << '-Werror'
options.encoding = 'UTF-8'
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
}
}
rootProject.tasks["sonarqube"].dependsOn(tasks["jacocoTestReport"])
sonarqube {
properties {
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "itsallcode"
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'Hamcrest auto-matcher'
description = 'Automatic hamcrest matcher for model classes'
url = 'https://github.com/itsallcode/hamcrest-auto-matcher'
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 = 'kaklakariada@chp1.net'
}
}
scm {
connection = 'scm:git:https://github.com/itsallcode/hamcrest-auto-matcher.git'
developerConnection = 'scm:git:https://github.com/itsallcode/hamcrest-auto-matcher.git'
url = 'https://github.com/itsallcode/hamcrest-auto-matcher'
}
}
}
}
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
nexusPublishing {
packageGroup = project.group
repositories {
sonatype {
stagingProfileId = "546ea6ce74787e"
}
}
}
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)
}
}