don't require publishTo specified if publishArtifact is `false`

Even with `publishArtifact := false` the user is still forced to define a (dummy) resolver that's never used, e.g. `publishTo := { Some("publishMeNot" at "https://publish/me/not") }`

Otherwise the following error is thrown:
```
publish
[error] java.lang.RuntimeException: Repository for publishing is not specified.
[error]         at scala.sys.package$.error(package.scala:27)
[error]         at sbt.Classpaths$.$anonfun$getPublishTo$1(Defaults.scala:2436)
[error]         at scala.Option.getOrElse(Option.scala:121)
[error]         at sbt.Classpaths$.getPublishTo(Defaults.scala:2436)
[error]         at sbt.Classpaths$.$anonfun$ivyBaseSettings$48(Defaults.scala:1917)
```
This commit is contained in:
Michael Pollmeier 2017-11-23 11:52:07 +13:00 committed by Dale Wijnand
parent aeb09fcbf4
commit 4668faff7c
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
4 changed files with 20 additions and 2 deletions

View File

@ -1935,8 +1935,10 @@ object Classpaths {
if (isSnapshot.value) "integration" else "release",
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
packagedArtifacts.in(publish).value.toVector,
checksums.in(publish).value.toVector,
getPublishTo(publishTo.value).name,
checksums.in(publish).value.toVector, { //resolvername: not required if publishTo is false
val publishToOption = publishTo.value
if (publishArtifact.value) getPublishTo(publishToOption).name else "local"
},
ivyLoggingLevel.value,
isSnapshot.value
)

View File

@ -0,0 +1,12 @@
[@mpollmeier]: https://github.com/mpollmeier
[#3760]: https://github.com/sbt/sbt/pull/3760
### Fixes with compatibility implications
### Improvements
### Bug fixes
- Remove requirement on `publishTo` if `publishArtifact` is false. [#3760][] by [@mpollmeier][]

View File

@ -0,0 +1,3 @@
// this is supposed to do nothing, and more importantly: not fail
// https://github.com/sbt/sbt/pull/3760
publishArtifact := false

View File

@ -0,0 +1 @@
> publish