diff options
Diffstat (limited to 'stage2/BuildBuild.scala')
-rw-r--r-- | stage2/BuildBuild.scala | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/stage2/BuildBuild.scala b/stage2/BuildBuild.scala index 813b44b..c52c3c6 100644 --- a/stage2/BuildBuild.scala +++ b/stage2/BuildBuild.scala @@ -6,22 +6,20 @@ 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 managedContext = context.copy( cwd = managedBuildDirectory ) - val cl = new cbt.URLClassLoader( - exportedClasspath, - classOf[BuildBuild].getClassLoader // FIXME: this looks wrong. Should be ClassLoader.getSystemClassLoader but that crashes - ) - cl - .loadClass(lib.buildClassName) - .getConstructor(classOf[Context]) - .newInstance(managedContext) - .asInstanceOf[Build] + val managedContext = context.copy( projectDirectory = managedBuildDirectory ) + 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.cwd) + throw new Exception("You need to remove the directory or define a class Build in: "+context.projectDirectory) case e: Exception => - throw new Exception("during build: "+context.cwd, e) + throw new Exception("during build: "+context.projectDirectory, e) } override def triggerLoopFiles = super.triggerLoopFiles ++ managedBuild.triggerLoopFiles - override def finalBuild = managedBuild.finalBuild + override def finalBuild = if( context.projectDirectory == context.cwd ) this else managedBuild.finalBuild } |