diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-13 14:45:36 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-13 15:29:33 -0500 |
commit | ff6856395499853f3dc10723a0c722ee4c33fed7 (patch) | |
tree | 3b0e339e941f51dfcf7c0d159522dd22be73f884 /stage2 | |
parent | 9664f3e22156ab159e310f31720082b417dcf03e (diff) | |
download | cbt-ff6856395499853f3dc10723a0c722ee4c33fed7.tar.gz cbt-ff6856395499853f3dc10723a0c722ee4c33fed7.tar.bz2 cbt-ff6856395499853f3dc10723a0c722ee4c33fed7.zip |
minor refactoring using shorter names
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/BuildBuild.scala | 10 | ||||
-rw-r--r-- | stage2/BuildDependency.scala | 2 | ||||
-rw-r--r-- | stage2/Lib.scala | 13 |
3 files changed, 14 insertions, 11 deletions
diff --git a/stage2/BuildBuild.scala b/stage2/BuildBuild.scala index 0736e7e..cf56c3b 100644 --- a/stage2/BuildBuild.scala +++ b/stage2/BuildBuild.scala @@ -35,7 +35,7 @@ trait BuildBuildWithoutEssentials extends BaseBuild{ private object managedBuildCache extends Cache[BuildInterface] def managedBuild = managedBuildCache{ val managedBuildFile = projectDirectory++"/build.scala" - logger.composition("Loading build at "++managedContext.projectDirectory.toString) + logger.composition("Loading build at " ++ managedBuildDirectory.toString) val build = ( if(managedBuildFile.exists){ val contents = new String(Files.readAllBytes(managedBuildFile.toPath)) @@ -66,8 +66,8 @@ trait BuildBuildWithoutEssentials extends BaseBuild{ .getConstructors.head .newInstance(managedContext) } catch { - case e: ClassNotFoundException if e.getMessage == lib.buildClassName => - throw new Exception("You need to define a class Build in build.scala in: "+context.projectDirectory) + case e: ClassNotFoundException if e.getMessage == lib.buildClassName => + throw new Exception("You need to define a class Build in build.scala in: "+projectDirectory) } } } else if( projectDirectory.listFiles.exists( _.getName.endsWith(".scala") ) ){ @@ -90,9 +90,9 @@ trait BuildBuildWithoutEssentials extends BaseBuild{ build.asInstanceOf[BuildInterface] } catch { case e: ClassCastException if e.getMessage.contains("Build cannot be cast to cbt.BuildInterface") => - throw new Exception("Your Build class needs to extend BaseBuild in: "+context.projectDirectory, e) + throw new Exception("Your Build class needs to extend BaseBuild in: "+projectDirectory, e) } } override def triggerLoopFiles = super.triggerLoopFiles ++ managedBuild.triggerLoopFiles - override def finalBuild: BuildInterface = if( context.projectDirectory == context.cwd ) this else managedBuild.finalBuild + override def finalBuild: BuildInterface = if( projectDirectory == context.cwd ) this else managedBuild.finalBuild } diff --git a/stage2/BuildDependency.scala b/stage2/BuildDependency.scala index a834435..197a7a1 100644 --- a/stage2/BuildDependency.scala +++ b/stage2/BuildDependency.scala @@ -29,7 +29,7 @@ final case class DirectoryDependency(context: Context) extends TriggerLoop{ } /* case class DependencyOr(first: DirectoryDependency, second: JavaDependency) extends ProjectProxy with DirectoryDependencyBase{ - val isFirst = new File(first.context.projectDirectory).exists + val isFirst = new File(first.projectDirectory).exists def triggerLoopFiles = if(isFirst) first.triggerLoopFiles else Seq() protected val delegate = if(isFirst) first else second } diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 9da468d..c007906 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -31,13 +31,16 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ This can either the Build itself, of if exists a BuildBuild or a BuildBuild for a BuildBuild and so on. */ def loadRoot(context: Context, default: Context => BuildInterface = new BasicBuild(_)): BuildInterface = { - context.logger.composition( context.logger.showInvocation("Build.loadRoot",context.projectDirectory) ) def findStartDir(projectDirectory: File): File = { val buildDir = realpath( projectDirectory ++ "/build" ) if(buildDir.exists) findStartDir(buildDir) else projectDirectory } - val start = findStartDir(context.projectDirectory) + val directory = context.projectDirectory + + context.logger.composition( context.logger.showInvocation("Build.loadRoot",directory) ) + + val start = findStartDir(directory) val useBasicBuildBuild = context.projectDirectory == start @@ -49,9 +52,9 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ // essentials depends on eval, which has a build that depends on scalatest // this means in these we can't depend on essentials // hopefully we find a better way that this pretty hacky exclusion rule - context.projectDirectory == (context.cbtHome ++ "/plugins/essentials") - || context.projectDirectory == (context.cbtHome ++ "/libraries/eval") - || context.projectDirectory == (context.cbtHome ++ "/plugins/scalatest") + directory == (context.cbtHome ++ "/plugins/essentials") + || directory == (context.cbtHome ++ "/libraries/eval") + || directory == (context.cbtHome ++ "/plugins/scalatest") ) new cbt.BasicBuild( context.copy( projectDirectory = start ) ) with BuildBuildWithoutEssentials else |