-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
127 lines (110 loc) · 3.51 KB
/
build.gradle.kts
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
plugins {
java
`maven-publish`
jacoco
signing
id("com.github.ben-manes.versions") version "0.39.0"
}
group = "me.hltj"
version = "1.1.2"
repositories {
mavenCentral()
}
val vertxVersion = "4.2.1"
dependencies {
val lombokDependency = "org.projectlombok:lombok:1.18.22"
compileOnly(lombokDependency)
annotationProcessor(lombokDependency)
implementation(group = "io.vertx", name = "vertx-core", version = vertxVersion)
testCompileOnly(lombokDependency)
testAnnotationProcessor(lombokDependency)
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter", version = "5.8.1")
}
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
val javaApiDocUrl = JavaVersion.current().run {
if (isJava11Compatible)
"https://docs.oracle.com/en/java/javase/$majorVersion/docs/api/"
else
"https://docs.oracle.com/javase/8/docs/api/"
}
tasks.javadoc {
with(options as StandardJavadocDocletOptions) {
locale = "en_US"
encoding = "UTF-8"
links = listOf(javaApiDocUrl, "https://javadoc.io/doc/io.vertx/vertx-core/$vertxVersion/")
addStringOption("Xdoclint:none", "-quiet")
}
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}
jacoco {
toolVersion = "0.8.7"
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required.set(true)
xml.outputLocation.set(file("$buildDir/reports/jacoco/report.xml"))
csv.required.set(false)
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("Vert.x Future Utils")
description.set("Convenient Utilities for Vert.x Future")
url.set("https://github.com/hltj/vertx-future-utils")
licenses {
license {
name.set("GNU Lesser General Public License")
url.set("https://www.gnu.org/licenses/lgpl-3.0.txt")
}
}
developers {
developer {
id.set("hltj")
name.set("JiaYanwei")
email.set("[email protected]")
}
}
scm {
url.set("https://github.com/hltj/vertx-future-utils.git")
}
}
}
}
repositories {
maven {
name = "sonatype"
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = propertyOrEnv("ossrhUsername", "OSSRH_USER")
password = propertyOrEnv("ossrhPassword", "OSSRH_PASS")
}
}
}
}
fun propertyOrEnv(propertyName: String, envName: String) =
project.properties[propertyName]?.toString() ?: System.getenv(envName)
signing {
sign(publishing.publications["mavenJava"])
}
tasks.dependencyUpdates {
rejectVersionIf {
isNonStable(candidate.version)
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { it in version.toUpperCase() }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
return !stableKeyword && !regex.matches(version)
}