kitlangton / scala-update

Update your Scala dependencies interactively
Apache License 2.0
132 stars 19 forks source link

Support Mill #15

Closed kitlangton closed 2 years ago

ex0ns commented 2 years ago

We can't parse the build file as it's currently done with sbt (as least I think) however we can take a similar approach to the way scala-steward does.

  1. Create a temporary build file that inject a mill module and exposes an extractDeps targs (https://github.com/scala-steward-org/scala-steward/blob/2a89b6648a8bb822002ee176e8ab97444ff6f695/modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala#L70). I honestly think that we could even reuse the plugin done for scalasteward "as is", this would avoid the burden of maintaining an publishing yet another module
  2. Create some Dependency (the ADT from this project) from the output of this module
  3. Add a way to replace the version into the file on disk for mill. I don't know how to do that yet, it will probably not be as nice as the implementation for sbt, but this should work well enough I think.
  4. Add switch parameters/auto detect if the build is sbt of mill and act accordingly (we might need to add of or two traits/abstraction in order to dispatch the dependencies extraction/update to the correct class

I might give it a try but not before mid July

Edit: after some digging we should be able to parse build.sc file with dialect.Sbt1 as well, so it might be another approach. There is also a

mill mill.scalalib.Dependency/showUpdates

Target in mill that might be useful