aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
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" )
+ }
+}