-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
155 lines (135 loc) · 4.64 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
144
145
146
147
148
149
150
151
152
153
154
155
plugins {
id("java-library")
id("maven-publish")
id("signing")
id("com.diffplug.spotless") version "6.13.0"
}
fun isSnapshotRelease(versionString: String): Boolean {
return versionString.endsWith("SNAPSHOT")
}
val githubProjectName = "agustafson-atl"
val artifactId = "jqwik-mockito"
val moduleGroupId = "net.jqwik"
val moduleName = "net.jqwik.mockito"
val junitPlatformVersion = "1.11.2"
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.1"
val lombokVersion = "1.18.34"
val jqwikMockitoVersion = "0.0.1-SNAPSHOT"
val isSnapshotRelease = isSnapshotRelease(jqwikMockitoVersion)
repositories {
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}
group = moduleName
version = jqwikMockitoVersion
tasks.jar {
archiveBaseName.set(artifactId)
archiveVersion.set(jqwikMockitoVersion)
manifest {
attributes("Automatic-Module-Name" to moduleName)
}
}
spotless {
java {
palantirJavaFormat("1.1.0")
importOrder("", "java|javax", "\\#")
removeUnusedImports()
}
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
tasks.compileTestJava {
options.compilerArgs.add("-parameters")
options.encoding = "UTF-8"
}
tasks.named("check") {
dependsOn(tasks.named("spotlessApply"))
}
tasks.test {
useJUnitPlatform {
includeEngines("jqwik")
}
include("**/*Properties.class")
include("**/*Example.class")
include("**/*Examples.class")
include("**/*Test.class")
include("**/*Tests.class")
}
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: password is in ~/.gradle/gradle.properties
val ossrhUsername: String = project.findProperty("ossrhUsername") as? String ?: ""
val ossrhPassword: String = project.findProperty("ossrhPassword") as? String ?: ""
credentials {
username = ossrhUsername
password = ossrhPassword
}
// change URLs to point to your repos, e.g. http://my.org/repo
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"])
}
}