-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
205 lines (170 loc) · 5.08 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
193
194
195
196
197
198
199
200
201
202
203
204
205
plugins {
id 'java-library'
id 'jacoco'
id 'com.diffplug.spotless' version '5.+'
id 'pmd'
id 'info.solidsoft.pitest' version '1.9.11'
id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
// For: ./gradlew --console plain jshell
id 'com.github.mrsarm.jshell.plugin' version '1.2.0'
}
group = 'so.dang.cool'
version = "3.0.2"
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
tasks.named('jacocoTestCoverageVerification') {
dependsOn test
}
tasks.named('build') {
dependsOn 'jacocoTestCoverageVerification', 'noGremlinsAllowed'
}
javadoc {
options.addBooleanOption('html5', true)
// Ignore warnings, especially for missing @param/@return, which is overkill.
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.named('jacocoTestCoverageVerification') {
violationRules {
rule {
limit {
// 100% minimum test coverage.
//
// My greatest opponent is myself. If I can discover what my weaknesses are,
// then I will be an even stronger fighter than I already am. -- Piccolo
minimum = 1.00
}
}
}
}
jacocoTestReport {
reports {
html.required = true
xml.required = true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
csv.required = true
csv.destination file("${buildDir}/reports/jacoco/report.csv")
}
}
pitest {
junit5PluginVersion = '1.0.0'
targetClasses = ['so.dang.cool.*']
outputFormats = ['XML', 'HTML']
timestampedReports = false
}
tasks.register('noGremlinsAllowed') {
dependsOn 'pitest'
doLast {
def mutations = new XmlParser().parse("${buildDir}/reports/pitest/mutations.xml")
def survivorCount = mutations.children().grep { it.attribute('status') != 'KILLED' }.size
if (survivorCount > 0) {
throw new Exception("$survivorCount gremlins survived! Details: ${buildDir}/reports/pitest/index.html")
}
}
}
spotless {
format 'misc', {
target '*.gradle', '*.md', '.gitignore'
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
java {
toggleOffOn('fmt:off', 'fmt:on')
importOrder()
removeUnusedImports()
prettier(['prettier': '2.3.0', 'prettier-plugin-java': '1.1.1']).config(['parser': 'java', 'tabWidth': 4])
}
}
tasks.register('fmt') {
dependsOn 'spotlessApply'
}
pmdTest {
rulesMinimumPriority = 2
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
maven(MavenPublication) {
artifactId = 'z'
from components.java
pom {
name = 'Z'
description = 'Function combinators'
url = 'https://github.com/so-dang-cool/z'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/so-dang-cool/z/blob/HEAD/LICENSE'
}
}
developers {
developer {
id = 'booniepepper'
name = 'J.R. Hill'
email = '[email protected]'
url = 'https://so.dang.cool'
}
}
contributors {
contributor {
name = 'Michael Ross'
url = 'https://github.com/madmikeross'
email = '[email protected]'
}
}
scm {
url = 'https://github.com/so-dang-cool/z'
connection = 'scm:git:git://github.com/so-dang-cool/z.git'
developerConnection = 'scm:git:git://github.com/so-dang-cool/z.git'
}
}
}
}
repositories {
maven {
url = layout.buildDirectory.dir('repo')
}
maven {
name = 'GitHubPackages'
url = 'https://maven.pkg.github.com/so-dang-cool/z'
credentials {
username = 'so-dang-cool'
password = System.getenv('GITHUB_TOKEN')
}
}
}
}
signing {
sign publishing.publications.maven
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
}
}
}
/* === Publishing ===
To Maven Central:
$ ./gradlew build publishToSonatype closeAndReleaseSonatypeStagingRepository
To GitHub Packages:
$ ./gradlew build publishAllPublicationsToGitHubPackagesRepository
*/