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

Continue if bloopGenerate fails for a project #1663

Merged
merged 1 commit into from Jan 26, 2022

Conversation

oyvindberg
Copy link
Contributor

I'm in a situation where I want to generate bloop files for all projects for all scala versions.

Unfortunately, if we have the following project graph

lazy val a = project.settings(crossScalaVersions := List("2.13.0", "3.0.0"))
lazy val b = project.settings(crossScalaVersions := List("2.13.0")).dependsOn(a)

and then +bloopInstall may fail for b when generating for scala 3.0.0, because it'll then use the 3.0.0 version of a and 2.13.0 of b.

I have seen errors like this:

[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef...:
[error]    org.scala-lang.modules:scala-collection-compat _3, _2.13
[error]    com.lihaoyi:sourcecode _2.13, _3
[error]    org.typelevel:simulacrum-scalafix-annotations _2.13, _3
[error]    org.typelevel:cats-kernel _2.13, _3
[error]    com.lihaoyi:fansi _3, _2.13
[error]    org.typelevel:cats-core _2.13, _3

I should also comment that I tried to do this in a "cleaner" way. Ideally we'd pick out the "active" scala version, and only try to generate for those if some flag was set. However, I was unable to find that anywhere.

Suggestions in that directions welcome

I'm in a situation where I want to generate bloop files for all projects for all scala variants.

Unfortunately, if we have the following project graph

```
lazy val a = project.settings(crossScalaVersions := List("2.13.0", "3.0.0"))
lazy val b = project.settings(crossScalaVersions := List("2.13.0")).dependsOn(a)
```
and then `+bloopInstall` may fail for `b` when generating for scala `3.0.0`, because it'll then use the `3.0.0` version of `a` and `2.13.0` of `b`.

I have seen errors like this:
```
[error] Modules were resolved with conflicting cross-version suffixes in ProjectRef...:
[error]    org.scala-lang.modules:scala-collection-compat _3, _2.13
[error]    com.lihaoyi:sourcecode _2.13, _3
[error]    org.typelevel:simulacrum-scalafix-annotations _2.13, _3
[error]    org.typelevel:cats-kernel _2.13, _3
[error]    com.lihaoyi:fansi _3, _2.13
[error]    org.typelevel:cats-core _2.13, _3
```
@keynmol
Copy link
Collaborator

keynmol commented Jan 22, 2022

not commenting on the PR, just an aside

I think in your case (where the build graph has "holes"), sbt-projectmatrix will give you a better experience, especially with bloop.

That said, it still won't solve the "give me a view of the project centered on a single Scala version", but at least the import will be complete and more robust.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks a lot for the contribution!

@tgodzik tgodzik merged commit 46c598d into scalacenter:master Jan 26, 2022
@oyvindberg oyvindberg deleted the on-error-resume-next branch January 26, 2022 16:52
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.

None yet

3 participants