Skip to content

Commit

Permalink
Add assembly, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyrsmith committed May 20, 2022
1 parent 43d92cf commit 3eadd2d
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ binary incompatibility issues that are introduced between two versions of a Scal

It is neither endorsed nor supported by Lightbend. All it does is invoke MiMa.

## Installation

Each GitHub release has an assembly JAR attached to it, which should be directly executable. So just download it, name
it `mima-cli` and put it somewhere in your `PATH`.

Alternatively, it's also released to Maven Central, so you can probably use [Coursier's `bootstrap` command](https://get-coursier.io/docs/cli-bootstrap)
instead.

## Usage

```
Expand Down Expand Up @@ -34,6 +42,57 @@ Options:
Show bytecode names of fields and methods, rather than human-readable names
```

## Output
If there are no binary incompatibilities to report, `mima-cli` prints nothing and exits with `0` status. Otherwise,
it exits with a status representing the number of binary compatibility problems, after printing a report of the problems
to stdout.

Here's a sample of default output, on two old versions of [circe](https://github.com/circe/circe) (I had to reach pretty
far back to find any examples of binary incompatibility!)

```
$ mima-cli circe-core_2.12-0.9.0.jar circe-core_2.12-0.10.0.jar
io.circe.ACursor.fieldSet: DirectMissingMethod
io.circe.ACursor.fields: DirectMissingMethod
io.circe.Decoder.decodeTraversable: DirectMissingMethod
io.circe.Decoder.and: DirectMissingMethod
io.circe.Decoder.split: DirectMissingMethod
io.circe.Decoder.decodeTraversable: DirectMissingMethod
io.circe.Decoder#DecoderWithFailure.and: DirectMissingMethod
io.circe.Decoder#DecoderWithFailure.split: DirectMissingMethod
io.circe.Encoder.importedEncoder: IncompatibleMethType
io.circe.Encoder.importedEncoder: IncompatibleMethType
io.circe.JsonNumber.truncateToByte: DirectMissingMethod
io.circe.JsonNumber.truncateToShort: DirectMissingMethod
io.circe.JsonNumber.truncateToInt: DirectMissingMethod
io.circe.JsonNumber.truncateToLong: DirectMissingMethod
io.circe.JsonObject.from: DirectMissingMethod
io.circe.JsonObject.fields: DirectMissingMethod
io.circe.JsonObject.fieldSet: DirectMissingMethod
io.circe.JsonObject.withJsons: DirectMissingMethod
io.circe.JsonObject.from: DirectMissingMethod
io.circe.RootEncoder.importedRootEncoder: IncompatibleMethType
io.circe.RootEncoder.importedRootEncoder: IncompatibleMethType
```

And a few lines of the corresponding `--verbose` output:

```
$ mima-cli -v circe-core_2.12-0.9.0.jar circe-core_2.12-0.10.0.jar
io.circe.ACursor.fieldSet: DirectMissingMethod: deprecated method fieldSet()scala.Option in class io.circe.ACursor does not have a correspondent in new version
io.circe.ACursor.fields: DirectMissingMethod: deprecated method fields()scala.Option in class io.circe.ACursor does not have a correspondent in new version
io.circe.Decoder.decodeTraversable: DirectMissingMethod: static method decodeTraversable(io.circe.Decoder,scala.collection.generic.CanBuildFrom)io.circe.Decoder in interface io.circe.Decoder does not have a correspondent in new version
```

And, a few lines of the corresponding `--bytecode-names` output (this is intended for use in other classfile tooling, like `javap`):

```
$ mima-cli -j circe-core_2.12-0.9.0.jar circe-core_2.12-0.10.0.jar
io/circe/ACursor.fieldSet()Lscala.Option;: DirectMissingMethod
io/circe/ACursor.fields()Lscala.Option;: DirectMissingMethod
io/circe/Decoder.decodeTraversable(Lio.circe.Decoder;Lscala.collection.generic.CanBuildFrom;)Lio.circe.Decoder;: DirectMissingMethod
```

## License

It's under the Apache 2.0 License, because that's what MiMA has. [Click here for MiMa's license.](https://github.com/lightbend/mima/blob/main/LICENSE)
Expand Down
7 changes: 6 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ organization := "io.github.jeremyrsmith"
name := "mima-cli"
version := "0.1.0"
scalaVersion := "2.13.8"
publishTo := sonatypePublishToBundle.value
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
homepage := Some(url("https://github.com/jeremyrsmith/mima-cli"))
scmInfo := Some(ScmInfo(
url("https://github.com/jeremyrsmith/mima-cli"),
"scm:git:[email protected]:jeremyrsmith/mima-cli.git"))
Expand All @@ -22,4 +24,7 @@ libraryDependencies ++= Seq(

scalacOptions ++= Seq(
"-deprecation"
)
)

import sbtassembly.AssemblyPlugin.defaultShellScript
ThisBuild / assemblyPrependShellScript := Some(defaultShellScript)
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")

0 comments on commit 3eadd2d

Please sign in to comment.