Skip to content

Commit 36beb74

Browse files
committed
Don't hardcode version number and copyright string + DCE.
1 parent 0bc4885 commit 36beb74

File tree

1 file changed

+11
-32
lines changed

1 file changed

+11
-32
lines changed

compiler/src/dotty/tools/dotc/config/Properties.scala

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,36 +56,7 @@ trait PropertiesTrait {
5656
def scalaPropOrElse(name: String, alt: String): String = scalaProps.getProperty(name, alt)
5757
def scalaPropOrEmpty(name: String): String = scalaPropOrElse(name, "")
5858
def scalaPropOrNone(name: String): Option[String] = Option(scalaProps.getProperty(name))
59-
60-
/** The numeric portion of the runtime Scala version, if this is a final
61-
* release. If for instance the versionString says "version 2.9.0.final",
62-
* this would return Some("2.9.0").
63-
*
64-
* @return Some(version) if this is a final release build, None if
65-
* it is an RC, Beta, etc. or was built from source, or if the version
66-
* cannot be read.
67-
*/
68-
val releaseVersion =
69-
for {
70-
v <- scalaPropOrNone("maven.version.number")
71-
if !(v endsWith "-SNAPSHOT")
72-
} yield v
73-
74-
/** The development Scala version, if this is not a final release.
75-
* The precise contents are not guaranteed, but it aims to provide a
76-
* unique repository identifier (currently the svn revision) in the
77-
* fourth dotted segment if the running version was built from source.
78-
*
79-
* @return Some(version) if this is a non-final version, None if this
80-
* is a final release or the version cannot be read.
81-
*/
82-
val developmentVersion =
83-
for {
84-
v <- scalaPropOrNone("maven.version.number")
85-
if v endsWith "-SNAPSHOT"
86-
ov <- scalaPropOrNone("version.number")
87-
} yield ov
88-
59+
8960
/** Either the development or release version if known, otherwise
9061
* the empty string.
9162
*/
@@ -94,8 +65,16 @@ trait PropertiesTrait {
9465
/** The version number of the jar this was loaded from plus "version " prefix,
9566
* or "version (unknown)" if it cannot be determined.
9667
*/
97-
val versionString = "version " + "0.01" //scalaPropOrElse("version.number", "(unknown)")" +
98-
val copyrightString = "(c) 2013 LAMP/EPFL" // scalaPropOrElse("copyright.string", "(c) 2002-2011 LAMP/EPFL")
68+
val versionString = {
69+
val v = scalaPropOrElse("version.number", "(unknown)")
70+
"version " + scalaPropOrElse("version.number", "(unknown)") + {
71+
if (v.contains("SNAPSHOT") || v.contains("NIGHTLY")) {
72+
"-git-" + scalaPropOrElse("git.hash", "(unknown)")
73+
} else ""
74+
}
75+
}
76+
77+
val copyrightString = scalaPropOrElse("copyright.string", "(c) 2002-2017 LAMP/EPFL")
9978

10079
/** This is the encoding to use reading in source files, overridden with -encoding
10180
* Note that it uses "prop" i.e. looks in the scala jar, not the system properties.

0 commit comments

Comments
 (0)