Skip to content

Commit

Permalink
Fix - define multiple times scalac options with -P and Xplugin prefix (
Browse files Browse the repository at this point in the history
  • Loading branch information
lwronski committed Feb 15, 2022
1 parent 6de9841 commit e560646
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ final case class ScalacOpt(value: String) {
def key: Option[String] =
if (value.startsWith("-"))
Some(value.takeWhile(_ != ':'))
.filterNot(ScalacOpt.repeatingKeys.contains)
.filterNot(key => ScalacOpt.repeatingKeys.exists(_.startsWith(key)))
else if (value.startsWith("@"))
Some("@")
else
Expand Down
22 changes: 22 additions & 0 deletions modules/build/src/test/scala/scala/build/tests/BuildTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -959,4 +959,26 @@ class BuildTests extends munit.FunSuite {
expect(scalacOptions == expectedOptions)
}
}

test("multiple times scalac options with -Xplugin prefix") {
val inputs = TestInputs(
os.rel / "foo.scala" ->
"""//> using option "-Xplugin:/paradise_2.12.15-2.1.1.jar"
|//> using option "-Xplugin:/semanticdb-scalac_2.12.15-4.4.31.jar"
|
|def foo = "bar"
|""".stripMargin
)

inputs.withBuild(defaultOptions, buildThreads, bloopConfig) { (_, _, maybeBuild) =>
val expectedOptions =
Seq(
"-Xplugin:/paradise_2.12.15-2.1.1.jar",
"-Xplugin:/semanticdb-scalac_2.12.15-4.4.31.jar"
)
val scalacOptions =
maybeBuild.toOption.get.options.scalaOptions.scalacOptions.toSeq.map(_.value.value)
expect(scalacOptions == expectedOptions)
}
}
}

0 comments on commit e560646

Please sign in to comment.