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
117 changes: 117 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ subprojects {
apply plugin: 'info.solidsoft.pitest'

apply plugin: "maven-publish"
apply plugin: "signing"

repositories {
// Use Maven Central for resolving dependencies.
Expand Down Expand Up @@ -224,15 +225,92 @@ subprojects {
}

publishing {
repositories {
maven {
name="sonatype"

def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl

credentials(PasswordCredentials)
}
}
publications {
mavenJava(MavenPublication) {
from components.java

pom {
url = "https://github.com/Aiven-Open/tiered-storage-for-apache-kafka"
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 = '[email protected]'
}
}

scm {
connection = 'scm:git:git://github.com:Aiven-Open/tiered-storage-for-apache-kafka.git'
developerConnection = 'scm:git:ssh://github.com:Aiven-Open/tiered-storage-for-apache-kafka.git'
url = 'https://github.com/Aiven-Open/tiered-storage-for-apache-kafka'
}
}

afterEvaluate {
groupId = "io.aiven"
artifactId = "tiered-storage-for-apache-kafka-${archivesBaseName}"
}
}
}

signing {
sign publishing.publications.mavenJava
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.
signatureTypes = new AbstractSignatureTypeProvider() {
{
BinarySignatureType binary = new BinarySignatureType() {
@Override
String getExtension() {
return "asc"
}
}
register(binary)
setDefaultType(binary.getExtension())
}
}
}
}

// Skip test fixtures from distribution archives
afterEvaluate { proj ->
// Skip test fixtures from distributions
proj.distributions.all {
contents {
// Exclude any test fixtures JARs from the distribution
exclude { element ->
element.file.name.contains('test-fixtures')
element.file.name.contains('sources')
}
}
}
}
}

Expand Down Expand Up @@ -299,3 +377,42 @@ tasks.register('validateDependencies') {
//tasks.named("check") {
// dependsOn(tasks.named("validateDependencies"))
//}

// Define the list of modules to be published
def modulesToPublish = [
':commons',
':core',
':storage:core',
':storage:filesystem',
':storage:s3',
':storage:gcs',
':storage:azure',
]

// Define and configure the publishToSonatype task
tasks.register("publishToSonatype") {
description = 'Publishes selected modules to Sonatype repository'
group = 'publishing'
dependsOn(tasks.named("distTar"))

doFirst {
println "Publishing selected modules to Sonatype..."
}
}

// Configure task dependencies after all projects are evaluated
gradle.projectsEvaluated {
tasks.named("publishToSonatype") {
modulesToPublish.each { modulePath ->
def moduleProject = modulePath == ':' ? rootProject : project(modulePath)
def taskName = "${moduleProject.path}:publish${modulePath == ':' ? 'Maven' : 'MavenJava'}PublicationToSonatypeRepository"

try {
dependsOn(taskName)
println "Added $taskName"
} catch (Exception e) {
println "Warning: Publication task not found for ${modulePath}"
}
}
}
}
4 changes: 0 additions & 4 deletions storage/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,3 @@ dependencies {

testFixturesImplementation "org.testcontainers:junit-jupiter:$testcontainersVersion"
}

components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }