Skip to content

Commit aa4180b

Browse files
committed
make maven publish configuration-cache compatible
1 parent 6d607ea commit aa4180b

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

buildSrc/src/main/kotlin/dev/isxander/controlify/project.gradle.kts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,23 @@ tasks.named<ProcessResources>("generateModMetadata") {
144144
}
145145
}
146146

147+
val publishUsername = providers
148+
.gradleProperty("XANDER_MAVEN_USER")
149+
.orElse(providers.environmentVariable("XANDER_MAVEN_USER"))
150+
151+
val publishPassword = providers
152+
.gradleProperty("XANDER_MAVEN_PASS")
153+
.orElse(providers.environmentVariable("XANDER_MAVEN_PASS"))
154+
155+
147156
publishing {
148157
repositories {
149-
val username = prop("XANDER_MAVEN_USER")
150-
val password = prop("XANDER_MAVEN_PASS")
151-
if (username != null && password != null) {
152-
maven(url = "https://maven.isxander.dev/releases") {
153-
name = "XanderReleases"
154-
credentials {
155-
this.username = username
156-
this.password = password
157-
}
158+
maven(url = "https://maven.isxander.dev/releases") {
159+
name = "XanderReleases"
160+
credentials(PasswordCredentials::class) {
161+
username = publishUsername.orNull
162+
password = publishPassword.orNull
158163
}
159-
} else {
160-
logger.warn("Xander Maven credentials not satisfied.")
161164
}
162165
}
163166
}

0 commit comments

Comments
 (0)