Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#276: Always use ThisBuild / sonatypeCredentialHost settings #285

Merged
merged 5 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ lazy val buildSettings: Seq[Setting[_]] = Seq(
organizationName := "Xerial project",
organizationHomepage := Some(new URL("http://xerial.org/")),
description := "A sbt plugin for publishing Scala/Java projects to the Maven Central through Sonatype Nexus REST API",
publishArtifact in Test := false,
Test / publishArtifact := false,
sbtPlugin := true,
parallelExecution := true,
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked"),
Expand All @@ -33,7 +33,7 @@ lazy val buildSettings: Seq[Setting[_]] = Seq(
},
crossSbtVersions := Vector("1.2.8"),
releaseCrossBuild := false,
releaseTagName := { (version in ThisBuild).value },
releaseTagName := { (ThisBuild / version).value },
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
Expand Down
15 changes: 9 additions & 6 deletions src/main/scala/xerial/sbt/Sonatype.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object Sonatype extends AutoPlugin with LogSupport {
)
lazy val sonatypeSettings = Seq[Def.Setting[_]](
sonatypeProfileName := organization.value,
sonatypeRepository := s"https://${sonatypeCredentialHost.value}/service/local",
sonatypeRepository := s"https://${(ThisBuild / sonatypeCredentialHost).value}/service/local",
sonatypeProjectHosting := None,
publishMavenStyle := true,
pomIncludeRepository := { _ =>
Expand Down Expand Up @@ -413,10 +413,13 @@ object Sonatype extends AutoPlugin with LogSupport {
val logLevel = LogLevel(extracted.get(sonatypeLogLevel))
wvlet.log.Logger.setDefaultLogLevel(logLevel)

val repositoryUrl = extracted.get(sonatypeRepository)
val creds = getCredentials(extracted, state)
val credentialHost = extracted.get(sonatypeCredentialHost)
// #276 Need to use the root configuration
val credentialHost = extracted.get(ThisBuild / sonatypeCredentialHost)
val currentSonatypeProfile = profileName.getOrElse(extracted.get(sonatypeProfileName))
val repositoryUrl = extracted.get(sonatypeRepository)
val timeoutMillis = extracted.get(sonatypeTimeoutMillis)

val creds = getCredentials(extracted, state)
val hashsum: String = {
val input = Vector(repositoryUrl, creds.toString(), credentialHost).mkString("-")
MurmurHash3.stringHash(input).abs.toString()
Expand All @@ -426,11 +429,11 @@ object Sonatype extends AutoPlugin with LogSupport {
repositoryUrl = repositoryUrl,
cred = creds,
credentialHost = credentialHost,
timeoutMillis = extracted.get(sonatypeTimeoutMillis)
timeoutMillis = timeoutMillis
)
val service = new SonatypeService(
sonatypeClient,
profileName.getOrElse(extracted.get(sonatypeProfileName)),
currentSonatypeProfile,
Some(hashsum)
)
try {
Expand Down