Skip to content

Commit

Permalink
fix: use the logger for informing on lifecycle progress
Browse files Browse the repository at this point in the history
  • Loading branch information
DanySK committed Nov 26, 2021
1 parent 0765a25 commit 3a00662
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-qa = { id = "org.danilopianini.gradle-kotlin-qa", version = "0.3.2" }
multiJvmTesting = { id = "org.danilopianini.multi-jvm-test-plugin", version = "0.2.0" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
publishOnCentral = { id = "org.danilopianini.publish-on-central", version = "0.6.1-dev0y-5f72c3d" }
publishOnCentral = { id = "org.danilopianini.publish-on-central", version = "0.6.1-dev0z-0765a25" }
taskTree = { id = "com.dorongold.task-tree", version = "2.1.0" }
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.danilopianini.gradle.mavencentral

import io.github.gradlenexus.publishplugin.internal.ActionRetrier
import io.github.gradlenexus.publishplugin.internal.BasicActionRetrier
import io.github.gradlenexus.publishplugin.internal.NexusClient
import io.github.gradlenexus.publishplugin.internal.StagingRepository
Expand Down Expand Up @@ -46,6 +45,7 @@ data class NexusStatefulOperation(
* Lazily computed staging profile id.
*/
val stagingProfile: String by lazy {
project.logger.lifecycle("Retrieving the profile id for $group on Nexus installed at $nexusUrl")
requireNotNull(client.findStagingProfileId(group)) {
"Invalid group id '$group': could not find an appropriate staging profile"
}
Expand All @@ -55,7 +55,7 @@ data class NexusStatefulOperation(
* Lazily computed staging repository descriptor.
*/
val stagingRepository: StagingRepositoryDescriptor by lazy {
println("Creating repo for $stagingProfile")
project.logger.lifecycle("Creating repository for profile id {} on Nexus at {}", stagingProfile, nexusUrl)
client.createStagingRepository(
stagingProfile,
description,
Expand All @@ -82,16 +82,22 @@ data class NexusStatefulOperation(
/**
* Closes the repository.
*/
fun close() = transitioner.effectivelyClose(repoId, description)
fun close() {
project.logger.lifecycle("Closing repository {} on Nexus at {}", repoId, repoUrl)
transitioner.effectivelyClose(repoId, description)
project.logger.lifecycle("Repository $repoId closed")
}

/**
* Releases the repository. Must be called after close().
*/
fun release() {
project.logger.lifecycle("Releasing repository {} on Nexus at {}", repoId, repoUrl)
transitioner.effectivelyRelease(repoId, description)
project.logger.lifecycle("Repository {} released", repoId)
}

companion object {
const val retryInterval: Long = 10
private const val retryInterval: Long = 10
}
}

0 comments on commit 3a00662

Please sign in to comment.