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

Split out scalac compiler plugins #2035

Closed
lefou opened this issue Sep 14, 2022 · 4 comments · Fixed by #2068
Closed

Split out scalac compiler plugins #2035

lefou opened this issue Sep 14, 2022 · 4 comments · Fixed by #2068

Comments

@lefou
Copy link
Member

lefou commented Sep 14, 2022

We have essentially two compiler plugins in Mill which we currently build as one:

  • we don't require override on overridden defs and vals and special handle mill.moduledefs.Cacher instances
  • we encode the ScalaDoc of targets as annotation mill.moduledefs.Scaladoc, se we can later extract and re-use them in mill inspect

Those are currently packaged in one ordinary Scala artifact mill-moduledefs based on Scala binary version.
Instead, they should be packaged for the full Scala version, to avoid conflicts.

Also, because of their packaging, they are currently not really usable outside of Mill, which makes developing external Mill plugins a bit more inconvenient, as e.g. the scaladoc encoding would be useful for external plugins too.

Contrary to the fact, that these modules change quite seldom, they need to be (re-)released whenever new Scala versions come out.

I suggest, to make them standalone project with their own release cycle and well defined compatibility scheme, so we can use them in Mill accordingly.

@lefou
Copy link
Member Author

lefou commented Oct 14, 2022

I started a new project: https://github.com/com-lihaoyi/mill-moduledefs

Once, we get it to properly publish, we can refactor to use that external project instead.

@lefou
Copy link
Member Author

lefou commented Oct 14, 2022

@lihaoyi I don't think we already have organization-wide secrets? Hence, could you please add the respective secrets to the new project? Thank you!

@lolgab
Copy link
Member

lolgab commented Oct 14, 2022

Other projects like mainargs are using organization-wide secrets
secrets

@lefou
Copy link
Member Author

lefou commented Oct 14, 2022

@lolgab Thanks for the info. I'll use these too, then.

lefou added a commit that referenced this issue Oct 21, 2022
This is the second step of externalizing the `moduledefs` module.

The first step was to migrate the current `moduledefs` code into an
external project
[`mill-moduledefs`](https://github.com/com-lihaoyi/mill-moduledefs).

This second step now removes the `moduledefs` local module and refactors
the build setup to use the external one. In the external project, we
split the shared code and the scalac plugin code into two modules, to
respect the different use cases and technical requirements.

* The new `mill-moduledefs` aritfact contains the traits and classes,
which need to be on the classpath
* The `scalac-mill-moduledefs-plugin` artifact contains the scalac
plugin, which is distributed for the full compiler version and is only
used at compile-time

The overall goal is, to develop and maintain both projects (Mill and
mill-moduledefs) independently. It especially enables proper
distribution of the compiler plugin for each full version of the Scala
compiler. In addition, we can post-release the now independent
mill-moduledefs project for newer Scala versions without bumping the
version (if needed), so externally developed Mill plugin projects can
safely use newer Scala versions without risking compiler issues.

* Fixes #2035

Pull request: #2068
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 a pull request may close this issue.

2 participants