aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/Jars.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/test/dotty/Jars.scala')
-rw-r--r--compiler/test/dotty/Jars.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/test/dotty/Jars.scala b/compiler/test/dotty/Jars.scala
index f062f8b25..06df9c891 100644
--- a/compiler/test/dotty/Jars.scala
+++ b/compiler/test/dotty/Jars.scala
@@ -19,4 +19,17 @@ object Jars {
val dottyTestDeps: List[String] =
dottyLib :: dottyCompiler :: dottyInterfaces :: dottyExtras
+
+
+ def scalaLibraryFromRuntime: String = findJarFromRuntime("scala-library-2.")
+
+ private def findJarFromRuntime(partialName: String) = {
+ val urls = ClassLoader.getSystemClassLoader.asInstanceOf[java.net.URLClassLoader].getURLs.map(_.getFile.toString)
+ urls.find(_.contains(partialName)).getOrElse {
+ throw new java.io.FileNotFoundException(
+ s"""Unable to locate $partialName on classpath:\n${urls.toList.mkString("\n")}"""
+ )
+ }
+ }
+
}