aboutsummaryrefslogtreecommitdiff
path: root/stage1/Stage1.scala
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-03-12 01:47:57 -0500
committerChristopher Vogt <oss.nsp@cvogt.org>2017-03-12 11:56:25 -0400
commit244f86a9cdf19904169456c234a2752f125dd427 (patch)
tree51e1f79100cc3651dfce66d4a284584d6bef3997 /stage1/Stage1.scala
parent4eb753e4d4ef5be7443b99832892bac697b10b50 (diff)
downloadcbt-244f86a9cdf19904169456c234a2752f125dd427.tar.gz
cbt-244f86a9cdf19904169456c234a2752f125dd427.tar.bz2
cbt-244f86a9cdf19904169456c234a2752f125dd427.zip
revamp loop feature
now CBT and builds pass their file names to the current build via the context. The build then simply blocks until any file changes. Then it returns with a special exit code, which the bash script picks up and restarts CBT. Thats works well for looping over project files. It works less well for looping over builds and CBT itself. For this a build has to success once, so that the .cbt-loop.tmp file exists. Then looping works for cbt and builds, but the file list is not updated in case of compile errors, etc. Fixes - https://github.com/cvogt/cbt/issues/406 - https://github.com/cvogt/cbt/issues/405 - https://github.com/cvogt/cbt/issues/202 - https://github.com/cvogt/cbt/issues/50 - https://github.com/cvogt/cbt/issues/22 We should improve for 1.0 in https://github.com/cvogt/cbt/issues/419 to handle looping over build files and cbt itself smarter.
Diffstat (limited to 'stage1/Stage1.scala')
-rw-r--r--stage1/Stage1.scala18
1 files changed, 11 insertions, 7 deletions
diff --git a/stage1/Stage1.scala b/stage1/Stage1.scala
index 714ed65..85ec0e9 100644
--- a/stage1/Stage1.scala
+++ b/stage1/Stage1.scala
@@ -42,7 +42,8 @@ class Stage2Args(
val stage2LastModified: Long,
val cache: File,
val cbtHome: File,
- val compatibilityTarget: File
+ val compatibilityTarget: File,
+ val stage2sourceFiles: Seq[File]
)(
implicit val transientCache: java.util.Map[AnyRef,AnyRef], val classLoaderCache: ClassLoaderCache, val logger: Logger
){
@@ -57,7 +58,7 @@ object Stage1{
def getBuild( _context: java.lang.Object, buildStage1: BuildStage1Result ) = {
val context = _context.asInstanceOf[Context]
val logger = new Logger( context.enabledLoggers, buildStage1.start )
- val (cbtLastModified, classLoader) = buildStage2(
+ val (_, cbtLastModified, classLoader) = buildStage2(
buildStage1,
context.cbtHome,
context.cache
@@ -76,7 +77,9 @@ object Stage1{
def buildStage2(
buildStage1: BuildStage1Result, cbtHome: File, cache: File
- )(implicit transientCache: java.util.Map[AnyRef,AnyRef], classLoaderCache: ClassLoaderCache, logger: Logger): (Long, ClassLoader) = {
+ )(
+ implicit transientCache: java.util.Map[AnyRef,AnyRef], classLoaderCache: ClassLoaderCache, logger: Logger
+ ): (Seq[File], Long, ClassLoader) = {
import buildStage1._
@@ -149,7 +152,7 @@ object Stage1{
)
}
- ( stage2LastModified, stage2ClassLoader )
+ ( stage2sourceFiles, stage2LastModified, stage2ClassLoader )
}
def run(
@@ -166,7 +169,7 @@ object Stage1{
implicit val transientCache: java.util.Map[AnyRef,AnyRef] = new java.util.HashMap
implicit val classLoaderCache = new ClassLoaderCache( persistentCache )
- val (stage2LastModified, classLoader) = buildStage2( buildStage1, cbtHome, cache )
+ val (stage2sourceFiles, stage2LastModified, classLoader) = buildStage2( buildStage1, cbtHome, cache )
val stage2Args = new Stage2Args(
new File( args.args(0) ),
@@ -175,7 +178,8 @@ object Stage1{
stage2LastModified = stage2LastModified,
cache,
cbtHome,
- new File(buildStage1.compatibilityClasspath)
+ new File(buildStage1.compatibilityClasspath),
+ stage2sourceFiles
)
logger.stage1(s"Run Stage2")
@@ -193,7 +197,7 @@ object Stage1{
case _ => ExitCode.Success
}
).integer
- logger.stage1(s"Stage1 end")
+ logger.stage1(s"Stage1 end with exit code " + exitCode)
return exitCode;
}
}