-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
143 lines (127 loc) · 3.63 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
plugins {
id("java-library")
id("maven-publish")
id("signing")
}
fun isSnapshotRelease(versionString: String): Boolean {
return versionString.endsWith("SNAPSHOT")
}
val githubProjectName = "jqwik-team"
val artifactId = "jqwik-mockito"
val moduleGroupId = "net.jqwik"
val junitJupiterVersion = "5.11.2"
val opentest4jVersion = "1.3.0"
val assertJVersion = "3.26.3"
val mockitoVersion = "4.11.0" // Mockito 5+ no longer supports Java 8
val jqwikVersion = "1.9.2"
val lombokVersion = "1.18.34"
val jqwikMockitoVersion = "1.0.1-SNAPSHOT"
val isSnapshotRelease = isSnapshotRelease(jqwikMockitoVersion)
group = moduleGroupId
version = jqwikMockitoVersion
description = "Jqwik Mockito support module"
repositories {
mavenCentral()
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots")
}
tasks.jar {
archiveBaseName.set(artifactId)
archiveVersion.set(jqwikMockitoVersion)
manifest {
attributes("Automatic-Module-Name" to "net.jqwik.mockito")
}
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
tasks.compileTestJava {
options.compilerArgs.add("-parameters")
options.encoding = "UTF-8"
}
tasks.test {
useJUnitPlatform {
includeEngines("jqwik")
}
}
dependencies {
api("org.opentest4j:opentest4j:${opentest4jVersion}")
api("net.jqwik:jqwik:${jqwikVersion}")
compileOnly("org.mockito:mockito-core:${mockitoVersion}")
compileOnly("org.mockito:mockito-junit-jupiter:${mockitoVersion}")
testCompileOnly("org.projectlombok:lombok:${lombokVersion}")
testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}")
testImplementation("org.junit.jupiter:junit-jupiter:${junitJupiterVersion}")
testImplementation("org.assertj:assertj-core:${assertJVersion}")
testImplementation("org.mockito:mockito-junit-jupiter:${mockitoVersion}")
}
publishing {
repositories {
maven {
// hint: credentials are in ~/.gradle/gradle.properties
// Since June 2024 Sonatype seems to require a token for publishing
val repoUsername: String = project.findProperty("tokenUsername") as? String ?: ""
val repoPassword: String = project.findProperty("tokenPassword") as? String ?: ""
credentials {
username = repoUsername
password = repoPassword
}
val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = uri(
if (isSnapshotRelease) {
snapshotsRepoUrl
} else {
releasesRepoUrl
}
)
}
}
publications {
create<MavenPublication>("jqwikMockito") {
groupId = moduleGroupId
artifactId = artifactId
from(components["java"])
pom {
groupId = moduleGroupId
name = artifactId
description = "Jqwik Mockito support module"
url = "https://github.org/$githubProjectName/$artifactId"
licenses {
license {
name = "Eclipse Public License - v 2.0"
url = "http://www.eclipse.org/legal/epl-v20.html"
}
}
developers {
developer {
id = "agustafson-atl"
name = "Andrew Gustafson"
email = "[email protected]"
}
developer {
id = githubProjectName
name = "Johannes Link"
email = "[email protected]"
}
}
scm {
connection = "scm:git:git://github.com/$githubProjectName/$artifactId.git"
developerConnection = "scm:git:git://github.com/$githubProjectName/$artifactId.git"
url = "https://github.com/$githubProjectName/$artifactId"
}
}
}
}
}
signing {
if (!isSnapshotRelease) {
sign(publishing.publications["jqwikMockito"])
}
}
tasks.wrapper {
gradleVersion = "8.11.1" // upgrade with: ./gradlew wrapper
}