diff --git a/CHANGELOG.md b/CHANGELOG.md index 978ca4b7..2c1456a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [Unreleased] + +- Allow mavenCentralUsername and mavenCentralPassword to be set from any property type for added flexibility. + ## 0.30.0 *(2024-10-13)* - Add support for Dokka 2.0.0-Beta diff --git a/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt b/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt index bb638488..861a96af 100644 --- a/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt +++ b/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt @@ -63,8 +63,8 @@ abstract class MavenPublishBaseExtension @Inject constructor( sonatypeHost = sonatypeHost, groupId = groupId, versionIsSnapshot = version.map { it.endsWith("-SNAPSHOT") }, - repositoryUsername = project.providers.gradleProperty("mavenCentralUsername"), - repositoryPassword = project.providers.gradleProperty("mavenCentralPassword"), + repositoryUsername = project.provider { project.properties["mavenCentralUsername"]?.toString() }, + repositoryPassword = project.provider { project.properties["mavenCentralPassword"]?.toString() }, automaticRelease = automaticRelease, // TODO: stop accessing rootProject https://github.com/gradle/gradle/pull/26635 rootBuildDirectory = project.rootProject.layout.buildDirectory, diff --git a/plugin/src/main/kotlin/com/vanniktech/maven/publish/sonatype/SonatypeRepositoryBuildService.kt b/plugin/src/main/kotlin/com/vanniktech/maven/publish/sonatype/SonatypeRepositoryBuildService.kt index 45086030..574ae50e 100644 --- a/plugin/src/main/kotlin/com/vanniktech/maven/publish/sonatype/SonatypeRepositoryBuildService.kt +++ b/plugin/src/main/kotlin/com/vanniktech/maven/publish/sonatype/SonatypeRepositoryBuildService.kt @@ -332,10 +332,10 @@ internal abstract class SonatypeRepositoryBuildService : rootBuildDirectory: Provider, buildEventsListenerRegistry: BuildEventsListenerRegistry, ): Provider { - val okhttpTimeout = project.providers.gradleProperty("SONATYPE_CONNECT_TIMEOUT_SECONDS") + val okhttpTimeout = project.provider { project.properties["SONATYPE_CONNECT_TIMEOUT_SECONDS"]?.toString() } .map { it.toLong() } .orElse(60) - val closeTimeout = project.providers.gradleProperty("SONATYPE_CLOSE_TIMEOUT_SECONDS") + val closeTimeout = project.provider { project.properties["SONATYPE_CLOSE_TIMEOUT_SECONDS"]?.toString() } .map { it.toLong() } .orElse(60 * 15) val service = gradle.sharedServices.registerIfAbsent(NAME, SonatypeRepositoryBuildService::class.java) {