From daa26379ceae60b441f49dab49f367ebea027529 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 1 Aug 2011 17:46:48 +0000 Subject: 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. --- src/library/scala/util/Properties.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/library/scala/util/Properties.scala') 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. */ -- cgit v1.2.3