support setting sbt.version from system property, which overrides setting in a properties file

fixes #354
This commit is contained in:
Mark Harrah 2012-02-07 21:51:16 -05:00
parent b0853cad31
commit 111dfba6a3
2 changed files with 6 additions and 5 deletions

View File

@ -90,11 +90,12 @@ class ConfigurationParser
def processVersion(label: String, defaultName: String)(value: Option[String]): Value[String] =
value.map(readValue[String](label)).getOrElse(new Implicit(defaultName, None))
def readValue[T](label: String)(implicit read: String => T): String => Value[T] = value =>
def readValue[T](label: String)(implicit read: String => T): String => Value[T] = value0 =>
{
val value = substituteVariables(value0)
if(isEmpty(value)) error(label + " cannot be empty (omit declaration to use the default)")
try { parsePropertyValue(label, value)(Value.readImplied[T]) }
catch { case e: BootException => new Explicit(read(substituteVariables(value))) }
catch { case e: BootException => new Explicit(read(value)) }
}
def processSection[T](sections: SectionMap, name: String, f: LabelMap => T) =
process[String,LabelMap,T](sections, name, m => f(m default(x => None)))

View File

@ -2,12 +2,12 @@
version: ${sbt.scala.version-auto}
[app]
org: ${{org}}
org: ${sbt.organization-${{org}}}
name: sbt
version: read(sbt.version)[${{sbt.version}}]
version: ${sbt.version-read(sbt.version)[${{sbt.version}}]}
class: ${sbt.main.class-sbt.xMain}
components: xsbti,extra
cross-versioned: false
cross-versioned: ${sbt.cross.versioned-false}
[repositories]
local