-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
161 lines (136 loc) · 5.11 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
import java.util.*
project(":commons").version = "2.4.0-SNAPSHOT"
project(":outbox-kafka-spring").version = "3.5.0-SNAPSHOT"
project(":outbox-kafka-spring-reactive").version = "3.4.0-SNAPSHOT"
plugins {
id("java-library")
id("java-test-fixtures")
id("io.freefair.lombok") version "8.11"
id("com.google.protobuf") version "0.9.4"
id("maven-publish")
id("jacoco")
id("com.github.hierynomus.license") version "0.16.1"
id("signing")
}
val protobufVersion by extra("3.25.5")
subprojects {
apply(plugin = "java-library")
apply(plugin = "java-test-fixtures")
apply(plugin = "io.freefair.lombok")
apply(plugin = "com.google.protobuf")
apply(plugin = "maven-publish")
apply(plugin = "jacoco")
apply(plugin = "com.github.hierynomus.license")
apply(plugin = "signing")
group = "one.tomorrow.transactional-outbox"
java {
sourceCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
registerFeature("protobufSupport") {
usingSourceSet(sourceSets["main"])
}
}
tasks.withType<JavaCompile> {
options.compilerArgs.addAll(listOf("-Xlint:deprecation"))
}
tasks.withType<Javadoc> {
(options as StandardJavadocDocletOptions).addBooleanOption("Xdoclint:none", true)
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
}
license {
header = file("../LICENSE-header.txt")
excludes(
setOf(
"one/tomorrow/kafka/messages/DeserializerMessages.java",
"one/tomorrow/transactionaloutbox/test/Sample.java",
"one/tomorrow/transactionaloutbox/reactive/test/Sample.java"
)
) // java sources generated from proto messages
include("**/*.java")
ext["year"] = Calendar.getInstance().get(Calendar.YEAR)
skipExistingHeaders = true
}
val subproject = this
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
pom {
name.set("$groupId:$artifactId")
description.set("${subproject.name} module of transactional-outbox library, check README for details.")
url.set("https://github.com/tomorrow-one/transactional-outbox")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("magro")
name.set("Martin Grotzke")
email.set("[email protected]")
}
}
scm {
url.set("https://github.com/tomorrow-one/transactional-outbox/")
connection.set("scm:git:git://github.com/tomorrow-one/transactional-outbox.git")
developerConnection.set("scm:git:ssh://github.com/tomorrow-one/transactional-outbox.git")
}
}
}
}
repositories {
mavenLocal()
maven {
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 (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
credentials {
val ossrhUsername: String? by project
val ossrhPassword: String? by project
username = ossrhUsername
password = ossrhPassword
}
}
}
}
// 'signing' has to be defined after/below 'publishing' so that it can reference the publication
signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications["maven"])
}
}
allprojects {
repositories {
mavenCentral()
}
tasks.withType<Test> {
jvmArgs(listOf("--add-opens=java.base/java.lang=ALL-UNNAMED"))
maxHeapSize = "4g"
useJUnitPlatform()
testLogging {
events(SKIPPED, PASSED, FAILED)
showStandardStreams = false // change to true to get log output from tests
exceptionFormat = FULL
}
finalizedBy("jacocoTestReport")
}
tasks.withType<JacocoReport> {
reports {
xml.required.set(true)
xml.outputLocation.set(File("build/reports/jacoco.xml"))
executionData(tasks.withType<Test>())
}
}
}