aboutsummaryrefslogtreecommitdiff
path: root/stage2/BasicBuild.scala
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-03-12 22:00:00 -0400
committerChristopher Vogt <oss.nsp@cvogt.org>2017-03-12 22:34:02 -0400
commit828adac48d0e08766d192c7ce01021083cfc4d67 (patch)
tree06e19c3f9117c24e6c6a5e8a95990011a0efe4b3 /stage2/BasicBuild.scala
parentc14e288996d2b56b6b06a0624f4f2fca315369c7 (diff)
downloadcbt-828adac48d0e08766d192c7ce01021083cfc4d67.tar.gz
cbt-828adac48d0e08766d192c7ce01021083cfc4d67.tar.bz2
cbt-828adac48d0e08766d192c7ce01021083cfc4d67.zip
fix file watching for real
last file watching update didn’t work well enough. This now - rips out barbary watch service as it seems buggy crashing the jvm - make cbt exclusively write files to watch to a file - uses fswatch instead watching all files in that file
Diffstat (limited to 'stage2/BasicBuild.scala')
-rw-r--r--stage2/BasicBuild.scala29
1 files changed, 9 insertions, 20 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala
index 1308155..37b1786 100644
--- a/stage2/BasicBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -5,7 +5,7 @@ import java.net._
import java.nio.file._
class BasicBuild(final val context: Context) extends BaseBuild
-trait BaseBuild extends BuildInterface with DependencyImplementation with TriggerLoop with SbtDependencyDsl{
+trait BaseBuild extends BuildInterface with DependencyImplementation with SbtDependencyDsl{
//* DO NOT OVERRIDE CONTEXT in non-idempotent ways, because .copy and new Build
// will create new instances given the context, which means operations in the
// overrides will happen multiple times and if they are not idempotent stuff likely breaks
@@ -127,12 +127,6 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
pathToNestedBuild: _*
)
- def triggerLoopFiles: Set[File] = (
- context.triggerLoopFiles
- ++ sources
- ++ transitiveDependencies.collect{ case b: TriggerLoop => b.triggerLoopFiles }.flatten
- )
-
def localJars: Seq[File] =
Seq(projectDirectory ++ "/lib")
.filter(_.exists)
@@ -164,6 +158,14 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
final def lastModified: Long = compile.getOrElse(0L)
+ def triggerLoopFiles: Set[File] = sources.toSet
+
+ if(context.loop){
+ taskCache[BasicBuild]( "loop-file-cache" ).memoize{
+ lib.addLoopFiles( context.cwd, triggerLoopFiles )
+ }
+ }
+
def compile: Option[Long] = taskCache[BaseBuild]("_compile").memoize{
lib.compile(
Math.max( context.cbtLastModified, context.parentBuild.map(_.lastModified).getOrElse(0L) ),
@@ -325,17 +327,4 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
final def crossScalaVersionsArray = Array(scalaVersion)
def publish: Seq[URL] = Seq()
-
- def loop = {
- lib.callReflective(this, context.args.headOption, context.copy(args=context.args.drop(1)))
- val files = triggerLoopFiles
- lib.watch{ () =>
- logger.loop("Looping change detection over:\n - "++files.mkString("\n - "))
- files
- }()
- context.loopFile.getParentFile.mkdirs
- lib.write( context.loopFile, files.mkString("\n"), StandardOpenOption.CREATE )
-
- ExitCode(253) // signal bash script to restart
- }
}