aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stage2/BuildBuild.scala13
-rw-r--r--stage2/GitDependency.scala14
2 files changed, 16 insertions, 11 deletions
diff --git a/stage2/BuildBuild.scala b/stage2/BuildBuild.scala
index c6d45d3..901e860 100644
--- a/stage2/BuildBuild.scala
+++ b/stage2/BuildBuild.scala
@@ -28,24 +28,25 @@ trait BuildBuild extends BaseBuild{
if(context.cbtHome.string.contains(hash))
None
else Some{
- val checkoutDirectory = new GitDependency(base, hash).checkout
- val build = new BasicBuild( context.copy( projectDirectory = checkoutDirectory ++ "/nailgun_launcher" ) )
- val cl = build
- .classLoader(classLoaderCache)
// Note: cbt can't use an old version of itself for building,
// otherwise we'd have to recursively build all versions since
// the beginning. Instead CBT always needs to build the pure Java
// Launcher in the checkout with itself and then run it via reflection.
- cl
+ val dep = new GitDependency(base, hash, Some("nailgun_launcher"))
+ val ctx = managedContext.copy( cbtHome = dep.checkout )
+ dep.classLoader(classLoaderCache)
.loadClass( "cbt.NailgunLauncher" )
.getMethod( "getBuild", classOf[AnyRef] )
- .invoke( null, managedContext.copy(cbtHome=checkoutDirectory) )
+ .invoke( null, ctx )
}
}.getOrElse{
+ //new BasicBuild(managedContext)
+ ///*
classLoader(context.classLoaderCache)
.loadClass(lib.buildClassName)
.getConstructors.head
.newInstance(managedContext)
+ //*/
}
} else {
new BasicBuild(managedContext)
diff --git a/stage2/GitDependency.scala b/stage2/GitDependency.scala
index 174f9ff..0457c3c 100644
--- a/stage2/GitDependency.scala
+++ b/stage2/GitDependency.scala
@@ -9,7 +9,7 @@ object GitDependency{
val GitUrl = "(git:|https:|file:/)//([^/]+)/(.+)".r
}
case class GitDependency(
- url: String, ref: String // example: git://github.com/cvogt/cbt.git#<some-hash>
+ url: String, ref: String, subDirectory: Option[String] = None // example: git://github.com/cvogt/cbt.git#<some-hash>
)(implicit val logger: Logger, classLoaderCache: ClassLoaderCache, context: Context ) extends DependencyImplementation{
import GitDependency._
override def lib = new Lib(logger)
@@ -18,8 +18,8 @@ case class GitDependency(
// See http://www.codeaffine.com/2014/12/09/jgit-authentication/
private val GitUrl( _, domain, path ) = url
-
- def checkout: File = {
+ private object checkoutCache extends Cache[File]
+ def checkout: File = checkoutCache{
val checkoutDirectory = context.cache ++ s"/git/$domain/$path/$ref"
if(checkoutDirectory.exists){
logger.git(s"Found existing checkout of $url#$ref in $checkoutDirectory")
@@ -38,9 +38,13 @@ case class GitDependency(
}
checkoutDirectory
}
- private object dependencyCache extends Cache[Dependency]
+ private object dependencyCache extends Cache[DependencyImplementation]
def dependency = dependencyCache{
- BuildDependency( context.copy( projectDirectory = checkout ) )
+ BuildDependency(
+ context.copy(
+ projectDirectory = checkout ++ subDirectory.map("/" ++ _).getOrElse("")
+ )
+ )
}
def dependencies = Seq(dependency)