aboutsummaryrefslogtreecommitdiff
path: root/stage1/Stage1Lib.scala
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-11-25 16:48:28 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2017-02-01 23:10:48 -0500
commit00d9485f5597fdecc58461bd81df635fafbe494f (patch)
tree026f7f143d8cf5ae69e7afaa452d03180d3e04a8 /stage1/Stage1Lib.scala
parent8939ebef01ae7a665781d99331e4d13e7b875a96 (diff)
downloadcbt-00d9485f5597fdecc58461bd81df635fafbe494f.tar.gz
cbt-00d9485f5597fdecc58461bd81df635fafbe494f.tar.bz2
cbt-00d9485f5597fdecc58461bd81df635fafbe494f.zip
Merge separate hashmaps for persistent cache into one
This isn’t type-safe, but re-using that same hashmap for both keys and classloaders allows to reduce the number of members in Context. Also we can re-use the same hashMap for other things as well in the coming commits, e.g. timestamps.
Diffstat (limited to 'stage1/Stage1Lib.scala')
-rw-r--r--stage1/Stage1Lib.scala13
1 files changed, 8 insertions, 5 deletions
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala
index 273b9af..8fdde54 100644
--- a/stage1/Stage1Lib.scala
+++ b/stage1/Stage1Lib.scala
@@ -255,7 +255,7 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{
)
val singleArgs = scalacOptions.map( "-S" ++ _ )
- val code =
+ val code =
redirectOutToErr{
System.err.println("Compiling to " ++ compileTarget.toString)
try{
@@ -285,6 +285,8 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{
${files.sorted.mkString(" \\\n")}
"""
)
+
+ redirectOutToErr( e.printStackTrace )
ExitCode.Failure
}
}
@@ -416,6 +418,7 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{
}
def classLoaderRecursion( dependency: Dependency, latest: Map[(String,String),Dependency], cache: ClassLoaderCache ): ClassLoader = {
+ // FIXME: shouldn't we be using KeyLockedLazyCache instead of hashmap directly here?
val d = dependency
val dependencies = dependency.dependencies
def dependencyClassLoader( latest: Map[(String,String),Dependency], cache: ClassLoaderCache ): ClassLoader = {
@@ -426,14 +429,14 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{
classLoaderRecursion( dependencies.head, latest, cache )
} else{
val cp = d.dependencyClasspath.string
- if( dependencies.exists(_.needsUpdate) && cache.persistent.containsKey(cp) ){
- cache.persistent.remove(cp)
+ if( dependencies.exists(_.needsUpdate) && cache.cache.containsKey(cp) ){
+ cache.cache.remove(cp)
}
def cl = new MultiClassLoader( dependencies.map( classLoaderRecursion(_, latest, cache) ) )
if(d.isInstanceOf[BuildInterface])
cl // Don't cache builds right now. We need to fix invalidation first.
else
- cache.persistent.get( cp, cl )
+ cache.cache.get( cp, cl )
}
}
@@ -442,6 +445,6 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{
if(d.isInstanceOf[BuildInterface])
cl
else
- cache.persistent.get( a.classpath.string, cl )
+ cache.cache.get( a.classpath.string, cl ).asInstanceOf[ClassLoader]
}
}