-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add vararg stream for StreamsBuilder * fix stream-table join so it's not recursive, and the lambda param is last * use expression bodies * new `stream.to()` extension - for better generic support * add test for StreamsBuilder.stream(...) * use gradle task config avoidance configureEach * fix kotlinx ser version in buildSrc * try implementing Maven Central publishing... (signing still doesn't work) * try implementing Maven Central publishing... (signing still doesn't work) * split up StreamsBuilder.stream() so vararg works a bit better * bump to Kotlin 1.7, add java-platform subproject * - improve KStream.to() - fixes after Kotlin 1.7 update * try to fix jitpack * only sign javadoc jar if publishing to sonatype * kotest bump, Gradle bump, and a bit of build config tweaking * bump Gradle & Kotlin * rm sonatype snapshots from maven repos * rm commented out buildSrc config * disable signing plugin
- Loading branch information
Showing
23 changed files
with
491 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ dependencyResolutionManagement { | |
|
||
} | ||
|
||
|
||
fun RepositoryHandler.jitpack() { | ||
maven("https://jitpack.io") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 111 additions & 19 deletions
130
buildSrc/src/main/kotlin/kotka/convention/maven-publish.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,122 @@ | ||
package kotka.convention | ||
|
||
import kotka.ext.createKotkaStreamsPom | ||
import kotka.ext.credentialsAction | ||
import kotka.ext.publishing | ||
import kotka.ext.signing | ||
|
||
|
||
plugins { | ||
`maven-publish` | ||
// signing | ||
} | ||
|
||
plugins.withType(JavaPlugin::class.java) { | ||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
} | ||
} | ||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/adamko-dev/kotka-streams") | ||
credentials(PasswordCredentials::class) | ||
} | ||
} | ||
|
||
val sonatypeRepositoryCredentials: Provider<Action<PasswordCredentials>> = | ||
providers.credentialsAction("sonatypeRepository") | ||
|
||
val gitHubPackagesCredentials: Provider<Action<PasswordCredentials>> = | ||
providers.credentialsAction("GitHubPackages") | ||
|
||
|
||
val sonatypeRepositoryReleaseUrl: Provider<String> = provider { | ||
if (version.toString().endsWith("SNAPSHOT")) { | ||
"https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
} else { | ||
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
} | ||
} | ||
|
||
|
||
val signingKeyId: Provider<String> = | ||
providers.gradleProperty("signing.keyId") | ||
val signingKey: Provider<String> = | ||
providers.gradleProperty("signing.key") | ||
val signingPassword: Provider<String> = | ||
providers.gradleProperty("signing.password") | ||
val signingSecretKeyRingFile: Provider<String> = | ||
providers.gradleProperty("signing.secretKeyRingFile") | ||
|
||
|
||
tasks.withType<AbstractPublishToMaven>().configureEach { | ||
// Gradle warns about some signing tasks using publishing task outputs without explicit | ||
// dependencies. I'm not going to go through them all and fix them, so here's a quick fix. | ||
dependsOn(tasks.withType<Sign>()) | ||
|
||
doLast { | ||
logger.lifecycle("[${this.name}] ${project.group}:${project.name}:${project.version}") | ||
} | ||
} | ||
|
||
tasks | ||
.matching { it.name in listOf("publish", "publishToMavenLocal") } | ||
.configureEach { | ||
doLast { | ||
logger.lifecycle("[${this.name}] ${project.group}:${project.name}:${project.version}") | ||
|
||
//signing { | ||
// if (sonatypeRepositoryCredentials.isPresent) { | ||
// if (signingKeyId.isPresent && signingKey.isPresent && signingPassword.isPresent) { | ||
// useInMemoryPgpKeys(signingKeyId.get(), signingKey.get(), signingPassword.get()) | ||
// } else { | ||
// useGpgCmd() | ||
// } | ||
// | ||
// // sign all publications | ||
// sign(publishing.publications) | ||
// } | ||
//} | ||
|
||
|
||
publishing { | ||
repositories { | ||
// publish to local dir, for testing | ||
maven(rootProject.layout.buildDirectory.dir("maven-internal")) { | ||
name = "maven-internal" | ||
} | ||
|
||
// if (sonatypeRepositoryCredentials.isPresent) { | ||
// maven(sonatypeRepositoryReleaseUrl) { | ||
// name = "sonatype" | ||
// credentials(sonatypeRepositoryCredentials.get()) | ||
// } | ||
// } | ||
// | ||
// if (gitHubPackagesCredentials.isPresent) { | ||
// maven("https://maven.pkg.github.com/adamko-dev/kotka-streams") { | ||
// name = "GitHubPackages" | ||
// credentials(gitHubPackagesCredentials.get()) | ||
// } | ||
// } | ||
} | ||
|
||
publications.withType<MavenPublication>().configureEach { | ||
createKotkaStreamsPom() | ||
} | ||
} | ||
|
||
|
||
plugins.withType<JavaPlugin>().configureEach { | ||
publishing.publications.create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
// artifact(tasks["sourcesJar"]) | ||
} | ||
} | ||
|
||
|
||
plugins.withType<JavaPlatformPlugin>().configureEach { | ||
|
||
val javadocJarStub by tasks.registering(Jar::class) { | ||
group = JavaBasePlugin.DOCUMENTATION_GROUP | ||
description = "Stub javadoc.jar artifact (required by Maven Central)" | ||
archiveClassifier.set("javadoc") | ||
} | ||
|
||
tasks.withType<AbstractPublishToMaven>().configureEach { | ||
dependsOn(javadocJarStub) | ||
} | ||
|
||
// if (sonatypeRepositoryCredentials.isPresent) { | ||
// signing.sign(javadocJarStub.get()) | ||
// } | ||
|
||
publishing.publications.create<MavenPublication>("mavenJavaPlatform") { | ||
from(components["javaPlatform"]) | ||
artifact(javadocJarStub) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package kotka.ext | ||
|
||
import org.gradle.api.Action | ||
import org.gradle.api.artifacts.repositories.PasswordCredentials | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.api.provider.ProviderFactory | ||
|
||
|
||
// https://github.com/gradle/gradle/issues/20925 | ||
fun ProviderFactory.credentialsAction( | ||
repositoryName: String | ||
): Provider<Action<PasswordCredentials>> = zip( | ||
gradleProperty("${repositoryName}Username"), | ||
gradleProperty("${repositoryName}Password"), | ||
) { user, pass -> | ||
Action<PasswordCredentials> { | ||
username = user | ||
password = pass | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package kotka.ext | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.gradle.plugins.signing.SigningExtension | ||
|
||
|
||
fun MavenPublication.createKotkaStreamsPom(): Unit = pom { | ||
name.set("Kotka Streams - Kotlin for Kafka Streams") | ||
description.set("Using Kotka means a more pleasant experience while using Kafka Streams") | ||
url.set("https://github.com/adamko-dev/kotka-streams") | ||
|
||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
email.set("adam@adamko.dev") | ||
} | ||
} | ||
|
||
scm { | ||
connection.set("scm:git:git://github.com/adamko-dev/kotka-streams.git") | ||
developerConnection.set("scm:git:ssh://github.com:adamko-dev/kotka-streams.git") | ||
url.set("https://github.com/adamko-dev/kotka-streams") | ||
} | ||
} | ||
|
||
|
||
// hacks because IntelliJ still doesn't properly load DSL accessors for buildSrc | ||
|
||
|
||
/** Configure [PublishingExtension] */ | ||
fun Project.publishing(configure: PublishingExtension.() -> Unit): Unit = | ||
extensions.configure(configure) | ||
|
||
|
||
val Project.publishing: PublishingExtension | ||
get() = extensions.getByType() | ||
|
||
|
||
/** Configure [SigningExtension] */ | ||
fun Project.signing(configure: SigningExtension.() -> Unit): Unit = | ||
extensions.configure(configure) | ||
|
||
|
||
val Project.signing: SigningExtension | ||
get() = extensions.getByType() |
Oops, something went wrong.