Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/com-lihaoyi/mill-moduledefs
Scalac compiler plugin to support Mill modules
https://github.com/com-lihaoyi/mill-moduledefs
mill scala scalac-plugin
Last synced: 2 months ago
JSON representation
Scalac compiler plugin to support Mill modules
- Host: GitHub
- URL: https://github.com/com-lihaoyi/mill-moduledefs
- Owner: com-lihaoyi
- License: mit
- Created: 2022-10-14T07:24:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T11:08:30.000Z (3 months ago)
- Last Synced: 2024-10-28T14:22:14.380Z (3 months ago)
- Topics: mill, scala, scalac-plugin
- Language: Scala
- Homepage:
- Size: 57.6 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.adoc
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
= mill-moduledefs
:toc-placement: preamble
:toc:
:version: 0.11.1A Scalac compiler plugin to support Mill modules.
== 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 ``object``s, Module targets are modelled as Scala ``def``s.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 ``def``s, 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
[source,scala,subs="attributes,verbatim"]
----
def ivyDeps = Agg(
ivy"com.lihaoyi::mill-moduledefs:{version}"
)
// Enable the plugin in the Scala compiler
def scalacPluginIvyDeps = Agg(
ivy"com.lihaoyi:::scalac-mill-moduledefs-plugin:{version}"
)
----// TODO: sbt setup
== Project Layout
This project contains two modules:
* `moduledefs` - Some shared code to be used in the Mill classpath. The `artifactName` is `mill-moduledefs`.
* `moduledefs/plugin` - A Scalac compiler plugin to be used when compiling Mill projects. The `artifactName` is `scalac-mill-moduledefs-plugin`.== 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 and implemented in the `publishToSonatype` command.
[source,scala]
----
def publishToSonatype(
sonatypeCreds: String,
gpgArgs: String = PublishModule.defaultGpgArgs.mkString(","),
dryRun: Boolean = false,
artifactsFile: Option[String] = None
): Command[Unit]
----**You need to update the version manually, before creatign the git tag!**
All git tags are automatically published. The tag should reflect the version number.
=== Re-publish for a new Scala Release
:example-version: 0.10.9
:example-scala-version: 2.13.10The 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, to release an already published version `{example-version}` for a new Scala version `{example-scala-version}`, follow these steps:
. Create a branch `release-{example-version}` from the git tag `{example-version}`.
. Add the new Scala version to the build setup. Make sure you don't change the actual code, so it stays compatible to the original tag.
. Add a file `PUBLISH_ONLY` containing a selector for the artifacts to publish. If you need more than one selector, place each on a new line.
+
.Example file `PUBLISH_ONLY`
----
moduledefs.plugin[2.13.10].publishArtifacts
----. Commit your changes.
. Tag your commit with `{example-version}-for-{example-scala-version}`. This will trigger the `publish-sonatype` workflow in GHA.
. If appropriate, update the Readme/Changelog in the `main` branch.
== License
This project is published under the https://mit-license.org/[MIT License].
== Changelog
[#0-11-1]
=== 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]
=== 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]
=== 0.11.0-M1 - 2024-08-22* Cross build to Scala 3.5.0
[#0-10-9]
=== 0.10.9 - 2022-11-10First 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 https://github.com/com-lihaoyi/mill/issues/2035[issue #2035], to learn why we split the projects.