-
Notifications
You must be signed in to change notification settings - Fork 18
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
Ignore non-standard repositories #225
Ignore non-standard repositories #225
Conversation
We could also add a |
This reverts commit c0e3a18.
Allowing users to filter out repositories for scalafix
* issue for non-Maven or Ivy repositories. Overriding this task and filtering those repositories out allows to work | ||
* around that. | ||
*/ | ||
def scalafixRepositories: Task[Seq[Repository]] = Task.Anon { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between Task.Anon
and Task
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The former doesn't serialize and cache its result, while the latter does. CoursierModule#repositoriesTask
relies on that for example, as all coursier.Repository
instances cannot all be serialized to JSON (coursier.Repository
is an "open" abstract class, we don't know all its implementations beforehand). We need to do the same here, as coursier.Repository
is involved.
def scalafixRepositories: Task[Seq[Repository]] = Task.Anon { | ||
repositoriesTask().filter { | ||
case repo if repo.getClass.getName == "mill.scalalib.JavaModule$InternalRepo" => | ||
// Change to this when bumping to Mill > 0.12.5: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we also need the current case
statement for backcompatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that can be changed only when bumping to 0.13
false | ||
case _ => true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do you mind adding a space after this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
Thanks @alexarchambault @joan38 ! Could you help tag release with this PR? |
|
Now that joan38/mill-scalafix#225 is available
This PR tries to address an issue seen in com-lihaoyi/mill#4353. It does so by ignoring non-Maven or Ivy repositories, when giving a repository list to scalafix.
com-lihaoyi/mill#4145 introduced such a repository in the default repo list in Mill, to expose Mill's internal modules to coursier. This repository can't be straightforwardly converted to a
coursierapi.Repository
. Hence the error we're seeing in com-lihaoyi/mill#4353. This repository can be ignored fine by scalafix (scalafix wouldn't use it to fetch scalafix artifacts anyway).The changes here imply other such repositories will be silently ignored by scalafix. Alternatively, we could try to detect and ignore only Mill's internal repo, and keep failing on the others.