mirror of https://github.com/sbt/sbt.git
Use parent's toString
This commit is contained in:
parent
dc71b171da
commit
88a644eb4d
|
|
@ -943,21 +943,20 @@ private[sbt] object Load {
|
||||||
final class EvaluatedConfigurations(val eval: Eval, val settings: Seq[Setting[_]])
|
final class EvaluatedConfigurations(val eval: Eval, val settings: Seq[Setting[_]])
|
||||||
final case class InjectSettings(global: Seq[Setting[_]], project: Seq[Setting[_]], projectLoaded: ClassLoader => Seq[Setting[_]]) {
|
final case class InjectSettings(global: Seq[Setting[_]], project: Seq[Setting[_]], projectLoaded: ClassLoader => Seq[Setting[_]]) {
|
||||||
import java.net.URLClassLoader
|
import java.net.URLClassLoader
|
||||||
private val cache: mutable.Map[List[URL], Seq[Setting[_]]] = mutable.Map.empty
|
private val cache: mutable.Map[String, Seq[Setting[_]]] = mutable.Map.empty
|
||||||
// Cache based on the underlying URL values of the classloader
|
// Cache based on the underlying URL values of the classloader
|
||||||
def cachedProjectLoaded(cl: ClassLoader): Seq[Setting[_]] =
|
def cachedProjectLoaded(cl: ClassLoader): Seq[Setting[_]] =
|
||||||
cl match {
|
cl match {
|
||||||
case cl: URLClassLoader => cache.getOrElseUpdate(classLoaderToList(cl), projectLoaded(cl))
|
case cl: URLClassLoader => cache.getOrElseUpdate(classLoaderToHash(Some(cl)), projectLoaded(cl))
|
||||||
case _ => projectLoaded(cl)
|
case _ => projectLoaded(cl)
|
||||||
}
|
}
|
||||||
private def classLoaderToList(cl: ClassLoader): List[URL] =
|
private def classLoaderToHash(o: Option[ClassLoader]): String =
|
||||||
cl match {
|
o match {
|
||||||
case cl: URLClassLoader =>
|
case Some(cl: URLClassLoader) =>
|
||||||
cl.getURLs.toList ::: (Option(cl.getParent) match {
|
cl.getURLs.toList.toString + classLoaderToHash(Option(cl.getParent))
|
||||||
case Some(x) => classLoaderToList(x)
|
case Some(cl: ClassLoader) =>
|
||||||
case _ => Nil
|
cl.toString + classLoaderToHash(Option(cl.getParent))
|
||||||
})
|
case _ => "null"
|
||||||
case _ => Nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue