Relative path for compiler plugin while using sbt >= 1.4.0 breaks compilation.
See original GitHub issueI’ve noticed that when using sbt >= 1.4.0 and sbt-bloop
, there is a difference in how a compiler plugin is listed under project.scala.options
in the bloop json file. We’ll use wart remover as an example. When using sbt 1.3.13 and wart remover the path to the plugin is absolute and pointing towards my coursier cache. However, in sbt >= 1.4.0 it’s a relative path to /target/compiler_plugins/<plugin>
. For example using 1.3.13
"project": {
"scala": {
"options": [
"-Xplugin:/Users/ckipp/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/wartremover/wartremover_2.13.3/2.4.13/wartremover_2.13.3-2.4.13.jar"
]
}
}
Using >= 1.4.0
"project": {
"scala": {
"options": [
"-Xplugin:target/compiler_plugins/wartremover_2.13.3-2.4.13.jar",
]
}
}
This causes issues when compiling:
❯ bloop compile (bloop projects)
Compiling wart-remover-bloop (1 Scala source)
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Var
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.TryPartial
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.TraversableOps
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Throw
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.StringPlusAny
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Serializable
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Return
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Product
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.OptionPartial
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Null
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.NonUnitStatements
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.IsInstanceOf
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.EitherProjectionPartial
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.DefaultArguments
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.AsInstanceOf
[E] [E-1] bad option: -P:wartremover:traverser:org.wartremover.warts.Any
Compiled wart-remover-bloop (92ms)
[E] Failed to compile 'wart-remover-bloop-test','wart-remover-bloop'
If the path is changed to an absolute path pointing in the target directory, then there is no problem. I’m unsure if that path is given from sbt in this manner, if Bloop is in charge of getting it from sbt and making sure it’s absolute, or even something else.
You can reproduce this by the following steps
- Run
g8 scala/hello-world.g8
- Add in
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.13")
- Add in
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.5-8-6cc6911d")
- Run
sbt bloopInstall
- Run
bloop compile $(bloop projects)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (8 by maintainers)
Because of Windows and its
C:\
orC:/
Related: https://youtrack.jetbrains.com/issue/SCL-18534#focus=Comments-27-4614571.0-0