Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions build.gradle.kts
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 {
Expand All @@ -9,6 +9,7 @@ plugins {
id(libs.plugins.docker.compose.get().pluginId)

alias(libs.plugins.dokka)
alias(libs.plugins.maven.publish)
}

dokka {
Expand Down Expand Up @@ -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) {
Copy link
Collaborator

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-bom as before?

Copy link
Member Author

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

apply(plugin = "com.vanniktech.maven.publish")
[email protected] {
pom {
configureMavenCentralMetadata(this@allprojects)
}

publishToMavenCentral()
signAllPublications()
}
}
}

Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {
implementation(libs.jvm)
implementation(libs.docker.compose)
implementation(libs.detekt)
implementation(libs.maven.publish)
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reference (libs.maven.publish) does not match the declared alias maven-publish; it should be accessed as libs.mavenPublish or, for the plugin, libs.plugins.mavenPublish.

Suggested change
implementation(libs.maven.publish)
implementation(libs.mavenPublish)

Copilot uses AI. Check for mistakes.
}

plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
35 changes: 0 additions & 35 deletions exposed-bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import org.jetbrains.exposed.gradle.configureMavenCentralMetadata
import org.jetbrains.exposed.gradle.signPublicationIfKeyPresent

plugins {
`java-platform`
`maven-publish`
Expand All @@ -9,7 +6,6 @@ plugins {

group = "org.jetbrains.exposed"

// This is needed as the api dependency constraints cause dependencies
javaPlatform.allowDependencies()

dependencies {
Expand All @@ -29,34 +25,3 @@ dependencies {
}
}
}

publishing {
val version: String by rootProject

publications {
create<MavenPublication>("bom") {
groupId = "org.jetbrains.exposed"
artifactId = project.name
this.version = version
from(components.getByName("javaPlatform"))
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
}
}
}
}
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The key maven-publish is used both for the version entry and as the library/plugin alias, which may cause confusion; consider a more descriptive version alias (e.g. vanniktech-maven-publish-version).

Copilot uses AI. Check for mistakes.
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" }
Expand Down Expand Up @@ -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" }
Loading