-
Notifications
You must be signed in to change notification settings - Fork 750
chore: Migrate to Vanniktech Maven Publish plugin #2552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import org.jetbrains.exposed.gradle.configureDetekt | ||
| import org.jetbrains.exposed.gradle.configurePublishing | ||
| import org.jetbrains.exposed.gradle.configureMavenCentralMetadata | ||
| import org.jetbrains.exposed.gradle.testDb | ||
|
|
||
| plugins { | ||
|
|
@@ -9,6 +9,7 @@ plugins { | |
| id(libs.plugins.docker.compose.get().pluginId) | ||
|
|
||
| alias(libs.plugins.dokka) | ||
| alias(libs.plugins.maven.publish) | ||
| } | ||
|
|
||
| dokka { | ||
|
|
@@ -38,8 +39,16 @@ repositories { | |
| } | ||
|
|
||
| allprojects { | ||
| if (this.name != "exposed-tests" && this.name != "exposed-bom" && this.name != "exposed-r2dbc-tests" && this != rootProject) { | ||
| configurePublishing() | ||
| if (this.name != "exposed-tests" && this.name != "exposed-r2dbc-tests" && this != rootProject) { | ||
| apply(plugin = "com.vanniktech.maven.publish") | ||
| [email protected] { | ||
| pom { | ||
| configureMavenCentralMetadata(this@allprojects) | ||
| } | ||
|
|
||
| publishToMavenCentral() | ||
| signAllPublications() | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ dependencies { | |||||
| implementation(libs.jvm) | ||||||
| implementation(libs.docker.compose) | ||||||
| implementation(libs.detekt) | ||||||
| implementation(libs.maven.publish) | ||||||
|
||||||
| implementation(libs.maven.publish) | |
| implementation(libs.mavenPublish) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,77 +44,3 @@ fun MavenPom.configureMavenCentralMetadata(project: Project) { | |
| developerConnection by "scm:git:[email protected]:JetBrains/Exposed.git" | ||
| } | ||
| } | ||
|
|
||
| fun MavenPublication.signPublicationIfKeyPresent(project: Project) { | ||
| val keyId = System.getenv("exposed.sign.key.id") | ||
| val signingKey = System.getenv("exposed.sign.key.private") | ||
| val signingKeyPassphrase = System.getenv("exposed.sign.passphrase") | ||
| if (!signingKey.isNullOrBlank()) { | ||
| project.extensions.configure<SigningExtension>("signing") { | ||
| useInMemoryPgpKeys(keyId, preprocessPrivateGpgKey(signingKey), signingKeyPassphrase) | ||
| sign(this@signPublicationIfKeyPresent) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fun Project.publishing(configure: PublishingExtension.() -> Unit) { | ||
| extensions.configure("publishing", configure) | ||
| } | ||
|
|
||
| fun Project.java(configure: JavaPluginExtension.() -> Unit) { | ||
| extensions.configure("java", configure) | ||
| } | ||
|
|
||
| fun Project.configurePublishing() { | ||
| apply(plugin = "java-library") | ||
| apply(plugin = "maven-publish") | ||
| apply(plugin = "signing") | ||
|
|
||
| java { | ||
| withJavadocJar() | ||
| withSourcesJar() | ||
| } | ||
|
|
||
| val version: String by rootProject | ||
|
|
||
| publishing { | ||
| publications { | ||
| create<MavenPublication>("exposed") { | ||
| groupId = "org.jetbrains.exposed" | ||
| artifactId = project.name | ||
|
|
||
| setVersion(version) | ||
|
|
||
| from(components["java"]) | ||
| pom { | ||
| configureMavenCentralMetadata(project) | ||
| } | ||
| signPublicationIfKeyPresent(project) | ||
| } | ||
| } | ||
|
|
||
| val publishingUsername: String? = System.getenv("PUBLISHING_USERNAME") | ||
| val publishingPassword: String? = System.getenv("PUBLISHING_PASSWORD") | ||
|
|
||
| repositories { | ||
| maven { | ||
| name = "Exposed" | ||
| url = uri("https://maven.pkg.jetbrains.space/public/p/exposed/release") | ||
| credentials { | ||
| username = publishingUsername | ||
| password = publishingPassword | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private fun preprocessPrivateGpgKey(key: String): String { | ||
| val prefix = "-----BEGIN PGP PRIVATE KEY BLOCK-----" | ||
| val suffix = "-----END PGP PRIVATE KEY BLOCK-----" | ||
| val delimiter = "\r\n" | ||
| return prefix + delimiter + key | ||
| .replace(prefix, "") | ||
| .replace(suffix, "") | ||
| .replace(" ", "\r\n") + delimiter + suffix | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,13 +42,14 @@ javax-money = "1.1" | |
| moneta = "1.4.5" | ||
| hikariCP = "4.0.3" | ||
| logcaptor = "2.11.0" | ||
| maven-publish = "0.33.0" | ||
|
|
||
| [libraries] | ||
| jvm = { group = "org.jetbrains.kotlin.jvm", name = "org.jetbrains.kotlin.jvm.gradle.plugin", version.ref = "kotlin" } | ||
| docker-compose = { group = "com.avast.gradle", name = "gradle-docker-compose-plugin", version.ref = "docker-compose" } | ||
| detekt = { group = "io.gitlab.arturbosch.detekt", name = "detekt-gradle-plugin", version.ref = "detekt" } | ||
| detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" } | ||
|
|
||
| maven-publish = { group = "com.vanniktech", name = "gradle-maven-publish-plugin", version.ref = "maven-publish" } | ||
|
Comment on lines
+45
to
+52
|
||
| kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinCoroutines" } | ||
| kotlinx-coroutines-debug = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-debug", version.ref = "kotlinCoroutines" } | ||
| kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinCoroutines" } | ||
|
|
@@ -109,3 +110,4 @@ detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } | |
| serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } | ||
| binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" } | ||
| docker-compose = { id = "com.avast.gradle.docker-compose", version.ref = "docker-compose" } | ||
| maven-publish = { id = "com.vanniktech.maven.publish" } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also exclude
exposed-bomas before?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, it is configured as regular module now