mirror of https://github.com/sbt/sbt.git
[2.x] fix: Fixes common settings with extraProjects (#9495)
**Problem** The presence of extraProjects broke common settings. **Solution** This fixes it by passing finalRoot.commonSettings.
This commit is contained in:
parent
110a140295
commit
fc3666586a
|
|
@ -1129,7 +1129,7 @@ private[sbt] object Load {
|
||||||
val newProjects = rest ++ discovered ++ projectLevelExtra
|
val newProjects = rest ++ discovered ++ projectLevelExtra
|
||||||
val newAcc = acc :+ finalRoot
|
val newAcc = acc :+ finalRoot
|
||||||
val newGenerated = generated ++ generatedConfigClassFiles
|
val newGenerated = generated ++ generatedConfigClassFiles
|
||||||
loadTransitive1(newProjects, newAcc, newGenerated, commonSettings)
|
loadTransitive1(newProjects, newAcc, newGenerated, finalRoot.commonSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load all config files AND process the project at the root directory, if it exists.
|
// Load all config files AND process the project at the root directory, if it exists.
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,32 @@
|
||||||
* Licensed under Apache License 2.0 (see LICENSE)
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
val check = taskKey[Unit]("Repro for #4947: task at root when extraProjects creates auto root")
|
@transient
|
||||||
|
val check4947 = taskKey[Unit]("")
|
||||||
|
|
||||||
|
@transient
|
||||||
|
val check5661 = taskKey[Unit]("")
|
||||||
|
|
||||||
|
@transient
|
||||||
|
val check9493 = taskKey[Unit]("")
|
||||||
|
|
||||||
|
organization := "com.example"
|
||||||
|
|
||||||
val a = project
|
val a = project
|
||||||
val p = project
|
val p = project
|
||||||
.settings(
|
.settings(
|
||||||
name := "p",
|
name := "p",
|
||||||
check := ()
|
// subproject-level task
|
||||||
|
check4947 := {},
|
||||||
|
|
||||||
|
check9493 := {
|
||||||
|
val o = organization.value
|
||||||
|
assert(o == "com.example", s"actual: $o")
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
LocalProject("mc") / cantTouchThis := "foo"
|
||||||
|
LocalRootProject / check5661 := {
|
||||||
|
val actual = (LocalProject("mc") / cantTouchThis).value
|
||||||
|
assert(actual == "foo", s"actual: $actual")
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,18 @@
|
||||||
* Licensed under Apache License 2.0 (see LICENSE)
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sbt._, Keys._
|
import sbt.*, Keys.*
|
||||||
|
|
||||||
|
object ExtraPlugin extends AutoPlugin:
|
||||||
|
object autoImport:
|
||||||
|
val cantTouchThis = settingKey[String]("")
|
||||||
|
end autoImport
|
||||||
|
import autoImport.*
|
||||||
|
|
||||||
object ExtraPlugin extends AutoPlugin {
|
|
||||||
override def trigger = allRequirements
|
override def trigger = allRequirements
|
||||||
override def extraProjects: Seq[Project] =
|
override def extraProjects: Seq[Project] =
|
||||||
Seq(Project("z", file("z")).settings(name := "z"))
|
Seq(Project("mc", file("mc")).settings(
|
||||||
}
|
name := "mc",
|
||||||
|
cantTouchThis := "can't touch this",
|
||||||
|
))
|
||||||
|
end ExtraPlugin
|
||||||
|
|
|
||||||
|
|
@ -1 +1,5 @@
|
||||||
> check
|
> check4947
|
||||||
|
|
||||||
|
> check5661
|
||||||
|
|
||||||
|
> p/check9493
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue