Skip to content

Commit

Permalink
Merge pull request #252 from Aiven-Open/jjaakola-aiven-add-gradle-kot…
Browse files Browse the repository at this point in the history
…lin-file-formatting

chore: add Gradle Kotlin build file formatting
  • Loading branch information
AnatolyPopov authored Aug 20, 2024
2 parents ea5602c + 4edb934 commit 0b72b63
Show file tree
Hide file tree
Showing 4 changed files with 574 additions and 596 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ spotless {
endWithNewline()
}

kotlinGradle {
target("*.gradle.kts")
ktfmt()
}

java {
licenseHeaderFile(file("${project.rootDir}/gradle-config/java.header"))
importOrder("javax", "java", "org.apache.kafka", "io.aiven", "")
Expand Down
304 changes: 151 additions & 153 deletions commons/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,178 +14,176 @@
* limitations under the License.
*/


plugins {
id("aiven-apache-kafka-connectors-all.java-conventions")
}
plugins { id("aiven-apache-kafka-connectors-all.java-conventions") }

dependencies {
compileOnly(apache.kafka.connect.api)
compileOnly(apache.kafka.connect.runtime)
compileOnly(apache.kafka.connect.json)

implementation(confluent.kafka.connect.avro.data) {
exclude(group = "org.apache.kafka", module = "kafka-clients")
}

implementation(tools.spotbugs.annotations)
implementation(compressionlibs.snappy)
implementation(compressionlibs.zstd.jni)

implementation(logginglibs.slf4j)

implementation(apache.commons.text)

implementation(apache.parquet.avro) {
exclude(group = "org.xerial.snappy", module = "snappy-java")
exclude(group = "org.slf4j", module = "slf4j-api")
exclude(group = "org.apache.avro", module = "avro")
}
implementation(apache.hadoop.common) {
exclude(group = "org.apache.hadoop.thirdparty", module = "hadoop-shaded-protobuf_3_7")
exclude(group = "com.google.guava", module = "guava")
exclude(group = "commons-cli", module = "commons-cli")
exclude(group = "org.apache.commons", module = "commons-math3")
exclude(group = "org.apache.httpcomponents", module = "httpclient")
exclude(group = "commons-codec", module = "commons-codec")
exclude(group = "commons-io", module = "commons-io")
exclude(group = "commons-net", module = "commons-net")
exclude(group = "org.eclipse.jetty")
exclude(group = "org.eclipse.jetty.websocket")
exclude(group = "javax.servlet")
exclude(group = "javax.servlet.jsp")
exclude(group = "javax.activation")
exclude(group = "com.sun.jersey")
exclude(group = "log4j")
exclude(group = "org.apache.commons", module = "commons-text")
exclude(group = "org.slf4j", module = "slf4j-api")
exclude(group = "org.apache.hadoop", module = "hadoop-auth")
exclude(group = "org.apache.hadoop", module = "hadoop-yarn-api")
exclude(group = "com.google.re2j")
exclude(group = "com.google.protobuf")
exclude(group = "com.google.code.gson")
exclude(group = "com.jcraft")
exclude(group = "org.apache.curator")
exclude(group = "org.apache.zookeeper")
exclude(group = "org.apache.htrace")
exclude(group = "com.google.code.findbugs")
exclude(group = "org.apache.kerby")
exclude(group = "com.fasterxml.jackson.core")
exclude(group = "com.fasterxml.woodstox", module = "woodstox-core:5.0.3")
exclude(group = "org.apache.avro", module = "avro")
exclude(group = "org.apache.hadoop", module = "hadoop-yarn-common")
exclude(group = "com.google.inject.extensions", module = "guice-servlet")
exclude(group = "io.netty", module = "netty")
}
compileOnly(apache.kafka.connect.api)
compileOnly(apache.kafka.connect.runtime)
compileOnly(apache.kafka.connect.json)

implementation(confluent.kafka.connect.avro.data) {
exclude(group = "org.apache.kafka", module = "kafka-clients")
}

implementation(tools.spotbugs.annotations)
implementation(compressionlibs.snappy)
implementation(compressionlibs.zstd.jni)

implementation(logginglibs.slf4j)

implementation(apache.commons.text)

implementation(apache.parquet.avro) {
exclude(group = "org.xerial.snappy", module = "snappy-java")
exclude(group = "org.slf4j", module = "slf4j-api")
exclude(group = "org.apache.avro", module = "avro")
}
implementation(apache.hadoop.common) {
exclude(group = "org.apache.hadoop.thirdparty", module = "hadoop-shaded-protobuf_3_7")
exclude(group = "com.google.guava", module = "guava")
exclude(group = "commons-cli", module = "commons-cli")
exclude(group = "org.apache.commons", module = "commons-math3")
exclude(group = "org.apache.httpcomponents", module = "httpclient")
exclude(group = "commons-codec", module = "commons-codec")
exclude(group = "commons-io", module = "commons-io")
exclude(group = "commons-net", module = "commons-net")
exclude(group = "org.eclipse.jetty")
exclude(group = "org.eclipse.jetty.websocket")
exclude(group = "javax.servlet")
exclude(group = "javax.servlet.jsp")
exclude(group = "javax.activation")
exclude(group = "com.sun.jersey")
exclude(group = "log4j")
exclude(group = "org.apache.commons", module = "commons-text")
exclude(group = "org.slf4j", module = "slf4j-api")
exclude(group = "org.apache.hadoop", module = "hadoop-auth")
exclude(group = "org.apache.hadoop", module = "hadoop-yarn-api")
exclude(group = "com.google.re2j")
exclude(group = "com.google.protobuf")
exclude(group = "com.google.code.gson")
exclude(group = "com.jcraft")
exclude(group = "org.apache.curator")
exclude(group = "org.apache.zookeeper")
exclude(group = "org.apache.htrace")
exclude(group = "com.google.code.findbugs")
exclude(group = "org.apache.kerby")
exclude(group = "com.fasterxml.jackson.core")
exclude(group = "com.fasterxml.woodstox", module = "woodstox-core:5.0.3")
exclude(group = "org.apache.avro", module = "avro")
exclude(group = "org.apache.hadoop", module = "hadoop-yarn-common")
exclude(group = "com.google.inject.extensions", module = "guice-servlet")
exclude(group = "io.netty", module = "netty")
}

testImplementation(apache.kafka.connect.api)
testImplementation(apache.kafka.connect.runtime)
testImplementation(apache.kafka.connect.json)
testImplementation(testinglibs.junit.jupiter)
testImplementation(apache.parquet.tools) { exclude(group = "org.slf4j", module = "slf4j-api") }
testImplementation(jackson.databind)
testImplementation(testinglibs.mockito.core)
testImplementation(testinglibs.assertj.core)

testImplementation(testinglibs.woodstox.stax2.api)
testImplementation(apache.hadoop.mapreduce.client.core)
testImplementation(confluent.kafka.connect.avro.converter)

testRuntimeOnly(testinglibs.junit.jupiter.engine)
testRuntimeOnly(logginglibs.logback.classic)
}

testImplementation(apache.kafka.connect.api)
testImplementation(apache.kafka.connect.runtime)
testImplementation(apache.kafka.connect.json)
testImplementation(testinglibs.junit.jupiter)
testImplementation(apache.parquet.tools) {
exclude(group = "org.slf4j", module = "slf4j-api")
distributions {
main {
contents {
from("jar")
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })

into("/") {
from("$projectDir")
include("version.txt", "README*", "LICENSE*", "NOTICE*", "licenses/")
include("config/")
}
}
testImplementation(jackson.databind)
testImplementation(testinglibs.mockito.core)
testImplementation(testinglibs.assertj.core)

testImplementation(testinglibs.woodstox.stax2.api)
testImplementation(apache.hadoop.mapreduce.client.core)
testImplementation(confluent.kafka.connect.avro.converter)

testRuntimeOnly(testinglibs.junit.jupiter.engine)
testRuntimeOnly(logginglibs.logback.classic)
}
}

distributions {
main {
contents {
from("jar")
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
publishing {
publications {
create<MavenPublication>("publishMavenJavaArtifact") {
groupId = group.toString()
artifactId = "commons-for-apache-kafka-connect"
version = version.toString()

from(components["java"])

pom {
name = "Aiven's Common Module for Apache Kafka connectors"
description = "Aiven's Common Module for Apache Kafka connectors"
url = "https://github.com/aiven-open/commons-for-apache-kafka-connect"
organization {
name = "Aiven Oy"
url = "https://aiven.io"
}

licenses {
license {
name = "Apache 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}

into("/") {
from("$projectDir")
include("version.txt", "README*", "LICENSE*", "NOTICE*", "licenses/")
include("config/")
}
developers {
developer {
id = "aiven"
name = "Aiven Opensource"
email = "opensource@aiven.io"
}
}
}
}

publishing {
publications {
create<MavenPublication>("publishMavenJavaArtifact") {
groupId = group.toString()
artifactId = "commons-for-apache-kafka-connect"
version = version.toString()

from(components["java"])

pom {
name = "Aiven's Common Module for Apache Kafka connectors"
description = "Aiven's Common Module for Apache Kafka connectors"
url = "https://github.com/aiven-open/commons-for-apache-kafka-connect"
organization {
name = "Aiven Oy"
url = "https://aiven.io"
}

licenses {
license {
name = "Apache 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0"
distribution = "repo"
}
}

developers {
developer {
id = "aiven"
name = "Aiven Opensource"
email = "opensource@aiven.io"
}
}

scm {
connection = "scm:git:git://github.com:aiven-open/commons-for-apache-kafka-connect.git"
developerConnection = "scm:git:ssh://github.com:aiven-open/commons-for-apache-kafka-connect.git"
url = "https://github.com/aiven-open/commons-for-apache-kafka-connect"
}
}
scm {
connection = "scm:git:git://github.com:aiven-open/commons-for-apache-kafka-connect.git"
developerConnection =
"scm:git:ssh://github.com:aiven-open/commons-for-apache-kafka-connect.git"
url = "https://github.com/aiven-open/commons-for-apache-kafka-connect"
}
}
}
}

repositories {
maven {
name = "sonatype"
repositories {
maven {
name = "sonatype"

val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl

credentials(PasswordCredentials::class)
}
credentials(PasswordCredentials::class)
}
}
}

signing {
sign(publishing.publications["publishMavenJavaArtifact"])
useGpgCmd()
// Some issue in the plugin:
// GPG outputs already armored signatures. The plugin also does armoring for `asc` files.
// This results in double armored signatures, i.e. garbage.
// Override the signature type provider to use unarmored output for `asc` files, which works well with GPG.
class ASCSignatureProvider() : AbstractSignatureTypeProvider() {
val binary = object: BinarySignatureType() {
override fun getExtension(): String {
return "asc";
}
}
init {
register(binary)
setDefaultType(binary.extension)
sign(publishing.publications["publishMavenJavaArtifact"])
useGpgCmd()
// Some issue in the plugin:
// GPG outputs already armored signatures. The plugin also does armoring for `asc` files.
// This results in double armored signatures, i.e. garbage.
// Override the signature type provider to use unarmored output for `asc` files, which works well
// with GPG.
class ASCSignatureProvider() : AbstractSignatureTypeProvider() {
val binary =
object : BinarySignatureType() {
override fun getExtension(): String {
return "asc"
}
}

init {
register(binary)
setDefaultType(binary.extension)
}
signatureTypes = ASCSignatureProvider()
}
signatureTypes = ASCSignatureProvider()
}
Loading

0 comments on commit 0b72b63

Please sign in to comment.