Skip to content

Commit

Permalink
remove closeAndReleaseRepository task (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielittner authored Mar 10, 2024
1 parent 3d66614 commit e80a256
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 24 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## 0.28.0 **UNRELEASED**

- Removed support for the deprecated Kotlin/JS plugin.
- Updated minimum supported Gradle, Android Gradle Plugin and Kotlin versions.
- Removed support for the deprecated Kotlin/JS plugin.
- Removed the deprecated `closeAndReleaseRepository` task. Use `releaseRepository`, which
is functionally equivalent, instead.

#### Minimum supported versions
- JDK 11
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.vanniktech.maven.publish

import com.vanniktech.maven.publish.sonatype.CloseAndReleaseSonatypeRepositoryTask.Companion.registerCloseAndReleaseRepository
import com.vanniktech.maven.publish.sonatype.CloseAndReleaseSonatypeRepositoryTask.Companion.registerReleaseRepository
import com.vanniktech.maven.publish.sonatype.CreateSonatypeRepositoryTask.Companion.registerCreateRepository
import com.vanniktech.maven.publish.sonatype.DropSonatypeRepositoryTask.Companion.registerDropRepository
import com.vanniktech.maven.publish.sonatype.ReleaseSonatypeRepositoryTask.Companion.registerReleaseRepository
import com.vanniktech.maven.publish.sonatype.SonatypeRepositoryBuildService.Companion.registerSonatypeRepositoryBuildService
import com.vanniktech.maven.publish.tasks.WorkaroundSignatureType
import org.gradle.api.Action
Expand Down Expand Up @@ -82,7 +81,6 @@ abstract class MavenPublishBaseExtension(
}

val releaseRepository = project.tasks.registerReleaseRepository(buildService, createRepository)
project.tasks.registerCloseAndReleaseRepository(buildService, createRepository)
project.tasks.registerDropRepository(buildService, createRepository)

project.tasks.register("publishToMavenCentral") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.gradle.api.tasks.TaskContainer
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.options.Option

internal abstract class CloseAndReleaseSonatypeRepositoryTask : DefaultTask() {
internal abstract class ReleaseSonatypeRepositoryTask : DefaultTask() {
@get:Internal
abstract val buildService: Property<SonatypeRepositoryBuildService>

Expand All @@ -28,35 +28,18 @@ internal abstract class CloseAndReleaseSonatypeRepositoryTask : DefaultTask() {

companion object {
private const val NAME = "releaseRepository"
private const val LEGACY_NAME = "closeAndReleaseRepository"

fun TaskContainer.registerReleaseRepository(
buildService: Provider<SonatypeRepositoryBuildService>,
createRepository: TaskProvider<CreateSonatypeRepositoryTask>,
): TaskProvider<CloseAndReleaseSonatypeRepositoryTask> {
return register(NAME, CloseAndReleaseSonatypeRepositoryTask::class.java) {
): TaskProvider<ReleaseSonatypeRepositoryTask> {
return register(NAME, ReleaseSonatypeRepositoryTask::class.java) {
it.description = "Releases a staging repository on Sonatype OSS"
it.group = "release"
it.buildService.set(buildService)
it.usesService(buildService)
it.mustRunAfter(createRepository)
}
}

fun TaskContainer.registerCloseAndReleaseRepository(
buildService: Provider<SonatypeRepositoryBuildService>,
createRepository: TaskProvider<CreateSonatypeRepositoryTask>,
): TaskProvider<CloseAndReleaseSonatypeRepositoryTask> {
return register(LEGACY_NAME, CloseAndReleaseSonatypeRepositoryTask::class.java) {
it.description = "Closes and releases a staging repository on Sonatype OSS"
it.group = "release"
it.buildService.set(buildService)
it.usesService(buildService)
it.mustRunAfter(createRepository)
it.doLast { task ->
task.logger.warn("$LEGACY_NAME is deprecated and will be removed in a future release, use $NAME instead.")
}
}
}
}
}

0 comments on commit e80a256

Please sign in to comment.