Skip to content

Commit

Permalink
support sbt 1.3.x and later only
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Mar 24, 2022
1 parent 5ab2192 commit 4d83c3b
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions docs/users/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ pull request is tested on both Linux and Windows.
@SCALA211@, @SCALA212@ and @SCALA213@.

**Scala 3.x**: Scala 3 support is experimental and many built-in rules are not
supported. Make sure you follow the "sbt 1.3x and newer" instructions below.
supported.

## sbt

Start by installing the sbt 1.x plugin in `project/plugins.sbt`
Start by installing the sbt 1.3+ plugin in `project/plugins.sbt`

```scala
// project/plugins.sbt
Expand Down Expand Up @@ -74,7 +74,7 @@ the Scala compiler option `-Ywarn-unused-import` (or `-Wunused:imports` in

```diff
/*
* build.sbt, for sbt 1.3x and newer
* build.sbt
* SemanticDB is enabled for all sub-projects via ThisBuild scope.
*/
inThisBuild(
Expand All @@ -92,7 +92,7 @@ the Scala compiler option `-Ywarn-unused-import` (or `-Wunused:imports` in

```diff
/*
* build.sbt, for sbt 1.3x and newer
* build.sbt
* SemanticDB is enabled only for a sub-project.
*/
lazy val myproject = project.settings(
Expand All @@ -103,18 +103,6 @@ the Scala compiler option `-Ywarn-unused-import` (or `-Wunused:imports` in
)
```

```diff
// build.sbt, for sbt 1.2.x and older (Scala 2.x only)
lazy val myproject = project.settings(
scalaVersion := "@SCALA212@", // @SCALA211@, or @SCALA213@
+ addCompilerPlugin(scalafixSemanticdb), // enable SemanticDB
scalacOptions ++= List(
+ "-Yrangepos", // required by SemanticDB compiler plugin
+ "-Ywarn-unused-import" // required by `RemoveUnused` rule
)
)
```

For `project/*.scala` files, add
`import scalafix.sbt.ScalafixPlugin.autoImport._` to the top of the file to
resolve `scalafixSemanticdb`.
Expand Down Expand Up @@ -331,8 +319,7 @@ processed.

### Customize SemanticDB output directory

When using the `semanticdbEnabled` key with sbt 1.3x and newer, the
`*.semanticdb` files are available in the directory referenced by the
The `*.semanticdb` files are available in the directory referenced by the
`semanticdbTargetRoot` key, which defaults to `target/scala-x/meta`.

You can override this default to emit `*.semanticdb` files in a custom
Expand Down

0 comments on commit 4d83c3b

Please sign in to comment.