mirror of https://github.com/sbt/sbt.git
drop SessionSettings.prepend, which wasn't used
This commit is contained in:
parent
818aa0a563
commit
5b1ca2c6b0
|
|
@ -413,7 +413,7 @@ object Load
|
||||||
}
|
}
|
||||||
|
|
||||||
def initialSession(structure: BuildStructure, rootEval: () => Eval): SessionSettings =
|
def initialSession(structure: BuildStructure, rootEval: () => Eval): SessionSettings =
|
||||||
new SessionSettings(structure.root, rootProjectMap(structure.units), structure.settings, Map.empty, Map.empty, rootEval)
|
new SessionSettings(structure.root, rootProjectMap(structure.units), structure.settings, Map.empty, rootEval)
|
||||||
|
|
||||||
def rootProjectMap(units: Map[URI, LoadedBuildUnit]): Map[URI, String] =
|
def rootProjectMap(units: Map[URI, LoadedBuildUnit]): Map[URI, String] =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,14 @@ package sbt
|
||||||
|
|
||||||
import SessionSettings._
|
import SessionSettings._
|
||||||
|
|
||||||
final case class SessionSettings(currentBuild: URI, currentProject: Map[URI, String], original: Seq[Setting[_]], prepend: SessionMap, append: SessionMap, currentEval: () => Eval)
|
final case class SessionSettings(currentBuild: URI, currentProject: Map[URI, String], original: Seq[Setting[_]], append: SessionMap, currentEval: () => Eval)
|
||||||
{
|
{
|
||||||
assert(currentProject contains currentBuild, "Current build (" + currentBuild + ") not associated with a current project.")
|
assert(currentProject contains currentBuild, "Current build (" + currentBuild + ") not associated with a current project.")
|
||||||
def setCurrent(build: URI, project: String, eval: () => Eval): SessionSettings = copy(currentBuild = build, currentProject = currentProject.updated(build, project), currentEval = eval)
|
def setCurrent(build: URI, project: String, eval: () => Eval): SessionSettings = copy(currentBuild = build, currentProject = currentProject.updated(build, project), currentEval = eval)
|
||||||
def current: ProjectRef = ProjectRef(currentBuild, currentProject(currentBuild))
|
def current: ProjectRef = ProjectRef(currentBuild, currentProject(currentBuild))
|
||||||
def appendSettings(s: Seq[SessionSetting]): SessionSettings = copy(append = modify(append, _ ++ s))
|
def appendSettings(s: Seq[SessionSetting]): SessionSettings = copy(append = modify(append, _ ++ s))
|
||||||
def prependSettings(s: Seq[SessionSetting]): SessionSettings = copy(prepend = modify(prepend, s ++ _))
|
def mergeSettings: Seq[Setting[_]] = original ++ merge(append)
|
||||||
def mergeSettings: Seq[Setting[_]] = merge(prepend) ++ original ++ merge(append)
|
def clearExtraSettings: SessionSettings = copy(append = Map.empty)
|
||||||
def clearExtraSettings: SessionSettings = copy(prepend = Map.empty, append = Map.empty)
|
|
||||||
|
|
||||||
private[this] def merge(map: SessionMap): Seq[Setting[_]] = map.values.toSeq.flatten[SessionSetting].map(_._1)
|
private[this] def merge(map: SessionMap): Seq[Setting[_]] = map.values.toSeq.flatten[SessionSetting].map(_._1)
|
||||||
private[this] def modify(map: SessionMap, onSeq: Endo[Seq[SessionSetting]]): SessionMap =
|
private[this] def modify(map: SessionMap, onSeq: Endo[Seq[SessionSetting]]): SessionMap =
|
||||||
|
|
@ -46,7 +45,7 @@ object SessionSettings
|
||||||
{
|
{
|
||||||
val extracted = Project extract s
|
val extracted = Project extract s
|
||||||
import extracted._
|
import extracted._
|
||||||
if(session.prepend.isEmpty && session.append.isEmpty)
|
if(session.append.isEmpty)
|
||||||
{
|
{
|
||||||
logger(s).info("No session settings defined.")
|
logger(s).info("No session settings defined.")
|
||||||
s
|
s
|
||||||
|
|
@ -76,7 +75,7 @@ object SessionSettings
|
||||||
withSettings(s){session =>
|
withSettings(s){session =>
|
||||||
for( (ref, settings) <- session.append if !settings.isEmpty && include(ref) )
|
for( (ref, settings) <- session.append if !settings.isEmpty && include(ref) )
|
||||||
writeSettings(ref, settings, Project.structure(s))
|
writeSettings(ref, settings, Project.structure(s))
|
||||||
reapply(session.copy(original = session.mergeSettings, append = Map.empty, prepend = Map.empty), s)
|
reapply(session.copy(original = session.mergeSettings, append = Map.empty), s)
|
||||||
}
|
}
|
||||||
def writeSettings(pref: ProjectRef, settings: Seq[SessionSetting], structure: Load.BuildStructure)
|
def writeSettings(pref: ProjectRef, settings: Seq[SessionSetting], structure: Load.BuildStructure)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue