Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 1.99 KB

README.md

File metadata and controls

56 lines (35 loc) · 1.99 KB

mill-tpolecat

CI License Maven Central

scalac options for the enlightened

mill-tpolecat is an extension for the Mill build tool for automagically configuring scalac options according to the project Scala version, inspired by Rob Norris (@tpolecat)'s excellent series of blog posts providing recommended options to get the most out of the compiler.

It has been tested with versions 0.10.x and 0.9.x of mill.

Usage

Import the module in build.sc using mill's $ivy import syntax, and extend TpolecatModule in your build definition:

// build.sc

import $ivy.`io.github.davidgregory084::mill-tpolecat::0.3.2`

import io.github.davidgregory084.TpolecatModule

object core extends TpolecatModule {
  def scalaVersion = "2.13.7"
}

Don't forget to apply the mill platform suffix to your import according to the mill version that you are using.

If necessary you can filter out scalac options that are not appropriate for your project:

// build.sc

import $ivy.`io.github.davidgregory084::mill-tpolecat_mill0.10:0.3.2`

import io.github.davidgregory084.TpolecatModule

object core extends TpolecatModule {
  def scalaVersion = "2.13.7"
  def scalacOptions = T { super.scalacOptions().filterNot(Set("-Yno-imports")) }
}

Caveat

I can't promise this plugin will work for old minor releases of Scala. It has been tested with:

  • 2.13.7
  • 2.12.11
  • 2.11.12

License

All code in this repository is licensed under the Apache License, Version 2.0. See LICENSE.