scala-steward icon indicating copy to clipboard operation
scala-steward copied to clipboard

Mill plugin cross-compiles on the wrong axis - consider outsourcing

Open lefou opened this issue 3 years ago • 1 comments

Scala-Steward currently cross-compiles the Mill plugin for Scala 2.12 and 2.13. To do that, it compiles against Mill versions 0.6.3 (Scala 2.12) and 0.10.7 (Scala 2.13). This (accidentally) results in binary compatibility to Mill 0.6.x (binary platform 0.6) and Mill 0.10.x (binary platform 0.10). But the plugin cannot be loaded by Mill versions with other Mill binary platforms, e.g. 0.7 or 0.9.

This is especially unfortunate, as Scala-Steward is all about updating older setups, but as it is effectively not updating any project using Mill between 0.7.0 and 0.9.12 (which are not that old versions), it feels like a "Mission failed". Also, when the next Mill binary platform comes out (0.11?) and Scala Steward updated it's dependency to it, we will probably miss any 0.10 updates too.

In previous discussions with @fthomas, he stated that he isn't able to suport/maintain more than the two Scala version based cross-builds. Back then, I privately tried to come up with a PR and changed the sbt build to do the appropriate cross-compiling with sbt-projectmatrix, but I never got it working to my satisfaction. But doing the necessary cross compile setup in Mill is easy for me. So here is my suggestion:

The Mill plugin is rather stable and changed seldomly in the past. We could outsource the mill-plugin into a separate Mill project. That way, we could easily build the plugin for all necessary Mill binary platforms. As a bonus, we could also add some integration tests for free. I'm willing to contribute the initial work. (I already have such setup ready for review, but I'd rather wait with making it public until we settle on that approach.)

Of course, there are alternatives, e.g. someone could implement the Mill binary platform based cross-building in sbt. But I'm not deep enough into sbt to do that, so this is IMHO a less actionable option.

WDYT?

lefou avatar Aug 31 '22 22:08 lefou

To do that, it compiles against Mill versions 0.6.3 (Scala 2.12) and 0.10.7 (Scala 2.13). This (accidentally) results in binary compatibility to Mill 0.6.x (binary platform 0.6) and Mill 0.10.x (binary platform 0.10).

To elaborate on the "accidentally". Instead it should compile against Mill 0.6.0 and 0.10.0, to avoid to use any newer API. At runtime, it's perfectly fine to use the latest version or better, the one selected by .mill-version.

lefou avatar Sep 02 '22 06:09 lefou

Can I get any feedback on this proposal?

lefou avatar Oct 17 '22 14:10 lefou

Gentle ping, are there on thoughts on what @lefou offered up above?

ckipp01 avatar Nov 29 '22 18:11 ckipp01

https://github.com/lefou/mill-scala-steward

lefou avatar Dec 02 '22 15:12 lefou

https://github.com/lefou/mill-scala-steward

btw this a 404 for me.

ckipp01 avatar Dec 02 '22 15:12 ckipp01

https://github.com/lefou/mill-scala-steward

btw this a 404 for me.

It was a private repo initially, now it's public.

lefou avatar Dec 03 '22 13:12 lefou

Sorry for late response. Thanks for the repo and work. I would say scala-steward-org/mill-plugin rather than personal repo, if we split projects.

exoego avatar Dec 03 '22 14:12 exoego

Sorry for late response. Thanks for the repo and work. I would say scala-steward-org/mill-plugin rather than personal repo, if we split projects.

Of course. I have no permissions to create a project in the scala-steward-org organization. But I'm happy to migrate. The intention was to give you all a feeling what we are talking about, tooling wise.

lefou avatar Dec 03 '22 19:12 lefou

Of course. I have no permissions to create a project in the scala-steward-org organization. But I'm happy to migrate.

I've just invited you to the organization so that have the required permissions for transferring the repo if you want to.

fthomas avatar Dec 04 '22 13:12 fthomas

Of course. I have no permissions to create a project in the scala-steward-org organization. But I'm happy to migrate.

I've just invited you to the organization so that have the required permissions for transferring the repo if you want to.

Thank you! I just transferred the repo to the organization. It's still called mill-scala-steward, as I don't have the permissions to rename it.

lefou avatar Dec 04 '22 17:12 lefou

I just transferred the repo to the organization.

Thanks!

It's still called mill-scala-steward, as I don't have the permissions to rename it.

You are now admin of this repository and should be able to rename it.

fthomas avatar Dec 04 '22 19:12 fthomas

The plugin is not migrated to https://github.com/scala-steward-org/mill-plugin

The first release from this repo was 0.17.0

lefou avatar Dec 14 '22 07:12 lefou