-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
184 lines (158 loc) · 4.02 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
buildscript {
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
plugins {
id('checkstyle')
id('jacoco')
id('java-library')
id('maven-publish')
id('signing')
alias(libs.plugins.mrjar)
alias(libs.plugins.prettyJupiter)
alias(libs.plugins.publishPlugin)
alias(libs.plugins.sonarlint)
alias(libs.plugins.strictNullCheck)
}
group = 'io.github.joselion'
multiRelease {
targetVersions(11, 17, 22)
}
java {
toolchain {
vendor = JvmVendorSpec.ORACLE
}
withJavadocJar()
withSourcesJar()
}
javadoc {
title = 'Maybe - Safely handle exceptions'
options {
addBooleanOption('html5', true)
addStringOption('Xwerror', '-quiet')
tags('apiNote')
}
}
jar {
from(sourceSets.main.allSource)
manifest {
attributes(
'Build-Jdk': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-Jdk-Spec': java.sourceCompatibility,
'Created-By': "Gradle ${gradle.gradleVersion}",
'Implementation-Title': project.name,
'Implementation-Vendor': 'Jose Luis Leon',
'Implementation-Version': project.version,
'Package': "${project.group}.${project.name}",
)
}
}
strictNullCheck {
addEclipse()
packageInfo {
useEclipse()
javadoc = '@author Jose Luis Leon'
}
}
sonarLint {
languages {
include('java')
}
rules {
enable(
'java:S4266', // "Stream.collect()" calls should not be redundant
)
disable(
'java:S107', // Allow constructors with more than 7 parameters
'java:S3776', // Allow methods with more than 15 lines
'java:S4032', // Allow packages only containing `package-info.java`
)
}
}
checkstyle {
setToolVersion(libs.versions.checkstyle.get())
setMaxWarnings(0)
}
dependencyLocking {
lockAllConfigurations()
}
repositories {
mavenCentral()
}
dependencies {
sonarlintCorePlugins(libs.sonarlint.java)
}
testing {
suites {
test {
useJUnitJupiter(libs.versions.junit.get())
dependencies {
implementation(libs.assertj)
implementation(libs.mockito)
}
}
}
}
java17Test.useJUnitPlatform()
java22Test.useJUnitPlatform()
jacoco {
setToolVersion(libs.versions.jacoco.get())
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
pom {
name = 'maybe'
packaging = 'jar'
description = """\
Maybe<T> is a monadic wrapper similar java.util.Optional, but with a different intention. \
By leveraging Optional<T> benefits, it provides a functional API that safely allows us to \
perform operations that may or may not throw checked and unchecked exceptions.
The wrapper intends to help us avoid the imperative try/catch syntax, while promoting safe \
exception handling and functional programming principles.
"""
url = 'https://github.com/JoseLion/maybe'
scm {
connection = 'scm:git:https://github.com/JoseLion/maybe.git'
developerConnection = 'scm:git:ssh://github.com/JoseLion/maybe.git'
url = 'https://github.com/JoseLion/maybe'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'JoseLion'
name = "Jose Luis Leon"
email = '[email protected]'
}
}
}
}
}
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications.mavenJava)
}
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri('https://s01.oss.sonatype.org/service/local/')
snapshotRepositoryUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')
}
}
}