@@ -7,7 +7,7 @@ import java.util.jar.Attributes.{ Name => AttributeName }
7
7
8
8
/** Loads `library.properties` from the jar. */
9
9
object Properties extends PropertiesTrait {
10
- protected def propCategory = " library "
10
+ protected def propCategory = " compiler "
11
11
protected def pickJarBasedOn = classOf [Option [_]]
12
12
13
13
/** Scala manifest attributes.
@@ -56,36 +56,7 @@ trait PropertiesTrait {
56
56
def scalaPropOrElse (name : String , alt : String ): String = scalaProps.getProperty(name, alt)
57
57
def scalaPropOrEmpty (name : String ): String = scalaPropOrElse(name, " " )
58
58
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
+
89
60
/** Either the development or release version if known, otherwise
90
61
* the empty string.
91
62
*/
@@ -94,8 +65,16 @@ trait PropertiesTrait {
94
65
/** The version number of the jar this was loaded from plus "version " prefix,
95
66
* or "version (unknown)" if it cannot be determined.
96
67
*/
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" )
99
78
100
79
/** This is the encoding to use reading in source files, overridden with -encoding
101
80
* Note that it uses "prop" i.e. looks in the scala jar, not the system properties.
@@ -140,26 +119,21 @@ trait PropertiesTrait {
140
119
def jdkHome = envOrElse(" JDK_HOME" , envOrElse(" JAVA_HOME" , javaHome))
141
120
142
121
def versionMsg = " Scala %s %s -- %s" .format(propCategory, versionString, copyrightString)
143
- def scalaCmd = if (isWin) " scala .bat" else " scala "
144
- def scalacCmd = if (isWin) " scalac .bat" else " scalac "
122
+ def scalaCmd = if (isWin) " dotr .bat" else " dotr "
123
+ def scalacCmd = if (isWin) " dotc .bat" else " dotc "
145
124
146
125
/** Can the java version be determined to be at least as high as the argument?
147
126
* Hard to properly future proof this but at the rate 1.7 is going we can leave
148
127
* the issue for our cyborg grandchildren to solve.
149
128
*/
150
129
def isJavaAtLeast (version : String ) = {
151
130
val okVersions = version match {
152
- case " 1.5" => List (" 1.5" , " 1.6" , " 1.7" )
153
- case " 1.6" => List (" 1.6" , " 1.7" )
154
- case " 1.7" => List (" 1.7" )
131
+ case " 1.5" => List (" 1.5" , " 1.6" , " 1.7" , " 1.8" )
132
+ case " 1.6" => List (" 1.6" , " 1.7" , " 1.8" )
133
+ case " 1.7" => List (" 1.7" , " 1.8" )
134
+ case " 1.8" => List (" 1.8" )
155
135
case _ => Nil
156
136
}
157
137
okVersions exists (javaVersion startsWith _)
158
138
}
159
-
160
- // provide a main method so version info can be obtained by running this
161
- def main (args : Array [String ]): Unit = {
162
- val writer = new PrintWriter (Console .err, true )
163
- writer println versionMsg
164
- }
165
139
}
0 commit comments