aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/repl/ManifestInfo.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/repl/ManifestInfo.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/repl/ManifestInfo.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/repl/ManifestInfo.scala b/compiler/src/dotty/tools/dotc/repl/ManifestInfo.scala
new file mode 100644
index 000000000..206dccd67
--- /dev/null
+++ b/compiler/src/dotty/tools/dotc/repl/ManifestInfo.scala
@@ -0,0 +1,20 @@
+package dotty.tools.dotc.repl
+
+import java.net.JarURLConnection
+import scala.collection.JavaConversions._
+
+object ManifestInfo {
+
+ val attributes: Map[String, String] = {
+ for {
+ resourceUrl <- Option(getClass.getResource(getClass.getSimpleName + ".class"))
+ urlConnection = resourceUrl.openConnection() if urlConnection.isInstanceOf[JarURLConnection]
+ manifest <- Option(urlConnection.asInstanceOf[JarURLConnection].getManifest)
+ } yield {
+ manifest.getMainAttributes.foldLeft(Map[String, String]())(
+ (map, attribute) => map + (attribute._1.toString -> attribute._2.toString)
+ )
+ }
+ }.getOrElse(Map())
+
+}