aboutsummaryrefslogtreecommitdiff
path: root/stage1/cbt.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/cbt.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/cbt.scala')
-rw-r--r--stage1/cbt.scala13
1 files changed, 9 insertions, 4 deletions
diff --git a/stage1/cbt.scala b/stage1/cbt.scala
index 062e11d..05737d0 100644
--- a/stage1/cbt.scala
+++ b/stage1/cbt.scala
@@ -87,9 +87,9 @@ object `package`{
implicit class BuildInterfaceExtensions(build: BuildInterface){
import build._
// TODO: if every build has a method triggers a callback if files change
- // then we wouldn't need this and could provide this method from a
+ // then we wouldn't need this and could provide this method from a
// plugin rather than hard-coding trigger files stuff in cbt
- def triggerLoopFiles: Seq[File] = triggerLoopFilesArray.to
+ def triggerLoopFiles: Set[File] = triggerLoopFilesArray.to
}
implicit class ArtifactInfoExtensions(subject: ArtifactInfo){
import subject._
@@ -121,6 +121,9 @@ object `package`{
def scalaVersion = Option(scalaVersionOrNull)
def parentBuild = Option(parentBuildOrNull)
def cbtLastModified: scala.Long = subject.cbtLastModified
+ def triggerLoopFiles: Set[File] = triggerLoopFilesArray.toSet[File]
+
+ private[cbt] def loopFile = cwd / "target/.cbt-loop.tmp"
def copy(
workingDirectory: File = workingDirectory,
@@ -129,7 +132,8 @@ object `package`{
cbtLastModified: Long = cbtLastModified,
scalaVersion: Option[String] = scalaVersion,
cbtHome: File = cbtHome,
- parentBuild: Option[BuildInterface] = None
+ parentBuild: Option[BuildInterface] = None,
+ triggerLoopFiles: Set[File] = Set()
): Context = new ContextImplementation(
workingDirectory,
cwd,
@@ -144,7 +148,8 @@ object `package`{
cbtHome,
cbtRootHome,
compatibilityTarget,
- parentBuild.getOrElse(null)
+ parentBuild.getOrElse(null),
+ (triggerLoopFiles ++ triggerLoopFilesArray.toSet[File]).toArray
)
}
}