- version bumps for coroutines, gradle, kotlin
- refactor kafka-connector project, prepping for the connector-admin
This commit is contained in:
parent
7cd630500e
commit
45189dddc2
20 changed files with 3408 additions and 124 deletions
|
|
@ -1,15 +1,15 @@
|
|||
@file:Suppress("UnstableApiUsage") // VERSION_PLATFORM + platform(...) is unstable
|
||||
|
||||
import dev.adamko.kafkatorio.gradle.asConsumer
|
||||
import dev.adamko.kafkatorio.jsonMapper
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.contentOrNull
|
||||
import kotlinx.serialization.json.jsonArray
|
||||
import kotlinx.serialization.json.jsonObject
|
||||
import kotlinx.serialization.json.jsonPrimitive
|
||||
|
||||
plugins {
|
||||
id("dev.adamko.kafkatorio.infra.docker-compose")
|
||||
id("dev.adamko.kafkatorio.lang.kotlin-jvm")
|
||||
}
|
||||
|
||||
val dockerSrcDir: Directory by extra(layout.projectDirectory.dir("src/main/docker"))
|
||||
val connectorJarDir: Directory = dockerSrcDir.dir("camel-kafka-connectors")
|
||||
|
||||
val camelConnectorDependencies: Configuration by configurations.creating { asConsumer() }
|
||||
|
||||
fun DependencyHandlerScope.kafkaConnector(
|
||||
|
|
@ -23,11 +23,19 @@ fun DependencyHandlerScope.kafkaConnector(
|
|||
dependencies {
|
||||
kafkaConnector("camel-websocket-kafka-connector")
|
||||
kafkaConnector("camel-ahc-ws-kafka-connector")
|
||||
|
||||
implementation("com.github.adamko-dev:json5-kotlin:2.0.3")
|
||||
|
||||
implementation(platform(libs.http4k.bom))
|
||||
implementation("org.http4k:http4k-core")
|
||||
implementation("org.http4k:http4k-client-okhttp")
|
||||
|
||||
implementation(platform(libs.kotlinx.serialization.bom))
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
||||
}
|
||||
|
||||
|
||||
val connectorJarDir: Directory = layout.projectDirectory.dir("src/camel-kafka-connectors")
|
||||
|
||||
val downloadCamelConnectors by tasks.registering(Sync::class) {
|
||||
group = project.name
|
||||
description = "Retrieve Camel Kafka Connectors from Maven, in preparation for the Docker build"
|
||||
|
|
@ -44,7 +52,6 @@ val downloadCamelConnectors by tasks.registering(Sync::class) {
|
|||
into(connectorJarDir)
|
||||
}
|
||||
|
||||
|
||||
tasks.dockerUp {
|
||||
dependsOn(":modules:infra-kafka-cluster:dockerUp")
|
||||
dependsOn(downloadCamelConnectors)
|
||||
|
|
@ -56,72 +63,3 @@ tasks.dockerEnv {
|
|||
"KAFKA_CONNECT_VERSION" to libs.versions.confluent.kafkaConnect.get(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
val availableCamelVersions by tasks.registering {
|
||||
// dicking around with some sort of 'all camel connectors' docker image.
|
||||
// it's unfinished.
|
||||
|
||||
val camelGroup = "org.apache.camel.kafkaconnector"
|
||||
val camelParent = "connectors"
|
||||
|
||||
val requestUrl = """
|
||||
https://search.maven.org/solrsearch/select?q=g:"$camelGroup"+AND+a:"$camelParent"&core=gav&rows=20&wt=json
|
||||
""".trimIndent()
|
||||
.replace("\"", "%22")
|
||||
|
||||
doLast {
|
||||
|
||||
val connectorVersions = java.net.URL(requestUrl).readText()
|
||||
logger.lifecycle("conn ==== $connectorVersions")
|
||||
val versionsJson = jsonMapper.parseToJsonElement(connectorVersions).jsonObject
|
||||
|
||||
logger.lifecycle("json ==== \n ${jsonMapper.encodeToString(versionsJson)}")
|
||||
|
||||
val deps = versionsJson["response"]
|
||||
?.jsonObject
|
||||
?.get("docs")
|
||||
?.jsonArray
|
||||
?.map { it.jsonObject }
|
||||
?.mapNotNull { j ->
|
||||
val group = j["g"]?.jsonPrimitive?.contentOrNull
|
||||
val artifact = j["a"]?.jsonPrimitive?.contentOrNull
|
||||
val version = j["v"]?.jsonPrimitive?.contentOrNull
|
||||
val packaging = j["p"]?.jsonPrimitive?.contentOrNull?.toLowerCase()
|
||||
|
||||
if (listOf(group, artifact, version, packaging).all { it != null }) {
|
||||
val d = project.dependencies.create(
|
||||
group = group!!,
|
||||
name = artifact!!,
|
||||
version = version!!,
|
||||
ext = packaging,
|
||||
)
|
||||
logger.lifecycle("dep = $d / $packaging")
|
||||
d
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} ?: emptyList()
|
||||
|
||||
val c = configurations.detachedConfiguration()
|
||||
c.dependencies.addAll(deps)
|
||||
c.resolve()
|
||||
.joinToString("\n\n---\n\n") { it.readLines().take(5).joinToString("\n") }
|
||||
|
||||
// logger.lifecycle("ids: ${versions?.joinToString("\n", "\n\n", "\n\n")}")
|
||||
//
|
||||
// versions?.filterNotNull()?.forEach { id ->
|
||||
//
|
||||
// configurations.detachedConfiguration(
|
||||
// project.dependencies.create(id)
|
||||
// )
|
||||
// .resolve()
|
||||
// .joinToString("\n\n---\n\n") { it.readLines().take(5).joinToString("\n") }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
// jsonMapper.parseToJsonElement()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue