diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-04 00:46:06 -0400 |
---|---|---|
committer | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-04 00:46:06 -0400 |
commit | 2d1a51d64aaca9ad00057a5bb822a50158b67429 (patch) | |
tree | 8fb5377f275bb639dd5a25ec5dcb37148f0faf10 /stage1/Stage1.scala | |
parent | 2b52377b6f6fbbc45ef705f33088e8e414a77105 (diff) | |
parent | 6e65120d99b6480b4d2577bde61e8754a60a2ee6 (diff) | |
download | cbt-2d1a51d64aaca9ad00057a5bb822a50158b67429.tar.gz cbt-2d1a51d64aaca9ad00057a5bb822a50158b67429.tar.bz2 cbt-2d1a51d64aaca9ad00057a5bb822a50158b67429.zip |
Merge pull request #99 from cvogt/maven-repos
Support for alternative maven resolvers
Diffstat (limited to 'stage1/Stage1.scala')
-rw-r--r-- | stage1/Stage1.scala | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/stage1/Stage1.scala b/stage1/Stage1.scala index e8245c4..3456e1f 100644 --- a/stage1/Stage1.scala +++ b/stage1/Stage1.scala @@ -1,7 +1,6 @@ package cbt import java.io._ -import java.time.LocalTime.now import scala.collection.immutable.Seq import scala.collection.JavaConverters._ @@ -50,41 +49,32 @@ object Stage1{ a.lastModified > b.lastModified } - def run(_args: Array[String], classLoader: ClassLoader, stage1SourcesChanged: java.lang.Boolean): Int = { + def run(_args: Array[String], classLoader: ClassLoader, _cbtChanged: java.lang.Boolean, start: java.lang.Long): Int = { val args = Stage1ArgsParser(_args.toVector) - val logger = new Logger(args.enabledLoggers) + val logger = new Logger(args.enabledLoggers, start) logger.stage1(s"Stage1 start") val lib = new Stage1Lib(logger) import lib._ - - val sourceFiles = stage2.listFiles.toVector.filter(_.isFile).filter(_.toString.endsWith(".scala")) - val changeIndicator = stage2Target ++ "/cbt/Build.class" - - val deps = Dependencies( - JavaDependency("net.incongru.watchservice","barbary-watchservice","1.0"), - JavaDependency("org.eclipse.jgit", "org.eclipse.jgit", "4.2.0.201601211800-r") - ) - val classLoaderCache = new ClassLoaderCache(logger) - val stage2SourcesChanged = lib.needsUpdate(sourceFiles, stage2StatusFile) + val sourceFiles = stage2.listFiles.toVector.filter(_.isFile).filter(_.toString.endsWith(".scala")) + val cbtHasChanged = _cbtChanged || lib.needsUpdate(sourceFiles, stage2StatusFile) logger.stage1("Compiling stage2 if necessary") - val scalaXml = JavaDependency("org.scala-lang.modules","scala-xml_"+constants.scalaMajorVersion,constants.scalaXmlVersion) compile( - stage2SourcesChanged, + cbtHasChanged, sourceFiles, stage2Target, stage2StatusFile, - nailgunTarget +: stage1Target +: Dependencies(deps, scalaXml).classpath, + CbtDependency().dependencyClasspath, Seq("-deprecation"), classLoaderCache, zincVersion = "0.3.9", scalaVersion = constants.scalaVersion ) - logger.stage1(s"[$now] calling CbtDependency.classLoader") - if(NailgunLauncher.stage2classLoader == null){ + logger.stage1(s"calling CbtDependency.classLoader") + if(cbtHasChanged){ NailgunLauncher.stage2classLoader = CbtDependency().classLoader(classLoaderCache) } - logger.stage1(s"[$now] Run Stage2") + logger.stage1(s"Run Stage2") val exitCode = ( NailgunLauncher.stage2classLoader.loadClass( if(args.admin) "cbt.AdminStage2" else "cbt.Stage2" @@ -96,7 +86,7 @@ object Stage1{ new File( args.args(0) ), args.args.drop(1).toVector, // launcher changes cause entire nailgun restart, so no need for them here - cbtHasChanged = stage1SourcesChanged || stage2SourcesChanged, + cbtHasChanged = cbtHasChanged, logger ) ) match { @@ -104,7 +94,7 @@ object Stage1{ case _ => ExitCode.Success } ).integer - logger.stage1(s"[$now] Stage1 end") + logger.stage1(s"Stage1 end") return exitCode; } } |