mirror of https://github.com/sbt/sbt.git
[2.x] fix: Preserve user-defined scalacOptions in doc task scope (#8528)
Fixes #7482
This commit is contained in:
parent
82e370b4cb
commit
7b33362245
|
|
@ -1992,19 +1992,14 @@ object Defaults extends BuildCommon {
|
|||
else Map.empty[HashedVirtualFileRef, URI]
|
||||
},
|
||||
fileInputOptions := Seq("-doc-root-content", "-diagrams-dot-path"),
|
||||
scalacOptions := {
|
||||
val compileOptions = scalacOptions.value
|
||||
scalacOptions ++= {
|
||||
val sv = scalaVersion.value
|
||||
val config = configuration.value
|
||||
val projectName = name.value
|
||||
if (ScalaArtifacts.isScala3(sv)) {
|
||||
val project = if (config == Compile) projectName else s"$projectName-$config"
|
||||
if (scalaVersion.value.startsWith("3.0.0")) {
|
||||
Seq("-project", project)
|
||||
} else {
|
||||
compileOptions ++ Seq("-project", project)
|
||||
}
|
||||
} else compileOptions
|
||||
Seq("-project", project)
|
||||
} else Seq.empty
|
||||
},
|
||||
(TaskZero / key) := Def.uncached {
|
||||
val s = streams.value
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
scalaVersion := "2.13.12",
|
||||
Compile / doc / scalacOptions += "-no-link-warnings",
|
||||
TaskKey[Unit]("checkDocOptions") := {
|
||||
val opts = (Compile / doc / scalacOptions).value
|
||||
assert(opts.contains("-no-link-warnings"), s"Expected -no-link-warnings in doc scalacOptions but got: $opts")
|
||||
}
|
||||
)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Verify that Compile / doc / scalacOptions += works correctly
|
||||
# This tests the fix for issue #7482
|
||||
> checkDocOptions
|
||||
Loading…
Reference in New Issue