aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2017-06-15 23:15:37 -0400
committerGitHub <noreply@github.com>2017-06-15 23:15:37 -0400
commit494c302e738529ff2113d25910398d7b2b7a196c (patch)
treed67c88d10906647c7fd56229e6e56121a9107744 /examples
parent618711302b7ea29de651c1f771eb3160e236b339 (diff)
parent09051773461b98d374d1b46dd0a2caa57768ab30 (diff)
downloadcbt-494c302e738529ff2113d25910398d7b2b7a196c.tar.gz
cbt-494c302e738529ff2113d25910398d7b2b7a196c.tar.bz2
cbt-494c302e738529ff2113d25910398d7b2b7a196c.zip
Merge pull request #523 from cvogt/restart
sbt-revolver like restart feature
Diffstat (limited to 'examples')
-rw-r--r--examples/restart/Readme.md10
-rw-r--r--examples/restart/build/build.scala4
-rw-r--r--examples/restart/src/Main.scala6
3 files changed, 20 insertions, 0 deletions
diff --git a/examples/restart/Readme.md b/examples/restart/Readme.md
new file mode 100644
index 0000000..e4bf1b5
--- /dev/null
+++ b/examples/restart/Readme.md
@@ -0,0 +1,10 @@
+This example's main method simply prints the current process id.
+This can be used to experiment with cbt's restart feature
+(the equivalent to sbt-revolver).
+
+```
+cbt direct loop restart
+```
+
+starts the main method in a separate process and kills it, when
+a change in project, build file or cbt is detected.
diff --git a/examples/restart/build/build.scala b/examples/restart/build/build.scala
new file mode 100644
index 0000000..a18f951
--- /dev/null
+++ b/examples/restart/build/build.scala
@@ -0,0 +1,4 @@
+import cbt._
+class Build(val context: Context) extends BaseBuild{
+ override def dependencies = super.dependencies :+ libraries.cbt.process
+} \ No newline at end of file
diff --git a/examples/restart/src/Main.scala b/examples/restart/src/Main.scala
new file mode 100644
index 0000000..1c03832
--- /dev/null
+++ b/examples/restart/src/Main.scala
@@ -0,0 +1,6 @@
+object Main extends App {
+ while(true){
+ Thread.sleep(1000)
+ println( "process " + cbt.process.currentProcessId + " is still running" )
+ }
+}