Skip to content

Added section about plugin usage in Mill #2296

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

Merged
merged 2 commits into from
Jan 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions _overviews/plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,38 @@ For more details, see [Compiler Plugin
Support](https://www.scala-sbt.org/1.x/docs/Compiler-Plugins.html) in
the sbt manual.

## Using your plugin in Mill

To use a scalac compiler plugin in your Mill project, you can override
the `scalacPluginIvyDeps` target to add your plugins dependency coordinates.

Plugin options can be specified in `scalacOptions`.

Example:

```scala
// build.sc
import mill._, mill.scalalib._

object foo extends ScalaModule {
// Add the compiler plugin divbyzero in version 1.0
def scalacPluginIvyDeps = Agg(ivy"org.divbyzero:::divbyzero:1.0")
// Enable the `verbose` option of the divbyzero plugin
def scalacOptions = Seq("-P:divbyzero:verbose:true")
// other settings
// ...
}

```

Please notice, that compiler plugins are typically bound to the full
version of the compiler, hence you have to use the `:::` (instead of
normal `::`) between the organization and the artifact name,
to declare your dependency.

For more information about plugin usage in Mill, please refer to the
[Mill documentation](https://com-lihaoyi.github.io/mill/mill/Configuring_Mill.html#_scala_compiler_plugins).

## Developing compiler plugins with an IDE

Internally, the use of path-dependent types in the Scala compiler
Expand Down