Skip to content

Commit

Permalink
Make the current artifact configurable and default to use the jar (#…
Browse files Browse the repository at this point in the history
…143)

* Make the current artifact configurable.

This enhances the flexibility of the plugin.

* Change the default for `mimaCurrentArtifact` to `jar`

This is to also take all potential post processing (filtering, shading, OSGi bundling) into account.
This is IMHO a better default than `compile().classes`, but if someone needs the old behavior, it's now configurable.

* doc

* ScalaDoc

* scalafmt
  • Loading branch information
lefou authored Nov 14, 2023
1 parent 8a336c3 commit 8ca13c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ def mimaPreviousArtifacts = Agg(
)
```

### mimaCurrentArtifact

The `PathRef` to the actual artifact that is being checked for binary compatibility. Defaults to use the result of the `jar` target.

_Up until version `0.0.24`, this was implemented as `compile().classes`, for compatibility to the sbt plugin._

```scala
def mimaCurrentArtifact = T {
compile().classes
}
```

### mimaBackwardIssueFilters

Filters to apply to binary issues found grouped by version of a module
Expand Down
10 changes: 9 additions & 1 deletion mill-mima/src/com/github/lolgab/mill/mima/MimaBase.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ private[mima] trait MimaBase
MimaWorkerExternalModule.mimaWorker().impl(cp)
}

/** The `PathRef` to the actual artifact that is being checked for binary
* compatibility. Defaults to use the result of the [[jar]] target.
*
* Up until version mill-mima `0.0.24`, this was implemented as
* [[compile]]`().classes`, for compatibility to the sbt plugin.
*/
def mimaCurrentArtifact: T[PathRef] = T { jar() }

def mimaReportBinaryIssues(): Command[Unit] = T.command {
def prettyDep(dep: Dep): String = {
s"${dep.dep.module.orgName}:${dep.dep.version}"
Expand All @@ -116,7 +124,7 @@ private[mima] trait MimaBase
log.outputStream.println(_)
val runClasspathIO =
runClasspath().view.map(_.path).filter(os.exists).map(_.toIO).toArray
val current = compile().classes.path.pipe {
val current = mimaCurrentArtifact().path.pipe {
case p if os.exists(p) => p
case _ => (T.dest / "emptyClasses").tap(os.makeDir)
}.toIO
Expand Down

0 comments on commit 8ca13c3

Please sign in to comment.