Skip to content

Commit 149d5fa

Browse files
committed
clean up build
1 parent ef1c847 commit 149d5fa

File tree

19 files changed

+45
-48
lines changed

19 files changed

+45
-48
lines changed

build.gradle.kts

+19-24
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ buildscript {
1515
classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.15")
1616
}
1717
}
18+
19+
val buildKotlinVersion: String by extra
20+
1821
plugins {
1922
id("org.jetbrains.kotlin.jvm") version "1.4.32"
2023
id("org.jetbrains.kotlin.plugin.allopen") version "1.4.32"
2124
id("org.jlleitschuh.gradle.ktlint") version "10.1.0"
2225
id("org.jetbrains.dokka") version "1.4.32"
23-
id("com.github.hierynomus.license-base").version("0.15.0")
24-
id("com.github.spotbugs") version "4.7.1"
25-
id("io.gitlab.arturbosch.detekt") version "1.16.0"
26+
id("com.github.hierynomus.license-base").version("0.16.1")
27+
id("com.github.spotbugs") version "4.7.2"
28+
id("io.gitlab.arturbosch.detekt") version "1.18.0-RC2"
2629
signing
2730
`maven-publish`
2831
`java-library`
@@ -57,10 +60,8 @@ subprojects {
5760
apply(plugin = "maven-publish")
5861
apply(plugin = "distribution")
5962
apply(plugin = "org.jetbrains.kotlin.jvm")
60-
// apply(plugin = "org.jlleitschuh.gradle.ktlint")
6163
apply(plugin = "org.jetbrains.dokka")
6264
apply(plugin = "com.github.hierynomus.license-base")
63-
// apply(plugin = "checkstyle")
6465
apply(plugin = "jacoco")
6566
if (!isKotlinModule(this)) {
6667
// logger.warn("This project is not kotlin: ${this.name}")
@@ -74,19 +75,28 @@ subprojects {
7475
}
7576
if (isKotlinModule(this)) {
7677
apply(plugin = "io.gitlab.arturbosch.detekt")
78+
detekt {
79+
// Version of Detekt that will be used. When unspecified the latest detekt
80+
// version found will be used. Override to stay on the same version.
81+
toolVersion = "1.18.0-RC2"
82+
83+
// The directories where detekt looks for source files.
84+
// Defaults to `files("src/main/java", "src/main/kotlin")`.
85+
input = files("src/main/java", "src/main/kotlin")
86+
config = files("${rootDir.path}/detektConfig.yml")
87+
}
7788
}
7889
tasks.withType<com.hierynomus.gradle.license.tasks.LicenseFormat>().configureEach {
7990
this.header = File(this.project.rootDir, "HEADER")
8091
this.exclude("*.xml", "*.json")
8192
this.mapping(mapOf("java" to "SLASHSTAR_STYLE", "kt" to "SLASHSTAR_STYLE"))
8293
}
8394

84-
// if("floodplain-elasticsearch" != name) {
8595
tasks.test {
8696
useJUnitPlatform()
8797
jvmArgs("--enable-preview")
8898
}
89-
// }
99+
90100
tasks.withType<com.hierynomus.gradle.license.tasks.LicenseCheck>().configureEach {
91101
this.header = File(this.project.rootDir, "HEADER")
92102
this.exclude("*.xml", "*.json")
@@ -112,10 +122,6 @@ subprojects {
112122

113123
val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)
114124

115-
// val dokkaHtml = tasks.named<org.jetbrains.dokka.gradle.DokkaTask>("dokkaHtml").configure {
116-
// // outputDirectory = buildDir.resolve("dokka").absolutePath
117-
// }
118-
119125
tasks {
120126
val sourcesJar by creating(Jar::class) {
121127
archiveClassifier.set("sources")
@@ -187,17 +193,6 @@ subprojects {
187193
}
188194
}
189195

190-
detekt {
191-
// Version of Detekt that will be used. When unspecified the latest detekt
192-
// version found will be used. Override to stay on the same version.
193-
toolVersion = "1.18.0-RC2"
194-
195-
// The directories where detekt looks for source files.
196-
// Defaults to `files("src/main/java", "src/main/kotlin")`.
197-
input = files("src/main/java", "src/main/kotlin")
198-
config = files("${projectDir.path}/detektConfig.yml")
199-
}
200-
201196
fun customizePom(publication: MavenPublication) {
202197
with(publication.pom) {
203198
withXml {
@@ -237,7 +232,7 @@ fun customizePom(publication: MavenPublication) {
237232
}
238233

239234
val detektAll by tasks.registering(Detekt::class) {
240-
this.config.setFrom("${projectDir.path}/detektConfig.yml")
235+
this.config.setFrom("${rootDir.path}/detektConfig.yml")
241236
description = "Runs over whole code base without the starting overhead for each module."
242237
parallel = true
243238
buildUponDefaultConfig = true
@@ -348,7 +343,7 @@ tasks.register<JacocoReport>("codeCoverageReport") {
348343
tasks.withType<Test> {
349344
useJUnitPlatform {
350345
includeEngines = setOf("junit-jupiter")
351-
//this.includeTags = setOf("*")
346+
// this.includeTags = setOf("*")
352347
}
353348
testLogging {
354349
events("passed", "skipped", "failed")

buildSrc/build.gradle.kts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
2+
val buildKotlin = "1.4.32"
3+
14
plugins {
25
`kotlin-dsl`
3-
id("org.jetbrains.kotlin.jvm").version("1.4.31")
4-
id("org.jetbrains.dokka").version("1.4.10.2")
56
id("io.gitlab.arturbosch.detekt").version ("1.14.1")
67

78
}
@@ -10,4 +11,5 @@ repositories {
1011
mavenLocal()
1112
mavenCentral()
1213
gradlePluginPortal()
14+
// maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
1315
}

buildSrc/src/main/kotlin/Dependencies.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package io.floodplain.build
22

3-
object Versions {
3+
object FloodplainPlugins {
44
const val kotlin = "1.4.32"
5-
65
}
76

87
object Libs {
9-
const val kotlin = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlin}"
8+
const val kotlin = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${FloodplainPlugins.kotlin}"
109
}
1110

1211
fun isReleaseVersion(): Boolean {
1312
return !FloodplainDeps.floodplain_version.endsWith("SNAPSHOT")
1413
}
1514

1615
object FloodplainDeps {
16+
const val kotlin = FloodplainPlugins.kotlin
1717
const val floodplain_version = "1.5.21-SNAPSHOT"
1818
const val jackson_version = "2.12.4"
1919
const val kafka_version = "2.8.0"

detektConfig.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
exceptions:
22
SwallowedException:
3-
active: false
4-
excludes: ['**/Chunk.kt']
3+
excludes: ['io/floodplain/external/**']
54

65
formatting:
76
MaximumLineLength:
@@ -25,7 +24,7 @@ style:
2524
max: 2
2625

2726
build:
28-
maxIssues: 45 # break the build if more than ten weighted issues are found
27+
maxIssues: 145 # break the build if more than ten weighted issues are found
2928
weights:
3029
complexity: 2 # every rule of the complexity rule set should count as if two issues were found...
3130
LongParameterList: 1 # ...with the exception of the LongParameterList rule.

floodplain-api/src/main/kotlin/io/floodplain/Chunk.kt floodplain-api/src/main/kotlin/io/floodplain/external/Chunk.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package io.floodplain
19+
package io.floodplain.external
2020

2121
import kotlinx.coroutines.channels.ClosedReceiveChannelException
2222
import kotlinx.coroutines.channels.produce
@@ -37,6 +37,7 @@ import kotlinx.coroutines.selects.select
3737
* @param duration: The operation will not wait longer for entries than this number (in millis)
3838
*/
3939
@OptIn(kotlinx.coroutines.ObsoleteCoroutinesApi::class)
40+
@Suppress("SwallowedException")
4041
fun <T> Flow<T>.bufferTimeout(size: Int, duration: Long): Flow<List<T>> {
4142
require(size > 0) { "Window size should be greater than 0" }
4243
require(duration > 0) { "Duration should be greater than 0" }

floodplain-debezium/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ dependencies {
55
implementation(FloodplainDeps.debeziumMySQL)
66
compile(FloodplainDeps.kotlinLogging)
77
implementation(project(":floodplain-api"))
8-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
98
implementation(FloodplainDeps.kotlinCoroutines)
109
testImplementation(project(":floodplain-dsl"))
1110
testImplementation(project(":floodplain-test"))

floodplain-debezium/src/main/kotlin/io/floodplain/debezium/postgres/DebeziumSource.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import kotlin.system.measureTimeMillis
4141

4242
private val logger = mu.KotlinLogging.logger {}
4343

44+
private const val OFFSETFILELENGTH = 7
45+
private const val SENDBLOCKING_WARN_THRESHOLD = 1000
4446
internal class EngineKillSwitch(var engine: DebeziumEngine<ChangeEvent<String, String>>? = null) {
4547

4648
private val killed = AtomicBoolean(false)
@@ -56,7 +58,7 @@ internal class EngineKillSwitch(var engine: DebeziumEngine<ChangeEvent<String, S
5658

5759
@OptIn(ExperimentalPathApi::class)
5860
private fun createOffsetFilePath(offsetId: String?): Path {
59-
val tempFile = createTempFile(offsetId ?: UUID.randomUUID().toString().substring(0..7))
61+
val tempFile = createTempFile(offsetId ?: UUID.randomUUID().toString().substring(0..OFFSETFILELENGTH))
6062
if (offsetId == null) {
6163
tempFile.toFile().deleteOnExit()
6264
}
@@ -127,6 +129,7 @@ fun createDebeziumChangeFlow(
127129
return runDebeziumServer(props)
128130
}
129131

132+
@Suppress("SwallowedException")
130133
private fun ProducerScope<ChangeRecord>.createEngine(
131134
props: Properties,
132135
engineKillSwitch: EngineKillSwitch
@@ -152,7 +155,7 @@ private fun ProducerScope<ChangeRecord>.createEngine(
152155
Thread.currentThread().interrupt()
153156
}
154157
}
155-
if (perf > 1000) {
158+
if (perf > SENDBLOCKING_WARN_THRESHOLD) {
156159
logger.debug("Send blocking ran for: $perf")
157160
}
158161
}

floodplain-dsl/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ dependencies {
2222
implementation(FloodplainDeps.argParser)
2323
implementation(FloodplainDeps.jacksonDatabind310)
2424
implementation(FloodplainDeps.kafkaConnectRuntime)
25-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
2625
implementation(FloodplainDeps.kotlinCoroutines)
2726
testImplementation("org.junit.jupiter:junit-jupiter:${FloodplainDeps.junit_5_version}")
2827
}

floodplain-dsl/src/main/kotlin/io/floodplain/kotlindsl/LocalRuntime.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package io.floodplain.kotlindsl
2020

21-
import io.floodplain.bufferTimeout
21+
import io.floodplain.external.bufferTimeout
2222
import io.floodplain.kotlindsl.message.IMessage
2323
import io.floodplain.kotlindsl.message.fromImmutable
2424
import io.floodplain.replication.api.ReplicationMessage

floodplain-dsl/src/test/kotlin/io/floodplain/kotlindsl/TestOutputFlow.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package io.floodplain.kotlindsl
2020

21-
import io.floodplain.bufferTimeout
21+
import io.floodplain.external.bufferTimeout
2222
import io.floodplain.kotlindsl.message.IMessage
2323
import io.floodplain.kotlindsl.message.empty
2424
import io.floodplain.streams.api.Topic

floodplain-elasticsearch/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import io.floodplain.build.FloodplainDeps
22

33
dependencies {
44
compile(FloodplainDeps.kotlinLogging)
5-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
65
implementation(project(":floodplain-stream-topology"))
76
implementation(project(":streams-api"))
87
implementation(project(":streams"))

floodplain-example/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ dependencies {
2323
implementation("io.confluent:kafka-connect-elasticsearch:5.5.0")
2424
implementation(FloodplainDeps.kotlinCoroutines)
2525
compile(FloodplainDeps.slf4j)
26-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
2726
testImplementation("org.junit.jupiter:junit-jupiter:${FloodplainDeps.junit_5_version}")
2827
}

floodplain-fhir/build.gradle.kts

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ dependencies {
55
implementation(FloodplainDeps.jacksonCore)
66
implementation(FloodplainDeps.jacksonDatabind)
77
implementation(FloodplainDeps.jacksonDatabind310)
8-
9-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
108
implementation(project(":floodplain-stream-topology"))
119
implementation(project(":floodplain-dsl"))
1210
implementation(project(":replication-api"))

floodplain-googlesheets/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import io.floodplain.build.FloodplainDeps
66

77
dependencies {
88
compile(FloodplainDeps.kotlinLogging)
9-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
109
implementation(project(":floodplain-stream-topology"))
1110
// This dependency is exported to consumers, that is to say found on their compile classpath.
1211
implementation("org.apache.commons:commons-math3:3.6.1")

floodplain-integration/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import io.floodplain.build.FloodplainDeps
33
dependencies {
44
api(FloodplainDeps.slf4j)
55
compile(FloodplainDeps.kotlinLogging)
6-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
76
implementation(project(":floodplain-stream-topology"))
87
implementation(project(":immutable-api"))
98
implementation(project(":streams-api"))

floodplain-mongodb/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import io.floodplain.build.FloodplainDeps
22

33
dependencies {
44
compile(FloodplainDeps.kotlinLogging)
5-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
65
implementation(project(":floodplain-stream-topology"))
76
implementation("org.mongodb.kafka:mongo-kafka-connect:1.6.0")
87
implementation(FloodplainDeps.kafkaConnectRuntime)

floodplain-test/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ dependencies {
44
implementation(FloodplainDeps.testContainer)
55
implementation(FloodplainDeps.testContainerKafka)
66
implementation(FloodplainDeps.kotlinLogging)
7-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
87
}

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#Gradle properties
22
systemProp.org.gradle.internal.publish.checksums.insecure=true
3-
kotlinVersion=1.4.31
3+
buildKotlinVersion=1.4.32
44
org.gradle.jvmargs=-Xmx1024m

settings.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
* in the user manual at https://docs.gradle.org/5.6.2/userguide/multi_project_builds.html
88
*/
99

10+
pluginManagement {
11+
val buildKotlinVersion: String by settings
12+
plugins {
13+
id("org.jetbrains.kotlin.jvm").version(buildKotlinVersion)
14+
id("org.jetbrains.dokka").version(buildKotlinVersion)
15+
}
16+
}
1017
rootProject.name = "floodplain-library"
1118
include(
1219
"immutable-api",

0 commit comments

Comments
 (0)