summaryrefslogtreecommitdiff
path: root/src/library/scala/util/Properties.scala
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-03-14 09:35:42 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-03-16 12:07:45 -0400
commit479aee3617e952d8705b95ef2ea3a155914dd03c (patch)
treea8c80ca05767a66e217550f557de4efbeb49bc7c /src/library/scala/util/Properties.scala
parent08778f747d18a98b6fd80738ad87613be946e142 (diff)
downloadscala-479aee3617e952d8705b95ef2ea3a155914dd03c.tar.gz
scala-479aee3617e952d8705b95ef2ea3a155914dd03c.tar.bz2
scala-479aee3617e952d8705b95ef2ea3a155914dd03c.zip
properties loading is now maven/osgi version aware. yippie.
Diffstat (limited to 'src/library/scala/util/Properties.scala')
-rw-r--r--src/library/scala/util/Properties.scala27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala
index 0c7772cd07..3ba803712d 100644
--- a/src/library/scala/util/Properties.scala
+++ b/src/library/scala/util/Properties.scala
@@ -72,10 +72,11 @@ private[scala] trait PropertiesTrait {
* it is an RC, Beta, etc. or was built from source, or if the version
* cannot be read.
*/
- val releaseVersion = scalaPropOrNone("version.number") flatMap { s =>
- val segments = s split '.'
- if (segments.size == 4 && segments.last == "final") Some(segments take 3 mkString ".") else None
- }
+ val releaseVersion =
+ for {
+ v <- scalaPropOrNone("maven.version.number")
+ if !(v endsWith "-SNAPSHOT")
+ } yield v
/** The development Scala version, if this is not a final release.
* The precise contents are not guaranteed, but it aims to provide a
@@ -85,15 +86,12 @@ private[scala] trait PropertiesTrait {
* @return Some(version) if this is a non-final version, None if this
* is a final release or the version cannot be read.
*/
- val developmentVersion = scalaPropOrNone("version.number") flatMap { s =>
- val segments = s split '.'
- if (segments.isEmpty || segments.last == "final")
- None
- else if (segments.last startsWith "r")
- Some(s takeWhile (ch => ch != '-')) // Cutting e.g. 2.10.0.r24774-b20110417125606 to 2.10.0.r24774
- else
- Some(s)
- }
+ val developmentVersion =
+ for {
+ v <- scalaPropOrNone("maven.version.number")
+ if v endsWith "-SNAPSHOT"
+ ov <- scalaPropOrNone("version.number")
+ } yield ov
/** Either the development or release version if known, otherwise
* the empty string.
@@ -103,7 +101,8 @@ private[scala] trait PropertiesTrait {
/** The version number of the jar this was loaded from plus "version " prefix,
* or "version (unknown)" if it cannot be determined.
*/
- val versionString = "version " + scalaPropOrElse("version.number", "(unknown)")
+ val versionString = "version " + scalaPropOrElse("version.number", "(unknown)") +
+ scalaPropOrNone("maven.version.number").map(v => "(" + v + ")").getOrElse("")
val copyrightString = scalaPropOrElse("copyright.string", "(c) 2002-2011 LAMP/EPFL")
/** This is the encoding to use reading in source files, overridden with -encoding