From 92b26f394460aa609f9d073ea044776e7d8c46fb Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Tue, 14 Feb 2017 00:07:57 -0500 Subject: implicitly pass classloader, might make code easier and prepares for allowing `run` and `runFlat` at Dependency instead of Build level --- stage1/Stage1Lib.scala | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'stage1/Stage1Lib.scala') diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala index 5a2f05d..67c1f4e 100644 --- a/stage1/Stage1Lib.scala +++ b/stage1/Stage1Lib.scala @@ -192,11 +192,10 @@ class Stage1Lib( logger: Logger ) extends BaseLib{ dependencies: Seq[Dependency], mavenCache: File, scalacOptions: Seq[String] = Seq(), - classLoaderCache: ClassLoaderCache, zincVersion: String, scalaVersion: String )( - implicit transientCache: java.util.Map[AnyRef, AnyRef] + implicit transientCache: java.util.Map[AnyRef, AnyRef], classLoaderCache: ClassLoaderCache ): Option[Long] = { val d = Dependencies(dependencies) val classpath = d.classpath @@ -259,7 +258,7 @@ class Stage1Lib( logger: Logger ) extends BaseLib{ dualArgs ++ singleArgs ++ ( if(cp.isEmpty) Nil else Seq("-cp", cp) ) ++ sourceFiles.map(_.toString), - zinc.classLoader(classLoaderCache) + zinc.classLoader ) } catch { case scala.util.control.NonFatal(e) => @@ -413,20 +412,20 @@ ${sourceFiles.sorted.mkString(" \\\n")} case d => d } - def classLoaderRecursion( dependency: Dependency, latest: Map[(String,String),Dependency], cache: ClassLoaderCache)(implicit transientCache: java.util.Map[AnyRef,AnyRef] ): ClassLoader = { + def classLoaderRecursion( dependency: Dependency, latest: Map[(String,String),Dependency])(implicit transientCache: java.util.Map[AnyRef,AnyRef], cache: ClassLoaderCache): ClassLoader = { // FIXME: shouldn't we be using KeyLockedLazyCache instead of hashmap directly here? val dependencies = dependency.dependencies val dependencyClassLoader: ClassLoader = { if( dependency.dependencies.isEmpty ){ NailgunLauncher.jdkClassLoader } else if( dependencies.size == 1 ){ - classLoaderRecursion( dependencies.head, latest, cache ) + classLoaderRecursion( dependencies.head, latest ) } else{ val lastModified = dependencies.map( _.lastModified ).max val cp = dependency.dependencyClasspath.string val cl = new MultiClassLoader( - dependencies.map( classLoaderRecursion(_, latest, cache) ) + dependencies.map( classLoaderRecursion(_, latest) ) ) if(dependency.isInstanceOf[BuildInterface]) cl // Don't cache builds right now. We need to fix invalidation first. -- cgit v1.2.3