diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-30 23:39:14 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-30 23:39:14 -0400 |
commit | 57de43907e05d4cd3986e2994e0e3bff93e09b4e (patch) | |
tree | 9e07a28943ffe0d9c2ace7f06315d8034f1dd6f8 /stage1/Stage1.scala | |
parent | 8a4578311e4d11c06bfb4fe04e5bf414b94d24e8 (diff) | |
download | cbt-57de43907e05d4cd3986e2994e0e3bff93e09b4e.tar.gz cbt-57de43907e05d4cd3986e2994e0e3bff93e09b4e.tar.bz2 cbt-57de43907e05d4cd3986e2994e0e3bff93e09b4e.zip |
Makes zinc usage smarter, so we do not need to call it when no files changed (and safe up to 0.1s for each call)
There still seem to be 2 bugs related to CBT development in the code. One if you simpy save a stage1 file unchanged and re-run cbt, it fails to call Stage2.run reflectively. Also in case of compile errors in stage1, a TrappedExitCode exception is thrown and not caught.
Diffstat (limited to 'stage1/Stage1.scala')
-rw-r--r-- | stage1/Stage1.scala | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/stage1/Stage1.scala b/stage1/Stage1.scala index 32da3ed..be933d2 100644 --- a/stage1/Stage1.scala +++ b/stage1/Stage1.scala @@ -68,17 +68,21 @@ object Stage1{ val classLoaderCache = new ClassLoaderCache(logger) - val stage2SourcesChanged = sourceFiles.exists(newerThan(_, changeIndicator)) - logger.stage1("before conditionally running zinc to recompile CBT") - if( stage2SourcesChanged ) { - val scalaXml = JavaDependency("org.scala-lang.modules","scala-xml_"+constants.scalaMajorVersion,constants.scalaXmlVersion) - logger.stage1("cbt.lib has changed. Recompiling.") - zinc( true, sourceFiles, stage2Target, nailgunTarget +: stage1Target +: Dependencies(deps, scalaXml).classpath, classLoaderCache, Seq("-deprecation") )( zincVersion = "0.3.9", scalaVersion = constants.scalaVersion ) - } + val stage2SourcesChanged = 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, + sourceFiles, stage2Target, stage2StatusFile, + nailgunTarget +: stage1Target +: Dependencies(deps, scalaXml).classpath, + Seq("-deprecation"), classLoaderCache, + zincVersion = "0.3.9", scalaVersion = constants.scalaVersion + ) + logger.stage1(s"[$now] calling CbtDependency.classLoader") - val cl = classLoaderCache.transient.get( - (stage2Target +: deps.classpath).string, + val cl = /*classLoaderCache.transient.get( + (stage2Target +: deps.classpath).string,*/ cbt.URLClassLoader( ClassPath(Seq(stage2Target)), classLoaderCache.persistent.get( @@ -86,7 +90,7 @@ object Stage1{ cbt.URLClassLoader( deps.classpath, classLoader ) ) ) - ) + //) logger.stage1(s"[$now] Run Stage2") val exitCode = ( |