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
8 changes: 1 addition & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ buildscript {
}

dependencies {
classpath("io.github.gradle-nexus:publish-plugin:2.0.0-rc-1")
classpath("org.shipkit:shipkit-changelog:2.0.1")
classpath("org.shipkit:shipkit-auto-version:2.1.0")

classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24")
}
}

plugins {
id("eclipse")
id("com.github.ben-manes.versions") version "0.51.0"
id("mockito.root.releasing-conventions")

// Top-level android plugin declaration required for :mockito-integration-tests:android-tests to work
alias(libs.plugins.android.application) apply false
}

apply {
from(rootProject.file("gradle/shipkit.gradle"))
}

4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ dependencies {
implementation(libs.gradleplugin.spotless.googleJavaFormat)
implementation(libs.gradleplugin.license)

implementation(libs.gradleplugin.nexusPublish)
implementation(libs.gradleplugin.shipkit.changelog)
implementation(libs.gradleplugin.shipkit.autoVersion)

// https://github.com/gradle/gradle/issues/15383
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
plugins {
id("org.shipkit.shipkit-auto-version")
id("org.shipkit.shipkit-changelog")
id("org.shipkit.shipkit-github-release")

id("io.github.gradle-nexus.publish-plugin")
}

val isSnapshot = version.toString().endsWith("SNAPSHOT")
val githubTokenProvider = providers.environmentVariable("GITHUB_TOKEN")
val githubShaProvider = providers.environmentVariable("GITHUB_SHA")
val mockitoRepository = "mockito/mockito"

tasks {
generateChangelog {
githubToken = githubTokenProvider.get()
previousRevision = project.ext["shipkit-auto-version.previous-tag"].toString()
Copy link
Contributor

Choose a reason for hiding this comment

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

In a follow-up PR, let's refactor this so that we also use an environment variable for this.

repository = mockitoRepository
}

githubRelease {
enabled = !isSnapshot
dependsOn(generateChangelog)
githubToken = githubTokenProvider.get()
newTagRevision = githubShaProvider.get()
repository = mockitoRepository
changelog = generateChangelog.get().outputFile
}

closeAndReleaseStagingRepositories {
enabled = !isSnapshot
}

val releaseSummary by registering {
doLast {
if (isSnapshot) {
logger.lifecycle(
"""
RELEASE SUMMARY
SNAPSHOTS released to: https://s01.oss.sonatype.org/content/repositories/snapshots/org/mockito/mockito-core
Release to Maven Central: SKIPPED FOR SNAPSHOTS
Github releases: SKIPPED FOR SNAPSHOTS
""".trimIndent()
)
} else {
logger.lifecycle(
"""
RELEASE SUMMARY
Release to Maven Central (available in few hours): https://repo1.maven.org/maven2/org/mockito/mockito-core/
Github releases: https://github.com/mockito/mockito/releases
""".trimIndent()
)
}
}
}
}

nexusPublishing {
packageGroup = "org.mockito"
repositoryDescription = provider { "Mockito ${project.version}" }

repositories {
if (!providers.environmentVariable("NEXUS_TOKEN_PWD").orNull.isNullOrBlank()) {
sonatype {
// Publishing to: https://s01.oss.sonatype.org (faster instance)
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")

username = providers.environmentVariable("NEXUS_TOKEN_USER")
password = providers.environmentVariable("NEXUS_TOKEN_PWD")
}
}
}
}

3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ gradleplugin-errorprone = { module = "net.ltgt.gradle:gradle-errorprone-plugin",
gradleplugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "gradleplugin-spotless" }
gradleplugin-spotless-googleJavaFormat = { module = "com.google.googlejavaformat:google-java-format", version = "1.25.2" }
gradleplugin-license = { module = "com.github.hierynomus.license:com.github.hierynomus.license.gradle.plugin", version = "0.16.1" }
gradleplugin-nexusPublish = { module = "io.github.gradle-nexus:publish-plugin", version = "2.0.0" }
gradleplugin-shipkit-changelog = { module = "org.shipkit:shipkit-changelog", version = "2.0.1" }
gradleplugin-shipkit-autoVersion = { module = "org.shipkit:shipkit-auto-version", version = "2.1.0" }

# animal sniffer compatibility signatures
animalSniffer-android-apiLevel26 = { module = "net.sf.androidscents.signature:android-api-level-26", version = "8.0.0_r2" }
Expand Down
64 changes: 0 additions & 64 deletions gradle/shipkit.gradle

This file was deleted.

Loading