Skip to content

Conversation

hvesalai
Copy link
Contributor

@hvesalai hvesalai commented Aug 6, 2019

Don't give error about missing repository if publishArtifact is false

@hvesalai
Copy link
Contributor Author

hvesalai commented Aug 6, 2019

Ping @dwijnand

@hvesalai
Copy link
Contributor Author

hvesalai commented Aug 6, 2019

I'll rebase to the correct branch

@hvesalai hvesalai force-pushed the fix-publishConfiguration-publishTo branch from 713a8e1 to ce118f8 Compare August 6, 2019 08:26
dwijnand
dwijnand previously approved these changes Aug 6, 2019
hvesalai referenced this pull request Aug 6, 2019
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)
```
@hvesalai
Copy link
Contributor Author

hvesalai commented Aug 6, 2019

The travis failure is from MIMA:

method getPublishTo(scala.Option)sbt.librarymanagement.Resolver in object sbt.Classpaths does not have a correspondent in current version

[error]    filter with: ProblemFilters.exclude[DirectMissingMethodProblem]("sbt.Classpaths.getPublishTo")

@dwijnand
Copy link
Member

dwijnand commented Aug 6, 2019

Yeah, you need to create new method.

@hvesalai hvesalai force-pushed the fix-publishConfiguration-publishTo branch from ce118f8 to 51a41e1 Compare August 6, 2019 10:14
@hvesalai
Copy link
Contributor Author

hvesalai commented Aug 6, 2019

done, needs new review and approval

@dwijnand dwijnand force-pushed the fix-publishConfiguration-publishTo branch from 51a41e1 to 9160908 Compare August 6, 2019 12:21
if (publishArtifact.value) getPublishTo(publishToOption).name else "local"
},
checksums.in(publish).value.toVector,
getPublishTo(publishTo.value, publishArtifact.value).name, // error if publishTo is None and publishArtifact is true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publish / skip might be better. See discussion here - #3136

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... I don't mind the new solutoin, but in any case the current code on lines 2342-2344 is clearly a bug and should be replaced soon with some sane alternative.

How about just merging this PR and then working the publish / skip into it as #3136 gets implemented.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publish / skip was implemented here - #3380

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean that instead of publishArtifact.value we should have here (skip in publish).value ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it should be !(skip in publish).value, since you could have published artifacts even if unscoped publishArtifact.value returns false.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if a better fix would be to just revert #3760

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

responded on #3760 (comment) - sounds like reverting that one is the way to go

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3760 is what broke our build so if that is reverted, all is fine for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eed3si9n is it certain that if skip in publish is true, then nobody depends on the publishConfiguration ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publish, publishLocal, publishSigned, and sbt-bintray respect the skip in publish, so that should cover the relevant party.

@eed3si9n
Copy link
Member

eed3si9n commented Aug 8, 2019

Closing this in favor of #4934

@eed3si9n eed3si9n closed this Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants