com-lihaoyi / mill-moduledefs   0.12.4

MIT License GitHub

Scalac compiler plugin to support Mill modules

Scala versions: 3.x 2.13

mill-moduledefs

About

The Mill build tool module structure is highly tied to the organizational structure of the Scala programming language. Project modules are modelled as Scala objects, Module targets are modelled as Scala defs.

Mill targets are also modelled as free applicatives, which among other things makes the Mill task graph introspectable. To hide some boilerplate code needed to nicely write tasks like defs, Mill uses some Scala macros and a Scalac compiler plugin.

In this project, you’ll find the compiler plugin and some shared code.

Usage

Artifacts of this project are released to Maven Central.

Mill (1.x)
def mvnDeps = Agg(
  mvn"com.lihaoyi::mill-moduledefs:0.12.5-RC1"
)
// Enable the plugin in the Scala compiler
def scalacPluginIvyDeps = Agg(
  mvn"com.lihaoyi:::scalac-mill-moduledefs-plugin:0.12.5-RC1"
)

Project Layout

This project contains two modules:

  • moduledefs - Some shared code to be used in the Mill classpath. The artifactName is mill-moduledefs. This is cross-build to support Scala 2.13 and Scala 3

  • plugin - A Scalac compiler plugin to be used when compiling Mill projects. The artifactName is scalac-mill-moduledefs-plugin. This is crossbuild for all supported Scala compiler versions. If there is an older version missing, it is probably not supported. If a newer version is missing, please open an issue and/or pull request. If technically possible, we can also back-publish a recent version for a new Scala release.

Development and Releases

This code is expected to change rarely.

It should be especially kept stable within the same Mill major version.

Publishing

Publishing is automated via GitHub Actions.

Important
You need to update the version manually, before creatign the git tag!

Don’t forget to update the changelog as well!

Once you pushed the tag, it will be automatically published. The tag should reflect the version number.

Re-publish for a new Scala Release

The most frequently expected changes are releases for newer Scala version. This is especially needed, as compiler plugins are tied to the exact Scala compiler version.

Hence, this build aims to be flexible enough, to release an already tagged version for newer Scalac releases after the fact.

As an example, we want to release an already published version 0.12.5 for a new Scala version 3.8.0:

To do that:

  1. Select the publish-artifacts.yml workflow

  2. Find the "Run workflow" drop down (upper right corner)

  3. In the Branch-selector select the Tags tab and chosse the correct tag 0.12.5 (must be >= 0.12.5)

  4. Press "Run workflow" to start the process

Important
Remember to also open a pull request against the main branch, to make the support for the new Scala version permanent.

License

This project is published under the MIT License.

Changelog

0.12.5-RC1

  • Add support for Scala 2.13.16, 2.13.17, 2.13.18

  • Enabled back-publish support in the GitHub Actions based publisher

0.12.4

  • Support for Scala 3.8.0-RC3

0.12.3

  • Support for Scala 3.8.0-RC2

0.12.2

  • Add support for Scala 3.7.4

  • Dropped support for Scala 3.5.x, 3.6.x

0.12.1

  • Add support for Scala 3.8.0-RC1

0.12.0

  • Add support for Scala 3.7.2, 3.7.3

0.11.10

  • internal changes

0.11.9

  • internal changes

0.11.8

  • internal changes

0.11.7

  • fix build script

0.11.6

  • Update Sonatype publishing

0.11.5

  • Add support for Scala 3.7.1

0.11.4

  • Add support for Scala 3.7.0

0.11.3-M5

  • Added support for Scala 3.6.3 and 3.6.4

0.11.1 - 2024-10-11

  • Copy doc comment to module class in Scala 3

  • 2024-10-20: Published for Scala 2.13.15

0.11.0 - 2024-10-04

  • Support for Scala 3

  • T{} in error message renamed to Task{}

  • Support .mill filesystem extension

0.11.0-M1 - 2024-08-22

  • Cross build to Scala 3.5.0

0.10.9 - 2022-11-10

First stable release from this repository. No feature additions and removals since release 0.10.8 from the Mill repository.

  • 2023-06-03: Published for Scala 2.13.11

  • 2023-09-07: Published for Scala 2.13.12

  • 2024-02-27: Published for Scala 2.13.13

  • 2024-05-22: Published for Scala 2.13.14

0.10.9-alpha-1 - 2022-10-17

Initial release from this repository. Intended for testing only.

Older Releases

Older versions of this project were developed in the Mill git repository and were packaged as ordinary Scala artifact mill-moduledefs (without the full Scala version suffix). Refer to issue #2035, to learn why we split the projects.