Skip to content

Commit

Permalink
chore: Simplify some calls to findOptionalProperty (#718)
Browse files Browse the repository at this point in the history
* chore: Simplify some calls to `findOptionalProperty`

* test: Make `MavenPublishPluginSpecialCaseTest` pass on Windows

Avoid Windows path separators being interpreted as escape characters.
  • Loading branch information
sschuberth authored Feb 13, 2024
1 parent 789644b commit c9058e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.nio.file.Files
import java.nio.file.Path
import kotlin.io.path.copyTo
import kotlin.io.path.createDirectories
import kotlin.io.path.invariantSeparatorsPathString
import kotlin.io.path.writeText
import org.gradle.testkit.runner.GradleRunner

Expand Down Expand Up @@ -57,7 +58,7 @@ private fun ProjectSpec.writeBuildFile(path: Path, repo: Path, options: TestOpti
repositories {
maven {
name = "testFolder"
url = "${repo.toAbsolutePath()}"
url = "${repo.toAbsolutePath().invariantSeparatorsPathString}"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ abstract class MavenPublishBaseExtension(
val inMemoryKey = project.findOptionalProperty("signingInMemoryKey")
if (inMemoryKey != null) {
val inMemoryKeyId = project.findOptionalProperty("signingInMemoryKeyId")
val inMemoryKeyPassword = project.findOptionalProperty("signingInMemoryKeyPassword") ?: ""
val inMemoryKeyPassword = project.findOptionalProperty("signingInMemoryKeyPassword").orEmpty()
project.gradleSigning.useInMemoryPgpKeys(inMemoryKeyId, inMemoryKey, inMemoryKeyPassword)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ open class MavenPublishPlugin : Plugin<Project> {
val automaticRelease = project.findOptionalProperty("SONATYPE_AUTOMATIC_RELEASE").toBoolean()
baseExtension.publishToMavenCentral(SonatypeHost.valueOf(sonatypeHost), automaticRelease)
}
val releaseSigning = project.findOptionalProperty("RELEASE_SIGNING_ENABLED")?.toBoolean()
if (releaseSigning == true) {
val releaseSigning = project.findOptionalProperty("RELEASE_SIGNING_ENABLED").toBoolean()
if (releaseSigning) {
baseExtension.signAllPublications()
}

Expand Down

0 comments on commit c9058e9

Please sign in to comment.