summaryrefslogtreecommitdiff
path: root/src/library/scala/util/Properties.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-08-01 17:46:48 +0000
committerPaul Phillips <paulp@improving.org>2011-08-01 17:46:48 +0000
commitdaa26379ceae60b441f49dab49f367ebea027529 (patch)
tree42ab375e1071ccc625258241f876c1a4d0b75cc7 /src/library/scala/util/Properties.scala
parent8c0fa605fba819d6ad8714a488d404e966d224b3 (diff)
downloadscala-daa26379ceae60b441f49dab49f367ebea027529.tar.gz
scala-daa26379ceae60b441f49dab49f367ebea027529.tar.bz2
scala-daa26379ceae60b441f49dab49f367ebea027529.zip
Working on jar creation infrastructure.
output generation (but only then, since otherwise we're not creating the jar): 1) -Xmain-class foo.Bar will give the jar a Main-Class of foo.Bar 2) Alternatively, if there is only one runnable program, that will be the Main-Class 3) Always, the jar's manifest will have an entry for Scala-Compiler-Version. Not very relatedly, a warning is now issued when a module has a main method but a runnable program will not be generated. Closes SI-4861. This represents an opening step toward automatically recognizing mismatched bytecode situations: coarse, but useful and safe. Review by mirco.
Diffstat (limited to 'src/library/scala/util/Properties.scala')
-rw-r--r--src/library/scala/util/Properties.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala
index d2c9e6770b..998661895b 100644
--- a/src/library/scala/util/Properties.scala
+++ b/src/library/scala/util/Properties.scala
@@ -10,11 +10,16 @@
package scala.util
import java.io.{ IOException, PrintWriter }
+import java.util.jar.Attributes.{ Name => AttributeName }
/** Loads `library.properties` from the jar. */
object Properties extends PropertiesTrait {
protected def propCategory = "library"
protected def pickJarBasedOn = classOf[ScalaObject]
+
+ /** Scala manifest attributes.
+ */
+ val ScalaCompilerVersion = new AttributeName("Scala-Compiler-Version")
}
private[scala] trait PropertiesTrait {
@@ -90,6 +95,11 @@ private[scala] trait PropertiesTrait {
Some(s)
}
+ /** Either the development or release version if known, otherwise
+ * the empty string.
+ */
+ def versionNumberString = scalaPropOrEmpty("version.number")
+
/** The version number of the jar this was loaded from plus "version " prefix,
* or "version (unknown)" if it cannot be determined.
*/