aboutsummaryrefslogtreecommitdiff
path: root/stage2/BuildBuild.scala
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-04-07 00:30:54 -0400
committerChristopher Vogt <oss.nsp@cvogt.org>2016-04-07 00:31:27 -0400
commitce8bab3856ec8755fb3b99be324f090770ddfe1f (patch)
tree43f0cbea4fa66414f59763b589d029fd43cb7e6b /stage2/BuildBuild.scala
parent1e2063c934028bd765f761038c607b1c78e6d161 (diff)
downloadcbt-ce8bab3856ec8755fb3b99be324f090770ddfe1f.tar.gz
cbt-ce8bab3856ec8755fb3b99be324f090770ddfe1f.tar.bz2
cbt-ce8bab3856ec8755fb3b99be324f090770ddfe1f.zip
Fix stage2 classloader not being stored in transient cache
and thus being re-created on second and subsequent runs. Also use classloader from cache for Builds rather than new one, which should properly make Build dependencies work.
Diffstat (limited to 'stage2/BuildBuild.scala')
-rw-r--r--stage2/BuildBuild.scala16
1 files changed, 7 insertions, 9 deletions
diff --git a/stage2/BuildBuild.scala b/stage2/BuildBuild.scala
index 6435bcd..c52c3c6 100644
--- a/stage2/BuildBuild.scala
+++ b/stage2/BuildBuild.scala
@@ -6,16 +6,14 @@ class BuildBuild(context: Context) extends Build(context){
override def dependencies = Seq( CbtDependency()(context.logger) ) ++ super.dependencies
def managedBuildDirectory: File = lib.realpath( projectDirectory.parent )
val managedBuild = try{
- val cl = new cbt.URLClassLoader(
- exportedClasspath,
- classOf[BuildBuild].getClassLoader // FIXME: this looks wrong. Should be ClassLoader.getSystemClassLoader but that crashes
- )
val managedContext = context.copy( projectDirectory = managedBuildDirectory )
- cl
- .loadClass(lib.buildClassName)
- .getConstructor(classOf[Context])
- .newInstance(managedContext)
- .asInstanceOf[Build]
+ val cl = classLoader(context.classLoaderCache)
+ logger.composition("Loading build at "+managedContext.projectDirectory)
+ cl
+ .loadClass(lib.buildClassName)
+ .getConstructor(classOf[Context])
+ .newInstance(managedContext)
+ .asInstanceOf[Build]
} catch {
case e: ClassNotFoundException if e.getMessage == lib.buildClassName =>
throw new Exception("You need to remove the directory or define a class Build in: "+context.projectDirectory)