Skip to content

Commit

Permalink
Merge pull request #154 from RADAR-base/release-1.1.2
Browse files Browse the repository at this point in the history
Release 1.1.2
  • Loading branch information
pvannierop committed Mar 8, 2024
2 parents ab089c0 + 4b7ef26 commit b38ec53
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 57 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{kt,kts}]
ktlint_standard_no-wildcard-imports = disabled

[*.md]
trim_trailing_whitespace = false

[*.{json,yaml,yml}]
indent_style = space
indent_size = 2
3 changes: 1 addition & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# These owners will be the default owners for everything in the repo.
# Unless a later match takes precedence, they will be requested for review when someone
# opens a pull request.
* @blootsvoets
testing/* @nivemaham @fnobilia
* @bdegraaf1234
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repositories {
}
dependencies {
implementation("org.radarbase:radar-commons:1.1.1")
implementation("org.radarbase:radar-commons:1.1.2")
}
```

Expand Down Expand Up @@ -62,7 +62,7 @@ repositories {
}
dependencies {
implementation("org.radarbase:radar-commons-server:1.1.1")
implementation("org.radarbase:radar-commons-server:1.1.2")
}
```

Expand All @@ -75,7 +75,7 @@ repositories {
}
dependencies {
testImplementation("org.radarbase:radar-commons-testing:1.1.1")
testImplementation("org.radarbase:radar-commons-testing:1.1.2")
}
```

Expand All @@ -102,7 +102,7 @@ configurations.all {
}
dependencies {
implementation("org.radarbase:radar-commons:1.1.2-SNAPSHOT")
implementation("org.radarbase:radar-commons:1.1.3-SNAPSHOT")
}
```

Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ subprojects {
githubUrl.set("https://github.com/$githubRepoName")
developers {
developer {
id.set("blootsvoets")
name.set("Joris Borgdorff")
email.set("joris@thehyve.nl")
id.set("bdegraaf1234")
name.set("Bastiaan de Graaf")
email.set("bastiaan@thehyve.nl")
organization.set("The Hyve")
}
developer {
Expand Down
1 change: 0 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ repositories {
mavenCentral()
}


tasks.withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
Expand Down
14 changes: 10 additions & 4 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
@Suppress("ConstPropertyName", "MemberVisibilityCanBePrivate")
object Versions {
const val project = "1.1.1"
const val project = "1.1.2"

object Plugins {
const val kotlin = "1.9.10"
const val licenseReport = "2.5"
const val kotlin = "1.9.21"
const val dokka = "1.9.10"
const val kotlinSerialization = kotlin
const val kotlinAllOpen = kotlin
const val avro = "1.8.0"
const val gradle = "8.3"
const val publishPlugin = "2.0.0-rc-1"
}

const val java = 11
const val java = 17
const val slf4j = "2.0.9"
const val confluent = "7.5.0"
const val kafka = "7.5.0-ce"
Expand All @@ -25,6 +28,9 @@ object Versions {
const val opencsv = "5.8"
const val ktor = "2.3.4"
const val coroutines = "1.7.3"
const val commonsCompress = "1.24.0"
const val commonsCompress = "1.26.0"
const val snappy = "1.1.10.5"
const val guava = "32.1.1-jre"
const val gradleVersionsPlugin = "0.50.0"
const val ktlint = "12.0.3"
}
70 changes: 56 additions & 14 deletions radar-commons-gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
`java-gradle-plugin`
kotlin("jvm") version "1.9.0"
// Match to the versions in the bottom of this file
kotlin("jvm") version "1.9.21"
`maven-publish`
id("io.github.gradle-nexus.publish-plugin") version "2.0.0-rc-1"
id("org.jetbrains.dokka") version "1.9.0"
id("org.jetbrains.dokka") version "1.9.10"
signing
}

version = "1.1.1"
version = "1.1.2"
group = "org.radarbase"
description = "RADAR-base common Gradle plugin setup"

Expand All @@ -23,12 +24,12 @@ repositories {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.0")
implementation("com.github.ben-manes:gradle-versions-plugin:0.48.0")
implementation("io.github.gradle-nexus:publish-plugin:2.0.0-rc-1")
implementation("org.jlleitschuh.gradle:ktlint-gradle:11.6.0")
implementation("com.github.jk1.dependency-license-report:com.github.jk1.dependency-license-report.gradle.plugin:2.5")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.Plugins.kotlin}")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${Versions.Plugins.dokka}")
implementation("com.github.ben-manes:gradle-versions-plugin:${Versions.gradleVersionsPlugin}")
implementation("io.github.gradle-nexus:publish-plugin:${Versions.Plugins.publishPlugin}")
implementation("org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktlint}")
implementation("com.github.jk1.dependency-license-report:com.github.jk1.dependency-license-report.gradle.plugin:${Versions.Plugins.licenseReport}")
}

gradlePlugin {
Expand All @@ -53,11 +54,12 @@ gradlePlugin {
}

tasks.withType<JavaCompile> {
options.release.set(11)
options.release.set(Versions.java)
}

tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
jvmTarget.set(JvmTarget.JVM_17)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
}
Expand Down Expand Up @@ -102,9 +104,9 @@ tasks.withType<GenerateMavenPom> {
}
developers {
developer {
id.set("blootsvoets")
name.set("Joris Borgdorff")
email.set("joris@thehyve.nl")
id.set("bdegraaf1234")
name.set("Bastiaan de Graaf")
email.set("bastiaan@thehyve.nl")
organization.set("The Hyve")
}
}
Expand Down Expand Up @@ -169,3 +171,43 @@ tasks.withType<Sign> {
tasks.withType<PublishToMavenRepository> {
dependsOn(tasks.withType<Sign>())
}

// Because this project is where all the required plugins get built, we need to add the dependencies separately here.
// They should be copied from the Versions.kt file directly to maintain consistency.
@Suppress("ConstPropertyName", "MemberVisibilityCanBePrivate")
object Versions {
const val project = "1.1.2"

object Plugins {
const val licenseReport = "2.5"
const val kotlin = "1.9.21"
const val dokka = "1.9.10"
const val kotlinSerialization = kotlin
const val kotlinAllOpen = kotlin
const val avro = "1.8.0"
const val gradle = "8.3"
const val publishPlugin = "2.0.0-rc-1"
}

const val java = 17
const val slf4j = "2.0.9"
const val confluent = "7.5.0"
const val kafka = "7.5.0-ce"
const val avro = "1.11.3"
const val jackson = "2.15.2"
const val okhttp = "4.11.0"
const val junit = "5.10.0"
const val mockito = "5.5.0"
const val mockitoKotlin = "5.1.0"
const val hamcrest = "2.2"
const val radarSchemas = "0.8.4"
const val opencsv = "5.8"
const val ktor = "2.3.4"
const val coroutines = "1.7.3"
const val commonsCompress = "1.26.0"
const val snappy = "1.1.10.5"
const val guava = "32.1.1-jre"
const val gradleVersionsPlugin = "0.50.0"
const val ktlint = "12.0.3"
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface RadarDependencyManagementExtension {
class RadarDependencyManagementPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = with(project) {
val extension = extensions.create<RadarDependencyManagementExtension>("radarDependencies").apply {
regex.convention("(^[0-9,.v-]+(-r)?|RELEASE|FINAL|GA|-CE)$")
regex.convention("(^[0-9,.v-]+(-r)?|RELEASE|FINAL|GA|-CE|-JRE|-ANDROID)$")
rejectMajorVersionUpdates.convention(false)
}

Expand Down
2 changes: 1 addition & 1 deletion radar-commons-kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ First of all, it contains a cache implementation to use with coroutines, with su
import java.io.IOException

val dirCache = CachedMap<String, FileInfo> {
withContext(Dispatchers.IO) {
runInterruptible(Dispatchers.IO) {
client.fetchDirectoryMap()
}
}
Expand Down
8 changes: 4 additions & 4 deletions radar-commons-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ description = "Library for Kotlin utility classes and functions"

dependencies {
api(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:${Versions.coroutines}"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-core")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}")

api(platform("io.ktor:ktor-bom:${Versions.ktor}"))
api("io.ktor:ktor-client-auth")
implementation("io.ktor:ktor-client-content-negotiation")
implementation("io.ktor:ktor-serialization-kotlinx-json")
api("io.ktor:ktor-client-auth:${Versions.ktor}")
implementation("io.ktor:ktor-client-content-negotiation:${Versions.ktor}")
implementation("io.ktor:ktor-serialization-kotlinx-json:${Versions.ktor}")

testImplementation("org.hamcrest:hamcrest:${Versions.hamcrest}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.consume
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runInterruptible
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.withContext
import java.util.concurrent.Future
import java.util.concurrent.TimeUnit
import kotlin.coroutines.CoroutineContext
Expand Down Expand Up @@ -49,15 +49,13 @@ suspend fun <T> Future<T>.suspendGet(
}
}
try {
withContext(Dispatchers.IO) {
runInterruptible(Dispatchers.IO) {
if (duration != null) {
get(duration.inWholeMilliseconds, TimeUnit.MILLISECONDS)
} else {
get()
}
}
} catch (ex: InterruptedException) {
throw CancellationException("Future was interrupted", ex)
} finally {
channel.send(Unit)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package org.radarbase.kotlin.coroutines.flow

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.zip

/**
* Convert a list of flows to one flow with a list of values. The list contains the latest value of
* each respective flow, in the same order as the original flows.
* each respective flow, in the same order as the original flows. One value is produced when all
* flows produce a new value.
*/
fun <T> List<Flow<T>>.zipAll(): Flow<List<T>> = when (val numberOfFlows = size) {
0 -> flowOf(listOf())
Expand All @@ -23,3 +25,12 @@ fun <T> List<Flow<T>>.zipAll(): Flow<List<T>> = when (val numberOfFlows = size)
fun <T> zipAll(
vararg flows: Flow<T>,
): Flow<List<T>> = flows.toList().zipAll()

/**
* Combine the latest values of the flows in a list to a single list.
*/
inline fun <reified T> List<Flow<T>>.combine(): Flow<List<T>> = when (size) {
0 -> flowOf(emptyList())
1 -> get(0).map { listOf(it) }
else -> combine(this) { it.toList() }
}
13 changes: 9 additions & 4 deletions radar-commons-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,23 @@ dependencies {

// For POJO classes and ConfigLoader
implementation(platform("com.fasterxml.jackson:jackson-bom:${Versions.jackson}"))
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${Versions.jackson}")
implementation("com.fasterxml.jackson.core:jackson-databind:${Versions.jackson}")

api("org.apache.avro:avro:${Versions.avro}")
api("org.apache.avro:avro:${Versions.avro}") {
implementation("org.apache.commons:commons-compress:${Versions.commonsCompress}")
}

implementation("org.apache.kafka:kafka-clients:${Versions.kafka}") {
implementation("org.xerial.snappy:snappy-java:${Versions.snappy}")
}

testImplementation("org.mockito:mockito-core:${Versions.mockito}")
// Direct producer uses KafkaAvroSerializer if initialized
testImplementation("io.confluent:kafka-avro-serializer:${Versions.confluent}")

implementation("io.confluent:kafka-avro-serializer:${Versions.confluent}") {
runtimeOnly("com.google.guava:guava:${Versions.guava}")
}
testImplementation("org.radarbase:radar-schemas-commons:${Versions.radarSchemas}")
}

Expand Down
14 changes: 10 additions & 4 deletions radar-commons-testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,26 @@ dependencies {
api(project(":radar-commons-server"))
api(project(":radar-commons-kotlin"))

api("org.apache.avro:avro:${Versions.avro}")
api("org.radarbase:radar-schemas-commons:${Versions.radarSchemas}")

implementation("com.opencsv:opencsv:${Versions.opencsv}")
implementation(platform("com.fasterxml.jackson:jackson-bom:${Versions.jackson}"))
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.fasterxml.jackson.core:jackson-databind:${Versions.jackson}")

implementation("org.apache.kafka:kafka-clients:${Versions.kafka}") {
implementation("org.xerial.snappy:snappy-java:${Versions.snappy}")
}
implementation("io.confluent:kafka-avro-serializer:${Versions.confluent}")

implementation("io.confluent:kafka-avro-serializer:${Versions.confluent}") {
runtimeOnly("com.google.guava:guava:${Versions.guava}")
}

api("org.apache.avro:avro:${Versions.avro}") {
implementation("org.apache.commons:commons-compress:${Versions.commonsCompress}")
}

implementation(platform("io.ktor:ktor-bom:${Versions.ktor}"))
implementation("io.ktor:ktor-serialization-kotlinx-json")
implementation("io.ktor:ktor-serialization-kotlinx-json:${Versions.ktor}")

applicationRuntimeOnly("org.slf4j:slf4j-simple:${Versions.slf4j}")

Expand Down
Loading

0 comments on commit b38ec53

Please sign in to comment.