added property file to scala-library.jar

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@11012 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
michelou 2007-05-11 13:16:31 +00:00
parent 2b612049b2
commit 4609ba6ad0
2 changed files with 90 additions and 0 deletions

View File

@ -65,6 +65,7 @@ PROPERTIES
<property name="scaladoc.exec.name" value="scaladoc"/>
<property name="fsc.exec.name" value="fsc"/>
<property name="comp.prop.name" value="compiler.properties"/>
<property name="lib.prop.name" value="library.properties"/>
<!-- ===========================================================================
ANT INITIALISATION
@ -346,6 +347,16 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
<exclude name="scala/actors/**"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</starr>
<echo
file="${locker.dir}/lib/library/${lib.prop.name}"
message="version.number=${version.number}${line.separator}"
append="false"
/>
<echo
file="${locker.dir}/lib/library/${lib.prop.name}"
message="copyright.string=${copyright.string}${line.separator}"
append="true"
/>
<!-- Build compiler -->
<mkdir dir="${locker.dir}/lib/compiler"/>
<starr
@ -466,6 +477,16 @@ BUILD QUICK-TEST LAYER
<exclude name="scala/actors/**"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</locker>
<echo
file="${quick.dir}/lib/library/${lib.prop.name}"
message="version.number=${version.number}${line.separator}"
append="false"
/>
<echo
file="${quick.dir}/lib/library/${lib.prop.name}"
message="copyright.string=${copyright.string}${line.separator}"
append="true"
/>
<!-- Build DBC -->
<mkdir dir="${quick.dir}/lib/dbc"/>
<locker
@ -668,6 +689,16 @@ TEST
<exclude name="scala/actors/**"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</quick>
<echo
file="${strap.dir}/lib/library/${lib.prop.name}"
message="version.number=${version.number}${line.separator}"
append="false"
/>
<echo
file="${strap.dir}/lib/library/${lib.prop.name}"
message="copyright.string=${copyright.string}${line.separator}"
append="true"
/>
<!-- Build DBC -->
<mkdir dir="${strap.dir}/lib/dbc"/>
<quick
@ -970,6 +1001,7 @@ GENERATES A DISTRIBUTION
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="scala.tools.nsc.Main"/>
<attribute name="Class-Path" value="${lib.jar.name}"/>
<section name="scala/tools/nsc">
<attribute name="Extension-Name" value="scala.tools.nsc"/>
@ -988,6 +1020,7 @@ GENERATES A DISTRIBUTION
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="scala.runtime.Properties"/>
<section name="scala">
<attribute name="Extension-Name" value="scala"/>
<attribute name="Specification-Title" value="Scala Library"/>

View File

@ -0,0 +1,57 @@
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.runtime
/** A utility to load the library properties from a Java properties file
* included in the jar.
*
* @author Stephane Micheloud
*/
object Properties {
/** The name of the properties file */
private val propFilename = "/library.properties"
/** The loaded properties */
private val props = {
val props = new java.util.Properties
val stream = classOf[Application].getResourceAsStream(propFilename)
if (stream != null)
props.load(stream)
props
}
/** The version number of the jar this was loaded from, or
* "(unknown)" if it cannot be determined.
*/
val versionString: String = {
val defaultString = "(unknown)"
"version " + props.getProperty("version.number")
}
val copyrightString: String = {
val defaultString = "(c) 2002-2007 LAMP/EPFL"
props.getProperty("copyright.string", defaultString)
}
val encodingString: String = {
val defaultString = "ISO-8859-1"
props.getProperty("file.encoding", defaultString)
}
private val writer = new java.io.PrintWriter(Console.err, true)
val versionMsg = "Scala library " + versionString + " -- " + copyrightString
def main(args: Array[String]) {
writer.println(versionMsg)
}
}