-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
218 lines (194 loc) · 6.92 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// Plugin imports and declarations
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jreleaser.model.Active
import org.jreleaser.model.Distribution
plugins {
kotlin("jvm") version "1.9.25"
id("org.jreleaser") version "1.16.0"
id("com.palantir.git-version") version "3.1.0"
id("maven-publish")
}
// Root project configuration
val gitVersion: groovy.lang.Closure<String> by extra
group = "io.github.ludorival"
version = gitVersion().replace(".dirty", "-SNAPSHOT")
// Common configuration for all subprojects
subprojects {
group = rootProject.group
version = rootProject.version
apply {
plugin("kotlin")
plugin("org.jreleaser")
plugin("maven-publish")
}
repositories {
mavenCentral()
}
// Java configuration
java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
}
// Task configurations
tasks.getByName<Test>("test") {
useJUnitPlatform {
// Run non-contract tests first
includeTags("!contract-test")
}
}
tasks.register<Test>("contractTest") {
description = "Runs contract tests"
group = "verification"
useJUnitPlatform {
includeTags("contract-test")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
tasks.jar.configure {
manifest {
attributes(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
)
}
enabled = true
}
publishing {
publications {
create<MavenPublication>("main") {
from([email protected]("java"))
pom {
name.set("Pact JVM Mock (${[email protected]})")
description.set("Pact JVM Mock - Leverage existing Mocks (${[email protected]})")
url.set("https://github.com/ludorival/pact-jvm-mock")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("ludorival")
name.set("Ludovic Dorival")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/ludorival/pact-jvm-mock.git")
developerConnection.set("scm:git:ssh://github.com/ludorival/pact-jvm-mock.git")
url.set("https://github.com/ludorival/pact-jvm-mock")
}
}
}
}
repositories {
maven {
url = uri("$buildDir/staging-deploy")
}
}
}
// JReleaser configuration
jreleaser {
gitRootSearch.set(true)
project {
name.set([email protected])
description.set("Pact JVM Mock - Leverage existing Mocks (${[email protected]})")
copyright.set("Copyright 2023 Ludovic Dorival")
authors.set(listOf("Ludovic Dorival"))
license.set("The Apache Software License, Version 2.0")
links {
homepage.set("https://github.com/ludorival/pact-jvm-mock")
bugTracker.set("https://github.com/ludorival/pact-jvm-mock/issues")
}
inceptionYear.set("2024")
}
signing {
active.set(Active.ALWAYS)
armored.set(true)
}
deploy {
maven {
mavenCentral {
create("sonatype") {
applyMavenCentralRules.set(true)
password.set(System.getenv("MAVEN_CENTRAL_PASSWORD"))
username.set(System.getenv("MAVEN_CENTRAL_USERNAME"))
active.set(Active.ALWAYS)
url.set("https://central.sonatype.com/api/v1/publisher")
stagingRepository("build/staging-deploy")
}
}
}
}
}
tasks.withType<org.jreleaser.gradle.plugin.tasks.JReleaserDeployTask> {
dependsOn("createJReleaserDir")
}
tasks.register("createJReleaserDir") {
doFirst {
mkdir("$buildDir/jreleaser")
}
}
}
// Repository configuration for all projects
allprojects {
repositories {
mavenCentral()
}
}
// Individual project dependencies
project(":pact-jvm-mock") {
dependencies {
compileOnly("org.junit.jupiter:junit-jupiter-api:5.11.4")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.bitbucket.cowwoc.diff-match-patch:diff-match-patch:1.0")
implementation(kotlin("stdlib-jdk8"))
implementation("org.slf4j:slf4j-api:2.0.16")
api("au.com.dius.pact.core:model:4.6.16")
implementation("au.com.dius.pact.core:support:4.6.16")
}
}
project(":pact-jvm-mock-mockk") {
dependencies {
api(project(":pact-jvm-mock"))
compileOnly("io.mockk:mockk:1.13.16")
}
}
project(":pact-jvm-mock-mockito") {
dependencies {
api(project(":pact-jvm-mock"))
compileOnly("org.mockito:mockito-core:5.15.2")
}
}
project(":pact-jvm-mock-spring") {
dependencies {
api(project(":pact-jvm-mock"))
implementation(kotlin("stdlib-jdk8"))
compileOnly("org.springframework:spring-web:6.2.1")
compileOnly("com.fasterxml.jackson.core:jackson-databind:2.18.2")
}
}
project(":pact-jvm-mock-test") {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.springframework.boot:spring-boot-starter-web:3.0.2")
implementation("org.springframework:spring-web:6.0.4")
testImplementation("io.mockk:mockk:1.13.16")
testImplementation(project(":pact-jvm-mock-spring"))
testImplementation(project(":pact-jvm-mock-mockk"))
testImplementation(project(":pact-jvm-mock-mockito"))
testImplementation("io.github.ludorival:kotlin-tdd:2.2.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.4")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.11.4")
testImplementation("org.mockito:mockito-core:5.15.2")
testImplementation("org.mockito:mockito-junit-jupiter:5.15.2")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.2")
testImplementation("au.com.dius.pact.provider:junit5:4.6.16")
testImplementation("au.com.dius.pact.provider:junit5spring:4.6.16")
testImplementation("au.com.dius.pact.provider:spring:4.6.16")
}
}