-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
183 lines (161 loc) · 4.41 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
plugins {
id 'jacoco'
id 'java-library'
id 'maven-publish'
id 'com.diffplug.spotless' version '6.13.0' // https://github.com/diffplug/spotless/issues/1337
id 'com.github.ben-manes.versions' version '0.51.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'net.researchgate.release' version '3.0.2'
id 'ru.vyarus.quality' version '5.0.0'
}
group = 'com.github.tueda'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
def versions = [
checkstyle: '10.13.0',
junit: '5.10.2',
lombok: '1.18.30',
pmd: '6.55.0',
rings: '2.5.8',
spotbugs: '4.8.3',
truth: '1.4.0',
]
repositories {
mavenCentral()
}
dependencies {
api "cc.redberry:rings:${versions.rings}"
compileOnly "com.github.spotbugs:spotbugs-annotations:${versions.spotbugs}"
compileOnly "org.projectlombok:lombok:${versions.lombok}"
annotationProcessor "org.projectlombok:lombok:${versions.lombok}"
testImplementation "com.google.truth:truth:${versions.truth}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${versions.junit}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${versions.junit}"
// for dependencyUpdates
testRuntimeOnly "net.sourceforge.pmd:pmd:${versions.pmd}"
}
javadoc {
options {
if (JavaVersion.current().isJava10Compatible()) {
// javadoc in JDK 10 requires element-list.
links("https://docs.oracle.com/en/java/javase/11/docs/api/")
} else {
links("https://docs.oracle.com/javase/8/docs/api/")
}
links("https://www.javadoc.io/doc/cc.redberry/rings/${versions.rings}/")
addStringOption("tag", "apiNote:a:API Note:")
// Fail if any warnings are encountered.
if (JavaVersion.current().isJava8Compatible()) {
addBooleanOption('Xdoclint', true)
if (JavaVersion.current().isJava10Compatible()) {
// Ignore "Error fetching URL" warnings in JDK < 10.
addBooleanOption('Xwerror', true)
}
if (JavaVersion.current().isJava10()) {
// Need to specify HTML4 or HTML5.
addBooleanOption('html4', true)
}
}
}
}
test {
useJUnitPlatform()
exclude '**/ImmutabilityTest.class'
testLogging {
events 'failed'
exceptionFormat 'full'
}
}
task testWithoutCoverage(type: Test) {
useJUnitPlatform()
include '**/ImmutabilityTest.class'
}
check.dependsOn testWithoutCoverage
spotless {
java {
googleJavaFormat('1.7')
}
groovyGradle {
greclipse().configFile('config/greclipse.properties')
}
}
configurations {
checkstyleConfig
}
// See: https://github.com/google/guava/releases/tag/v32.1.0
configurations.all {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
dependencies {
checkstyleConfig("com.puppycrawl.tools:checkstyle:${versions.checkstyle}") {
transitive = false
}
}
quality {
checkstyleVersion = versions.checkstyle
pmdVersion = versions.pmd
spotbugsVersion = versions.spotbugs
spotbugsEffort = 'max'
spotbugsLevel = 'low'
}
afterEvaluate {
checkstyle {
config = resources.text.fromArchiveEntry(configurations.checkstyleConfig, 'google_checks.xml')
}
pmd {
incrementalAnalysis = true
ruleSetFiles = files('config/pmd.xml')
}
}
shadowJar {
minimize()
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'Donuts'
description = 'A wrapper library for Rings'
url = 'https://github.com/tueda/donuts'
inceptionYear = '2021'
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
distribution = 'repo'
}
}
developers {
developer {
id = 'tueda'
name = 'Takahiro Ueda'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:https://github.com/tueda/donuts.git'
developerConnection = 'scm:git:https://github.com/tueda/donuts.git'
url = 'https://github.com/tueda/donuts'
}
}
}
}
}
// See researchgate/gradle-release#107
project.tasks.release.dependsOn check
release {
tagTemplate = 'v${version}'
}