aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/build-info-example/BuildInfo.scala8
-rw-r--r--examples/build-info-example/Main.scala9
-rw-r--r--examples/build-info-example/Readme.md3
-rw-r--r--examples/build-info-example/build/build.scala27
-rw-r--r--examples/dotty-example/README.md3
-rw-r--r--examples/dotty-example/build/build.scala2
-rw-r--r--examples/dotty-example/src/Main.scala12
-rw-r--r--examples/multi-project-example/build/build.scala10
-rw-r--r--examples/multi-project-example/build/build/build.scala10
-rw-r--r--examples/multi-project-example/common/SomeSharedClass.scala1
-rw-r--r--examples/multi-project-example/common/build/build.scala3
-rw-r--r--examples/multi-project-example/common/build/build/build.scala10
-rw-r--r--examples/multi-project-example/shared-build/SharedCbtBuild.scala4
-rw-r--r--examples/multi-project-example/shared-build/build/build.scala6
-rw-r--r--examples/multi-project-example/sub1/SomeConcreteClass.scala1
-rw-r--r--examples/multi-project-example/sub1/build/build.scala10
-rw-r--r--examples/multi-project-example/sub1/build/build/build.scala10
-rw-r--r--examples/multi-project-example/sub2/SomeOtherConcreteClass.scala1
-rw-r--r--examples/multi-project-example/sub2/build/build.scala10
-rw-r--r--examples/multi-project-example/sub2/build/build/build.scala10
-rw-r--r--examples/resources-example/build/build.scala21
-rw-r--r--examples/resources-example/build/build/build.scala20
-rw-r--r--examples/resources-example/my-resources/foo.text1
-rw-r--r--examples/resources-example/resources/foo.text1
-rw-r--r--examples/resources-example/src/Main.scala27
-rw-r--r--examples/scalafmt-example/.scalafmt.conf11
-rw-r--r--examples/scalafmt-example/README.md16
-rw-r--r--examples/scalafmt-example/build/build.scala26
-rw-r--r--examples/scalafmt-example/build/build/build.scala5
-rw-r--r--examples/scalafmt-example/resources/reference.conf8
-rw-r--r--examples/scalafmt-example/src/Main.scala16
-rw-r--r--examples/scalajs-react-example/README.md11
-rw-r--r--examples/scalajs-react-example/js/App.scala15
-rw-r--r--examples/scalajs-react-example/js/Pictures.scala102
-rw-r--r--examples/scalajs-react-example/js/build/build.scala22
-rw-r--r--examples/scalajs-react-example/js/build/build/build.scala4
-rw-r--r--examples/scalajs-react-example/jvm/build/build.scala6
-rw-r--r--examples/scalajs-react-example/server/app.js39
-rw-r--r--examples/scalajs-react-example/server/package.json14
-rw-r--r--examples/scalajs-react-example/server/public/index.html18
-rw-r--r--examples/scalajs-react-example/shared/Picture.scala3
-rw-r--r--examples/scalariform-example/README.md16
-rw-r--r--examples/scalariform-example/build/build.scala29
-rw-r--r--examples/scalariform-example/build/build/build.scala5
-rw-r--r--examples/scalariform-example/resources/reference.conf8
-rw-r--r--examples/scalariform-example/src/Main.scala11
-rw-r--r--examples/scalatest-example/build/build.scala9
-rw-r--r--examples/scalatest-example/build/build/build.scala8
-rw-r--r--examples/scalatest-example/src/main/scala/Hello.scala7
-rw-r--r--examples/scalatest-example/src/test/scala/Test.scala23
-rw-r--r--examples/simple-example/build/build.scala20
-rw-r--r--examples/simple-example/build/build/build.scala20
-rw-r--r--examples/simple-example/src/Main.scala3
-rw-r--r--examples/sonatype-release-example/README.md1
-rw-r--r--examples/sonatype-release-example/build/build.scala31
-rw-r--r--examples/sonatype-release-example/build/build/build.scala5
-rw-r--r--examples/sonatype-release-example/src/Main.scala3
-rw-r--r--examples/uber-jar-example/README.md41
-rw-r--r--examples/uber-jar-example/build/build.scala16
-rw-r--r--examples/uber-jar-example/build/build/build.scala5
-rw-r--r--examples/uber-jar-example/src/Main.scala21
-rw-r--r--examples/uber-jar-example/src/com/github/someguy/ImportantLib.scala11
-rw-r--r--examples/wartremover-example/build/build.scala9
-rw-r--r--examples/wartremover-example/build/build/build.scala5
-rw-r--r--examples/wartremover-example/src/Main.scala5
65 files changed, 848 insertions, 0 deletions
diff --git a/examples/build-info-example/BuildInfo.scala b/examples/build-info-example/BuildInfo.scala
new file mode 100644
index 0000000..ac0e680
--- /dev/null
+++ b/examples/build-info-example/BuildInfo.scala
@@ -0,0 +1,8 @@
+// generated file
+import java.io._
+object BuildInfo{
+def artifactId = "build-info-example"
+def groupId = "cbt.examples"
+def version = "0.1"
+def scalaVersion = "2.11.8"
+}
diff --git a/examples/build-info-example/Main.scala b/examples/build-info-example/Main.scala
new file mode 100644
index 0000000..cb4ad75
--- /dev/null
+++ b/examples/build-info-example/Main.scala
@@ -0,0 +1,9 @@
+object Main{
+ def main(args: Array[String]): Unit = {
+ import BuildInfo._
+ println("scalaVersion: "+scalaVersion)
+ println("groupId: "+groupId)
+ println("artifactId: "+artifactId)
+ println("version: "+version)
+ }
+} \ No newline at end of file
diff --git a/examples/build-info-example/Readme.md b/examples/build-info-example/Readme.md
new file mode 100644
index 0000000..acbb84e
--- /dev/null
+++ b/examples/build-info-example/Readme.md
@@ -0,0 +1,3 @@
+This is an example how to propagate build-time information
+such as version or scalaVersion to runtime.
+The advantage of the approach taken here is simplicity.
diff --git a/examples/build-info-example/build/build.scala b/examples/build-info-example/build/build.scala
new file mode 100644
index 0000000..f6fc7a4
--- /dev/null
+++ b/examples/build-info-example/build/build.scala
@@ -0,0 +1,27 @@
+import cbt._
+import java.nio.file.Files._
+
+class Build(val context: Context) extends PackageJars{
+ def name = "build-info-example"
+ def groupId = "cbt.examples"
+ def defaultVersion = "0.1"
+ override def defaultScalaVersion = "2.11.8"
+ override def compile = {
+ val file = (projectDirectory ++ "/BuildInfo.scala").toPath
+ val contents = s"""// generated file
+import java.io._
+object BuildInfo{
+def artifactId = "$artifactId"
+def groupId = "$groupId"
+def version = "$version"
+def scalaVersion = "$scalaVersion"
+}
+"""
+ if( exists(file) && contents != new String(readAllBytes(file)) )
+ write(
+ (projectDirectory ++ "/BuildInfo.scala").toPath,
+ contents.getBytes
+ )
+ super.compile
+ }
+}
diff --git a/examples/dotty-example/README.md b/examples/dotty-example/README.md
new file mode 100644
index 0000000..bc0f6b0
--- /dev/null
+++ b/examples/dotty-example/README.md
@@ -0,0 +1,3 @@
+Dotty example project compiling hello world with the next version of Scala.
+
+All you need to do to enable Dotty is `extends Dotty` in your build.scala .
diff --git a/examples/dotty-example/build/build.scala b/examples/dotty-example/build/build.scala
new file mode 100644
index 0000000..eb67d93
--- /dev/null
+++ b/examples/dotty-example/build/build.scala
@@ -0,0 +1,2 @@
+import cbt._
+class Build(val context: Context) extends Dotty
diff --git a/examples/dotty-example/src/Main.scala b/examples/dotty-example/src/Main.scala
new file mode 100644
index 0000000..fdc2068
--- /dev/null
+++ b/examples/dotty-example/src/Main.scala
@@ -0,0 +1,12 @@
+package dotty_example
+object Main extends Foo("Hello Dotty - trait parameters, yay"){
+ def main(args: Array[String]): Unit = {
+ println(hello)
+
+ // Sanity check the classpath: this won't run if the dotty jar is not present.
+ val x: Int => Int = z => z
+ x(1)
+ }
+}
+
+trait Foo(val hello: String)
diff --git a/examples/multi-project-example/build/build.scala b/examples/multi-project-example/build/build.scala
new file mode 100644
index 0000000..9a67488
--- /dev/null
+++ b/examples/multi-project-example/build/build.scala
@@ -0,0 +1,10 @@
+import cbt._
+class Build(val context: Context) extends SharedCbtBuild{
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory ++ "/sub1" ),
+ DirectoryDependency( projectDirectory ++ "/sub2" )
+ )
+}
diff --git a/examples/multi-project-example/build/build/build.scala b/examples/multi-project-example/build/build/build.scala
new file mode 100644
index 0000000..be72a13
--- /dev/null
+++ b/examples/multi-project-example/build/build/build.scala
@@ -0,0 +1,10 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild{
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory.getParentFile ++ "/shared-build" )
+ )
+}
diff --git a/examples/multi-project-example/common/SomeSharedClass.scala b/examples/multi-project-example/common/SomeSharedClass.scala
new file mode 100644
index 0000000..1f32c5a
--- /dev/null
+++ b/examples/multi-project-example/common/SomeSharedClass.scala
@@ -0,0 +1 @@
+class SomeSharedClass \ No newline at end of file
diff --git a/examples/multi-project-example/common/build/build.scala b/examples/multi-project-example/common/build/build.scala
new file mode 100644
index 0000000..0fbea50
--- /dev/null
+++ b/examples/multi-project-example/common/build/build.scala
@@ -0,0 +1,3 @@
+import cbt._
+
+class Build(val context: Context) extends SharedCbtBuild
diff --git a/examples/multi-project-example/common/build/build/build.scala b/examples/multi-project-example/common/build/build/build.scala
new file mode 100644
index 0000000..efeeb77
--- /dev/null
+++ b/examples/multi-project-example/common/build/build/build.scala
@@ -0,0 +1,10 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild{
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory.getParentFile.getParentFile ++ "/shared-build" )
+ )
+}
diff --git a/examples/multi-project-example/shared-build/SharedCbtBuild.scala b/examples/multi-project-example/shared-build/SharedCbtBuild.scala
new file mode 100644
index 0000000..38e4cc1
--- /dev/null
+++ b/examples/multi-project-example/shared-build/SharedCbtBuild.scala
@@ -0,0 +1,4 @@
+import cbt._
+trait SharedCbtBuild extends BaseBuild{
+ override def defaultScalaVersion = "2.10.6"
+} \ No newline at end of file
diff --git a/examples/multi-project-example/shared-build/build/build.scala b/examples/multi-project-example/shared-build/build/build.scala
new file mode 100644
index 0000000..332519e
--- /dev/null
+++ b/examples/multi-project-example/shared-build/build/build.scala
@@ -0,0 +1,6 @@
+import cbt._
+class Build(val context: Context) extends BaseBuild{
+ override def dependencies =
+ super.dependencies :+ // don't forget super.dependencies here
+ context.cbtDependency
+}
diff --git a/examples/multi-project-example/sub1/SomeConcreteClass.scala b/examples/multi-project-example/sub1/SomeConcreteClass.scala
new file mode 100644
index 0000000..2f8f715
--- /dev/null
+++ b/examples/multi-project-example/sub1/SomeConcreteClass.scala
@@ -0,0 +1 @@
+class SomeConcreteClass extends SomeSharedClass
diff --git a/examples/multi-project-example/sub1/build/build.scala b/examples/multi-project-example/sub1/build/build.scala
new file mode 100644
index 0000000..2c39a54
--- /dev/null
+++ b/examples/multi-project-example/sub1/build/build.scala
@@ -0,0 +1,10 @@
+import cbt._
+
+class Build(val context: Context) extends SharedCbtBuild{
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory.getParentFile ++ "/common" )
+ )
+}
diff --git a/examples/multi-project-example/sub1/build/build/build.scala b/examples/multi-project-example/sub1/build/build/build.scala
new file mode 100644
index 0000000..efeeb77
--- /dev/null
+++ b/examples/multi-project-example/sub1/build/build/build.scala
@@ -0,0 +1,10 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild{
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory.getParentFile.getParentFile ++ "/shared-build" )
+ )
+}
diff --git a/examples/multi-project-example/sub2/SomeOtherConcreteClass.scala b/examples/multi-project-example/sub2/SomeOtherConcreteClass.scala
new file mode 100644
index 0000000..56b0aa3
--- /dev/null
+++ b/examples/multi-project-example/sub2/SomeOtherConcreteClass.scala
@@ -0,0 +1 @@
+class SomeOtherConcreteClass extends SomeSharedClass
diff --git a/examples/multi-project-example/sub2/build/build.scala b/examples/multi-project-example/sub2/build/build.scala
new file mode 100644
index 0000000..2c39a54
--- /dev/null
+++ b/examples/multi-project-example/sub2/build/build.scala
@@ -0,0 +1,10 @@
+import cbt._
+
+class Build(val context: Context) extends SharedCbtBuild{
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory.getParentFile ++ "/common" )
+ )
+}
diff --git a/examples/multi-project-example/sub2/build/build/build.scala b/examples/multi-project-example/sub2/build/build/build.scala
new file mode 100644
index 0000000..efeeb77
--- /dev/null
+++ b/examples/multi-project-example/sub2/build/build/build.scala
@@ -0,0 +1,10 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild{
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory.getParentFile.getParentFile ++ "/shared-build" )
+ )
+}
diff --git a/examples/resources-example/build/build.scala b/examples/resources-example/build/build.scala
new file mode 100644
index 0000000..aec5d79
--- /dev/null
+++ b/examples/resources-example/build/build.scala
@@ -0,0 +1,21 @@
+import cbt._
+class Build(val context: Context) extends BaseBuild{
+ /*
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory ++ "/subProject" )
+ ) ++
+ Resolver( mavenCentral ).bind(
+ // CBT-style Scala dependencies
+ ScalaDependency( "com.lihaoyi", "ammonite-ops", "0.5.5" )
+ MavenDependency( "com.lihaoyi", "ammonite-ops_2.11", "0.5.5" )
+
+ // SBT-style dependencies
+ "com.lihaoyi" %% "ammonite-ops" % "0.5.5"
+ "com.lihaoyi" % "ammonite-ops_2.11" % "0.5.5"
+ )
+ */
+ override def resourceClasspath = super.resourceClasspath ++ ClassPath(Seq(projectDirectory ++ "/my-resources"))
+}
diff --git a/examples/resources-example/build/build/build.scala b/examples/resources-example/build/build/build.scala
new file mode 100644
index 0000000..f700060
--- /dev/null
+++ b/examples/resources-example/build/build/build.scala
@@ -0,0 +1,20 @@
+import cbt._
+class Build(val context: Context) extends BuildBuild{
+ /*
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory ++ "/subProject" )
+ ) ++
+ Resolver( mavenCentral ).bind(
+ // CBT-style Scala dependencies
+ ScalaDependency( "com.lihaoyi", "ammonite-ops", "0.5.5" )
+ MavenDependency( "com.lihaoyi", "ammonite-ops_2.11", "0.5.5" )
+
+ // SBT-style dependencies
+ "com.lihaoyi" %% "ammonite-ops" % "0.5.5"
+ "com.lihaoyi" % "ammonite-ops_2.11" % "0.5.5"
+ )
+ */
+}
diff --git a/examples/resources-example/my-resources/foo.text b/examples/resources-example/my-resources/foo.text
new file mode 100644
index 0000000..f82e417
--- /dev/null
+++ b/examples/resources-example/my-resources/foo.text
@@ -0,0 +1 @@
+Hello from a resource in my-resources/ (the additional location manually added here in build.scala)
diff --git a/examples/resources-example/resources/foo.text b/examples/resources-example/resources/foo.text
new file mode 100644
index 0000000..6d7c85a
--- /dev/null
+++ b/examples/resources-example/resources/foo.text
@@ -0,0 +1 @@
+Hello from a resource in resources/ (the default location)
diff --git a/examples/resources-example/src/Main.scala b/examples/resources-example/src/Main.scala
new file mode 100644
index 0000000..3bc0943
--- /dev/null
+++ b/examples/resources-example/src/Main.scala
@@ -0,0 +1,27 @@
+import java.nio.file.{Files, Paths}
+object Main extends App {
+ // Be aware that CBT currently isolates classloaders of dependencies
+ // your dependencies will not see the resources of your project
+ // This means that e.g. spray will not see a application.conf in your project's
+ // resources/ directory. See https://github.com/cvogt/cbt/issues/176
+ println(
+ "foo.text in resources contains: " ++
+ new String(
+ Files.readAllBytes(
+ Paths.get( getClass.getClassLoader.getResource("foo.text").getFile )
+ )
+ )
+ )
+ import scala.collection.JavaConverters._
+ println(
+ "foo.text in resources and my-resources:\n" ++
+ getClass.getClassLoader.getResources("foo.text").asScala.map(
+ resource =>
+ new String(
+ Files.readAllBytes(
+ Paths.get( resource.getFile )
+ )
+ )
+ ).mkString
+ )
+}
diff --git a/examples/scalafmt-example/.scalafmt.conf b/examples/scalafmt-example/.scalafmt.conf
new file mode 100644
index 0000000..4fc0088
--- /dev/null
+++ b/examples/scalafmt-example/.scalafmt.conf
@@ -0,0 +1,11 @@
+style: defaultWithAlign
+danglingParentheses: true
+
+spaces {
+ inImportCurlyBraces: true
+}
+
+rewriteTokens {
+ "->": "→"
+ "=>": "⇒"
+}
diff --git a/examples/scalafmt-example/README.md b/examples/scalafmt-example/README.md
new file mode 100644
index 0000000..0a59f96
--- /dev/null
+++ b/examples/scalafmt-example/README.md
@@ -0,0 +1,16 @@
+This example shows integration with scalafmt plugin.
+
+Reformat executed on every `cbt compile` call, and affects only *.scala source files.
+
+You can provide your custom scalfmt preferences in build via `scalafmtConfig`.
+
+To see formatting in action: execute `cbt breakFormatting` to break formatting and then execute`cbt scalafmt` to get formatting back.
+
+To check if your code is properly formatted(for example as part of CI validation), you can execute:
+
+```
+cbt scalafmt
+git diff --exit-code
+```
+
+Last command will return non-zero code, if your code isn't properly formatted.
diff --git a/examples/scalafmt-example/build/build.scala b/examples/scalafmt-example/build/build.scala
new file mode 100644
index 0000000..4f5545e
--- /dev/null
+++ b/examples/scalafmt-example/build/build.scala
@@ -0,0 +1,26 @@
+import cbt._
+
+class Build(val context: Context) extends BaseBuild with Scalafmt {
+ override def compile = {
+ scalafmt
+ super.compile
+ }
+
+ def breakFormatting = {
+ import java.nio.file._
+ import java.nio.charset.Charset
+ import scala.collection.JavaConverters._
+ val utf8 = Charset.forName("UTF-8")
+ sourceFiles foreach { file =>
+ val path = file.toPath
+ val fileLines = Files.readAllLines(path, utf8).asScala
+ val brokenLines = fileLines map (l =>
+ l.dropWhile(_ == ' ')
+ .replaceAll("⇒", "=>")
+ .replaceAll("→", "->")
+ )
+ Files.write(path, brokenLines.asJava, utf8)
+ }
+ System.err.println("Done breaking formatting")
+ }
+}
diff --git a/examples/scalafmt-example/build/build/build.scala b/examples/scalafmt-example/build/build/build.scala
new file mode 100644
index 0000000..aa70f36
--- /dev/null
+++ b/examples/scalafmt-example/build/build/build.scala
@@ -0,0 +1,5 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild {
+ override def dependencies = super.dependencies :+ plugins.scalafmt
+}
diff --git a/examples/scalafmt-example/resources/reference.conf b/examples/scalafmt-example/resources/reference.conf
new file mode 100644
index 0000000..f3e122d
--- /dev/null
+++ b/examples/scalafmt-example/resources/reference.conf
@@ -0,0 +1,8 @@
+// should not reformat this, cause it is not in source files
+some {
+ inside {
+ foo: 22
+ bar: false
+ baz: "hello"
+ }
+}
diff --git a/examples/scalafmt-example/src/Main.scala b/examples/scalafmt-example/src/Main.scala
new file mode 100644
index 0000000..465e27a
--- /dev/null
+++ b/examples/scalafmt-example/src/Main.scala
@@ -0,0 +1,16 @@
+import scala.concurrent.{ Await, Future }
+import scala.concurrent.duration._
+
+object Main extends App {
+ println("fooo")
+ val futureRes = Await.result(Future.successful(1), 5.seconds)
+ List(1, 2, 4, 5, 6) match {
+ case h :: _ ⇒ println("not empty list")
+ case Nil ⇒ println("empty list")
+ }
+
+ List(1 → 2, 2 → 3, 3 → 4) match {
+ case (1, 2) :: _ ⇒ 90 → 1
+ case (22, 44) :: _ ⇒ 1 → 150
+ }
+}
diff --git a/examples/scalajs-react-example/README.md b/examples/scalajs-react-example/README.md
new file mode 100644
index 0000000..74e015a
--- /dev/null
+++ b/examples/scalajs-react-example/README.md
@@ -0,0 +1,11 @@
+
+Compilation instructions
+-------------------------------------------
+1. `cbt fastOptJS`
+
+Execution instructions
+-------------------------------------------
+1. `cd server`
+2. `npm install`
+3. `node app.js`
+4. Go to http://localhost:3000 in a browser \ No newline at end of file
diff --git a/examples/scalajs-react-example/js/App.scala b/examples/scalajs-react-example/js/App.scala
new file mode 100644
index 0000000..0cd170e
--- /dev/null
+++ b/examples/scalajs-react-example/js/App.scala
@@ -0,0 +1,15 @@
+package prototype
+
+import japgolly.scalajs.react.ReactDOM
+import org.scalajs.dom
+
+import scala.scalajs.js.JSApp
+import scala.scalajs.js.annotation.JSExport
+
+@JSExport("App")
+object App extends JSApp {
+ def main(): Unit = {
+ val doc = dom.document
+ ReactDOM.render(Pictures.PictureComponent(), doc.getElementById("main"))
+ }
+}
diff --git a/examples/scalajs-react-example/js/Pictures.scala b/examples/scalajs-react-example/js/Pictures.scala
new file mode 100644
index 0000000..db1d7ef
--- /dev/null
+++ b/examples/scalajs-react-example/js/Pictures.scala
@@ -0,0 +1,102 @@
+package prototype
+
+import japgolly.scalajs.react.{ReactComponentB, BackendScope, Callback}
+import org.scalajs.dom
+
+import scala.scalajs._
+import japgolly.scalajs.react.vdom.all._
+
+import scala.scalajs.js.JSON
+
+object Pictures {
+
+ case class State(pictures: List[Picture], favourites: List[Picture])
+
+ type PicClick = (String, Boolean) => Callback
+
+ class Backend($: BackendScope[Unit, State]) {
+
+ def onPicClick(id: String, favorite: Boolean) =
+ $.state flatMap { s =>
+ if (favorite) {
+ val newPics = s.pictures.map(p => if (p.id == id) p.copy(favorite = false) else p)
+ val newFavs = s.favourites.filter(p => p.id != id)
+ $.modState(_ => State(newPics, newFavs))
+ } else {
+ var newPic: Picture = null
+ val newPics = s.pictures.map(p => if (p.id == id) {
+ newPic = p.copy(favorite = true); newPic
+ } else p)
+ val newFavs = s.favourites.+:(newPic)
+ $.modState(_ => State(newPics, newFavs))
+ }
+ }
+
+ def render(s: State) =
+ div(
+ h1("Popular Pixabay Pics"),
+ pictureList((s.pictures, onPicClick)),
+ h1("Your favorites"),
+ favoriteList((s.favourites, onPicClick)))
+ }
+
+ val picture = ReactComponentB[(Picture, PicClick)]("picture")
+ .render_P { case (p, b) =>
+ div(if (p.favorite) cls := "picture favorite" else cls := "picture", onClick --> b(p.id, p.favorite))(
+ img(src := p.src, title := p.title)
+ )
+ }
+ .build
+
+ val pictureList = ReactComponentB[(List[Picture], PicClick)]("pictureList")
+ .render_P { case (list, b) =>
+ div(`class` := "pictures")(
+ if (list.isEmpty) span("Loading Pics..")
+ else {
+ list.map(p => picture.withKey(p.id)((p, b)))
+ }
+ )
+ }
+ .build
+
+ val favoriteList = ReactComponentB[(List[Picture], PicClick)]("favoriteList")
+ .render_P { case (list, b) =>
+ div(`class` := "favorites")(
+ if (list.isEmpty) span("Click an image to mark as favorite")
+ else {
+ list.map(p => picture.withKey(p.id)((p, b)))
+ }
+ )
+ }
+ .build
+
+ val PictureComponent = ReactComponentB[Unit]("PictureComponent")
+ .initialState(State(Nil, Nil))
+ .renderBackend[Backend]
+ .componentDidMount(scope => Callback {
+ import scalajs.js.Dynamic.{global => g}
+ def isDefined(g: js.Dynamic): Boolean =
+ g.asInstanceOf[js.UndefOr[AnyRef]].isDefined
+ val url = "http://localhost:3000/data"
+ val xhr = new dom.XMLHttpRequest()
+ xhr.open("GET", url)
+ xhr.onload = { (e: dom.Event) =>
+ if (xhr.status == 200) {
+ val result = JSON.parse(xhr.responseText)
+ if (isDefined(result) && isDefined(result.hits)) {
+ val hits = result.hits.asInstanceOf[js.Array[js.Dynamic]]
+ val pics = hits.toList.map(item => Picture(
+ item.id.toString,
+ item.pageURL.toString,
+ item.previewURL.toString,
+ if (item.tags != null) item.tags.asInstanceOf[js.Array[String]].mkString(",") else ""))
+ //if (item.caption != null) item.caption.text.toString else ""))
+ scope.modState(_ => State(pics, Nil)).runNow()
+ }
+ }
+ }
+ xhr.send()
+ })
+ .buildU
+
+}
diff --git a/examples/scalajs-react-example/js/build/build.scala b/examples/scalajs-react-example/js/build/build.scala
new file mode 100644
index 0000000..29f1c73
--- /dev/null
+++ b/examples/scalajs-react-example/js/build/build.scala
@@ -0,0 +1,22 @@
+import cbt._
+class Build(val context: Context) extends ScalaJsBuild{
+ override val projectName = "my-project"
+
+ override def sources = super.sources ++ Seq(
+ projectDirectory.getParentFile ++ "/shared"
+ )
+
+ override def dependencies = (
+ super.dependencies ++
+ Resolver( mavenCentral ).bind(
+ //"org.scalatest" %%% "scalatest" % "3.0.0-RC2",
+ "com.github.japgolly.scalajs-react" %%% "core" % "0.10.4", // for example
+ // for example if you want explicitely state scala version
+ "org.scala-js" % "scalajs-dom_sjs0.6_2.11" % "0.9.0"
+ )
+ )
+
+ override protected def fastOptJSFile = {
+ projectDirectory.getParentFile ++ "/server/public" ++ ("/"++super.fastOptJSFile.getName)
+ }
+}
diff --git a/examples/scalajs-react-example/js/build/build/build.scala b/examples/scalajs-react-example/js/build/build/build.scala
new file mode 100644
index 0000000..b30e005
--- /dev/null
+++ b/examples/scalajs-react-example/js/build/build/build.scala
@@ -0,0 +1,4 @@
+import cbt._
+class Build(val context: Context) extends BuildBuild{
+ override def dependencies = super.dependencies :+ plugins.scalaJs
+}
diff --git a/examples/scalajs-react-example/jvm/build/build.scala b/examples/scalajs-react-example/jvm/build/build.scala
new file mode 100644
index 0000000..327d705
--- /dev/null
+++ b/examples/scalajs-react-example/jvm/build/build.scala
@@ -0,0 +1,6 @@
+import cbt._
+class Build(val context: Context) extends BaseBuild{
+ override def sources = super.sources ++ Seq(
+ projectDirectory.getParentFile ++ "/shared"
+ )
+}
diff --git a/examples/scalajs-react-example/server/app.js b/examples/scalajs-react-example/server/app.js
new file mode 100644
index 0000000..620c26a
--- /dev/null
+++ b/examples/scalajs-react-example/server/app.js
@@ -0,0 +1,39 @@
+var express = require('express');
+var https = require('https');
+
+var app = express();
+
+app.get('/data', function(req, res){
+
+ var request = https.get(
+ //'https://api.instagram.com/v1/media/popular?client_id=642176ece1e7445e99244cec26f4de1f&callback=?',
+ 'https://pixabay.com/api/?key=2741116-9706ac6d4a58f2b5416225505&q=yellow+flowers&image_type=photo',
+ function(response) {
+
+ var body = "";
+ response.on('data', function(data) {
+ body += data;
+ });
+ response.on('end', function() {
+ console.log(body);
+ try {
+ res.send(JSON.parse(body));
+ } catch (e) {
+ return console.error(e);
+ }
+ });
+ });
+ request.on('error', function(e) {
+ console.log('Problem with request: ' + e.message);
+ });
+ request.end();
+});
+
+app.use(express.static(__dirname + '/public'));
+
+var server = app.listen(3000, function () {
+ var host = server.address().address;
+ var port = server.address().port;
+
+ console.log('Example app listening at http://%s:%s', host, port);
+});
diff --git a/examples/scalajs-react-example/server/package.json b/examples/scalajs-react-example/server/package.json
new file mode 100644
index 0000000..d20ec98
--- /dev/null
+++ b/examples/scalajs-react-example/server/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "server",
+ "version": "1.0.0",
+ "description": "prototype",
+ "main": "app.js",
+ "author": "Katrin",
+ "license": "UNLICENSED",
+ "private": true,
+ "dependencies": {
+ "express": "^4.13.3",
+ "express-ws": "^0.2.6",
+ "body-parser": "^1.14.1"
+ }
+}
diff --git a/examples/scalajs-react-example/server/public/index.html b/examples/scalajs-react-example/server/public/index.html
new file mode 100644
index 0000000..08de20d
--- /dev/null
+++ b/examples/scalajs-react-example/server/public/index.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Prototype</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+</head>
+<body>
+
+ <div id="main"></div>
+
+ <script src="https://fb.me/react-15.1.0.min.js"></script>
+ <script src="https://fb.me/react-dom-15.1.0.min.js"></script>
+ <script type="text/javascript" src="./my-project-fastopt.js"></script>
+ <script type="text/javascript">
+ App().main();
+ </script>
+</body>
+</html>
diff --git a/examples/scalajs-react-example/shared/Picture.scala b/examples/scalajs-react-example/shared/Picture.scala
new file mode 100644
index 0000000..dbb985a
--- /dev/null
+++ b/examples/scalajs-react-example/shared/Picture.scala
@@ -0,0 +1,3 @@
+package prototype
+
+case class Picture(id: String, url: String, src: String, title: String, favorite: Boolean = false)
diff --git a/examples/scalariform-example/README.md b/examples/scalariform-example/README.md
new file mode 100644
index 0000000..28ad226
--- /dev/null
+++ b/examples/scalariform-example/README.md
@@ -0,0 +1,16 @@
+This example shows integration with scalariform plugin.
+
+Reformat executed on every `cbt compile` call, and affects only *.scala source files.
+
+You can provide your custom scalariform preferences in build via `scalariformPreferences`.
+
+To see formatting in action: execute `cbt breakFormatting` to break formatting and then execute `cbt scalariformFormat` to get formatting back.
+
+To check if your code is properly formatted(for example as part of CI validation), you can execute:
+
+```
+cbt scalariformFormat
+git diff --exit-code
+```
+
+Last command will return non-zero code, if your code isn't properly formatted.
diff --git a/examples/scalariform-example/build/build.scala b/examples/scalariform-example/build/build.scala
new file mode 100644
index 0000000..91ff67a
--- /dev/null
+++ b/examples/scalariform-example/build/build.scala
@@ -0,0 +1,29 @@
+import cbt._
+import scalariform.formatter.preferences._
+
+class Build(val context: Context) extends BaseBuild with Scalariform {
+ override def compile = {
+ scalariformFormat
+ super.compile
+ }
+
+ override def scalariformPreferences =
+ FormattingPreferences()
+ .setPreference(SpacesAroundMultiImports, true)
+ .setPreference(DoubleIndentClassDeclaration, true)
+ .setPreference(RewriteArrowSymbols, true)
+
+ final def breakFormatting = {
+ import java.nio.file._
+ import java.nio.charset.Charset
+ import scala.collection.JavaConverters._
+ val utf8 = Charset.forName("UTF-8")
+ sourceFiles foreach { file =>
+ val path = file.toPath
+ val fileLines = Files.readAllLines(path, utf8).asScala
+ val brokenLines = fileLines map (_.dropWhile(_ == ' '))
+ Files.write(path, brokenLines.asJava, utf8)
+ }
+ System.err.println("Done breaking formatting")
+ }
+}
diff --git a/examples/scalariform-example/build/build/build.scala b/examples/scalariform-example/build/build/build.scala
new file mode 100644
index 0000000..59ab8d1
--- /dev/null
+++ b/examples/scalariform-example/build/build/build.scala
@@ -0,0 +1,5 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild {
+ override def dependencies = super.dependencies :+ plugins.scalariform
+}
diff --git a/examples/scalariform-example/resources/reference.conf b/examples/scalariform-example/resources/reference.conf
new file mode 100644
index 0000000..f3e122d
--- /dev/null
+++ b/examples/scalariform-example/resources/reference.conf
@@ -0,0 +1,8 @@
+// should not reformat this, cause it is not in source files
+some {
+ inside {
+ foo: 22
+ bar: false
+ baz: "hello"
+ }
+}
diff --git a/examples/scalariform-example/src/Main.scala b/examples/scalariform-example/src/Main.scala
new file mode 100644
index 0000000..d299aad
--- /dev/null
+++ b/examples/scalariform-example/src/Main.scala
@@ -0,0 +1,11 @@
+import scala.concurrent.{ Await, Future }
+import scala.concurrent.duration._
+
+object Main extends App {
+ println("fooo")
+ val futureRes = Await.result(Future.successful(1), 5.seconds)
+ List(1, 2, 4, 5, 6) match {
+ case h :: _ ⇒ println("not empty list")
+ case Nil ⇒ println("empty list")
+ }
+}
diff --git a/examples/scalatest-example/build/build.scala b/examples/scalatest-example/build/build.scala
new file mode 100644
index 0000000..48248fd
--- /dev/null
+++ b/examples/scalatest-example/build/build.scala
@@ -0,0 +1,9 @@
+import cbt._
+class Build(val context: Context) extends SbtLayoutMain {
+ outer =>
+ override def test: Option[ExitCode] = Some{
+ new BasicBuild(context) with ScalaTest with SbtLayoutTest{
+ override def dependencies = outer +: super.dependencies
+ }.run
+ }
+}
diff --git a/examples/scalatest-example/build/build/build.scala b/examples/scalatest-example/build/build/build.scala
new file mode 100644
index 0000000..d641b51
--- /dev/null
+++ b/examples/scalatest-example/build/build/build.scala
@@ -0,0 +1,8 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild{
+ override def dependencies = super.dependencies ++ Seq(
+ plugins.scalaTest,
+ plugins.sbtLayout
+ )
+}
diff --git a/examples/scalatest-example/src/main/scala/Hello.scala b/examples/scalatest-example/src/main/scala/Hello.scala
new file mode 100644
index 0000000..099a84d
--- /dev/null
+++ b/examples/scalatest-example/src/main/scala/Hello.scala
@@ -0,0 +1,7 @@
+object Main extends App{
+
+ println("Hello World")
+
+ def square(x: Int) = x * x
+
+}
diff --git a/examples/scalatest-example/src/test/scala/Test.scala b/examples/scalatest-example/src/test/scala/Test.scala
new file mode 100644
index 0000000..48b0a36
--- /dev/null
+++ b/examples/scalatest-example/src/test/scala/Test.scala
@@ -0,0 +1,23 @@
+import collection.mutable.Stack
+import org.scalatest._
+
+class Test extends FlatSpec with Matchers {
+ "square" should "return double" in {
+ Main.square(2) should be (4)
+ }
+
+ "A Stack" should "pop values in last-in-first-out order" in {
+ val stack = new Stack[Int]
+ stack.push(1)
+ stack.push(2)
+ stack.pop() should be (2)
+ stack.pop() should be (1)
+ }
+
+ it should "throw NoSuchElementException if an empty stack is popped" in {
+ val emptyStack = new Stack[Int]
+ a [NoSuchElementException] should be thrownBy {
+ emptyStack.pop()
+ }
+ }
+} \ No newline at end of file
diff --git a/examples/simple-example/build/build.scala b/examples/simple-example/build/build.scala
new file mode 100644
index 0000000..9320990
--- /dev/null
+++ b/examples/simple-example/build/build.scala
@@ -0,0 +1,20 @@
+import cbt._
+class Build(val context: Context) extends BaseBuild{
+ /*
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory ++ "/subProject" )
+ ) ++
+ Resolver( mavenCentral ).bind(
+ // CBT-style Scala dependencies
+ ScalaDependency( "com.lihaoyi", "ammonite-ops", "0.5.5" )
+ MavenDependency( "com.lihaoyi", "ammonite-ops_2.11", "0.5.5" )
+
+ // SBT-style dependencies
+ "com.lihaoyi" %% "ammonite-ops" % "0.5.5"
+ "com.lihaoyi" % "ammonite-ops_2.11" % "0.5.5"
+ )
+ */
+}
diff --git a/examples/simple-example/build/build/build.scala b/examples/simple-example/build/build/build.scala
new file mode 100644
index 0000000..f700060
--- /dev/null
+++ b/examples/simple-example/build/build/build.scala
@@ -0,0 +1,20 @@
+import cbt._
+class Build(val context: Context) extends BuildBuild{
+ /*
+ override def dependencies =
+ super.dependencies ++ // don't forget super.dependencies here
+ Seq(
+ // source dependency
+ DirectoryDependency( projectDirectory ++ "/subProject" )
+ ) ++
+ Resolver( mavenCentral ).bind(
+ // CBT-style Scala dependencies
+ ScalaDependency( "com.lihaoyi", "ammonite-ops", "0.5.5" )
+ MavenDependency( "com.lihaoyi", "ammonite-ops_2.11", "0.5.5" )
+
+ // SBT-style dependencies
+ "com.lihaoyi" %% "ammonite-ops" % "0.5.5"
+ "com.lihaoyi" % "ammonite-ops_2.11" % "0.5.5"
+ )
+ */
+}
diff --git a/examples/simple-example/src/Main.scala b/examples/simple-example/src/Main.scala
new file mode 100644
index 0000000..88a18d3
--- /dev/null
+++ b/examples/simple-example/src/Main.scala
@@ -0,0 +1,3 @@
+object Main extends App {
+ println("Hello World")
+}
diff --git a/examples/sonatype-release-example/README.md b/examples/sonatype-release-example/README.md
new file mode 100644
index 0000000..a099036
--- /dev/null
+++ b/examples/sonatype-release-example/README.md
@@ -0,0 +1 @@
+TBD
diff --git a/examples/sonatype-release-example/build/build.scala b/examples/sonatype-release-example/build/build.scala
new file mode 100644
index 0000000..6af452d
--- /dev/null
+++ b/examples/sonatype-release-example/build/build.scala
@@ -0,0 +1,31 @@
+import java.net.URL
+
+import cbt._
+
+class Build(val context: Context) extends SonatypeRelease {
+ def groupId: String = "com.github.rockjam"
+ def defaultVersion: String = "0.0.15"
+ def name: String = "cbt-sonatype"
+
+ def description: String = "Plugin for CBT to release artifacts to sonatype OSS"
+ def developers: Seq[Developer] = Seq(
+ Developer(
+ "rockjam",
+ "Nikolay Tatarinov",
+ "GMT+3",
+ new URL("https://github.com/rockjam")
+ )
+ )
+ def inceptionYear: Int = 2016
+ def licenses: Seq[cbt.License] = Seq(License.Apache2)
+ def organization: Option[cbt.Organization] = None
+ def scmConnection: String = ""
+ def scmUrl: String = "https://github.com/rockjam/cbt-sonatype.git"
+ def url: java.net.URL = new URL("https://github.com/rockjam/cbt-sonatype")
+
+ override def dependencies =
+ super.dependencies ++
+ Resolver( mavenCentral ).bind(
+ ScalaDependency("com.chuusai", "shapeless", "2.3.2")
+ )
+}
diff --git a/examples/sonatype-release-example/build/build/build.scala b/examples/sonatype-release-example/build/build/build.scala
new file mode 100644
index 0000000..a47d3e1
--- /dev/null
+++ b/examples/sonatype-release-example/build/build/build.scala
@@ -0,0 +1,5 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild {
+ override def dependencies = super.dependencies :+ plugins.sonatypeRelease
+}
diff --git a/examples/sonatype-release-example/src/Main.scala b/examples/sonatype-release-example/src/Main.scala
new file mode 100644
index 0000000..5e03d27
--- /dev/null
+++ b/examples/sonatype-release-example/src/Main.scala
@@ -0,0 +1,3 @@
+object Main extends App {
+ println("This is serious app that does nothing, but has shapeless dependency")
+}
diff --git a/examples/uber-jar-example/README.md b/examples/uber-jar-example/README.md
new file mode 100644
index 0000000..2460084
--- /dev/null
+++ b/examples/uber-jar-example/README.md
@@ -0,0 +1,41 @@
+### Uber-jar plugin example
+
+This example shows how to build uber jar(aka fat jar) with `UberJar` plugin.
+
+In order to create uber jar: execute `cbt uberJar`. Produced jar will be in target folder.
+
+By default, jar name is your `cbt projectName`, you can provide other name via overriding `uberJarName` task.
+
+By default, main class is `Main`. You can provide custom main class via overriding `uberJarMainClass` task.
+
+To run your main class you can execute `java -jar your-jar-name.jar`.
+
+You can also run scala REPL with your jar classpath and classes with this command: `scala -cp your-jar-name.jar`.
+
+In scala REPL you will have access to all your project classes and dependencies.
+
+```
+scala -cp uber-jar-example-0.0.1.jar
+Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_72).
+Type in expressions for evaluation. Or try :help.
+
+scala> import com.github.someguy.ImportantLib
+import com.github.someguy.ImportantLib
+
+scala> ImportantLib.add(1,2)
+res0: Int = 3
+
+scala> ImportantLib.currentDirectory
+Current directory is: /Users/rockjam/projects/cbt/examples/uber-jar-example/target
+
+scala> Main.main(Array.empty)
+fooo
+Current directory is: /Users/rockjam/projects/cbt/examples/uber-jar-example/target
+not empty list
+
+scala> import shapeless._
+import shapeless._
+
+scala> 1 :: "String" :: 3 :: HNil
+res3: shapeless.::[Int,shapeless.::[String,shapeless.::[Int,shapeless.HNil]]] = 1 :: String :: 3 :: HNil
+```
diff --git a/examples/uber-jar-example/build/build.scala b/examples/uber-jar-example/build/build.scala
new file mode 100644
index 0000000..fec58ae
--- /dev/null
+++ b/examples/uber-jar-example/build/build.scala
@@ -0,0 +1,16 @@
+import cbt._
+
+class Build(val context: Context) extends BaseBuild with UberJar {
+
+ override def projectName: String = "uber-jar-example"
+
+ override def dependencies = super.dependencies ++
+ Resolver( mavenCentral ).bind(
+ ScalaDependency("com.chuusai", "shapeless", "2.3.1"),
+ ScalaDependency("com.lihaoyi", "fansi", "0.1.3"),
+ ScalaDependency("org.typelevel", "cats", "0.6.0")
+ )
+
+ override def uberJarName = projectName + "-0.0.1" + ".jar"
+
+}
diff --git a/examples/uber-jar-example/build/build/build.scala b/examples/uber-jar-example/build/build/build.scala
new file mode 100644
index 0000000..2938ffd
--- /dev/null
+++ b/examples/uber-jar-example/build/build/build.scala
@@ -0,0 +1,5 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild {
+ override def dependencies = super.dependencies :+ plugins.uberJar
+}
diff --git a/examples/uber-jar-example/src/Main.scala b/examples/uber-jar-example/src/Main.scala
new file mode 100644
index 0000000..f60634f
--- /dev/null
+++ b/examples/uber-jar-example/src/Main.scala
@@ -0,0 +1,21 @@
+import scala.concurrent.{ Await, Future }
+import scala.concurrent.duration._
+
+import com.github.someguy.ImportantLib
+
+object Main extends App {
+ println("fooo")
+ val futureRes = Await.result(Future.successful(1), 5.seconds)
+
+ ImportantLib.currentDirectory()
+
+ val hlist = {
+ import shapeless._
+ 1 :: "string" :: 3 :: HNil
+ }
+
+ List(1, 2, 4, 5, 6) match {
+ case h :: _ ⇒ println("not empty list")
+ case Nil ⇒ println("empty list")
+ }
+}
diff --git a/examples/uber-jar-example/src/com/github/someguy/ImportantLib.scala b/examples/uber-jar-example/src/com/github/someguy/ImportantLib.scala
new file mode 100644
index 0000000..34baf2f
--- /dev/null
+++ b/examples/uber-jar-example/src/com/github/someguy/ImportantLib.scala
@@ -0,0 +1,11 @@
+package com.github.someguy
+
+import java.nio.file.Paths
+
+object ImportantLib {
+ def add(a: Int, b: Int): Int = a + b
+ def currentDirectory() = {
+ println(fansi.Color.Green(s"Current directory is: ${Paths.get("").toAbsolutePath}"))
+ }
+
+}
diff --git a/examples/wartremover-example/build/build.scala b/examples/wartremover-example/build/build.scala
new file mode 100644
index 0000000..c715f20
--- /dev/null
+++ b/examples/wartremover-example/build/build.scala
@@ -0,0 +1,9 @@
+import cbt._
+
+import org.wartremover.warts.{ Null, Var }
+import org.wartremover.WartTraverser
+
+class Build(val context: Context) extends BuildBuild with WartRemover {
+
+ override def wartremoverErrors: Seq[WartTraverser] = Seq(Var, Null)
+}
diff --git a/examples/wartremover-example/build/build/build.scala b/examples/wartremover-example/build/build/build.scala
new file mode 100644
index 0000000..eb2f193
--- /dev/null
+++ b/examples/wartremover-example/build/build/build.scala
@@ -0,0 +1,5 @@
+import cbt._
+
+class Build(val context: Context) extends BuildBuild {
+ override def dependencies = super.dependencies :+ plugins.wartremover
+}
diff --git a/examples/wartremover-example/src/Main.scala b/examples/wartremover-example/src/Main.scala
new file mode 100644
index 0000000..dc4b3da
--- /dev/null
+++ b/examples/wartremover-example/src/Main.scala
@@ -0,0 +1,5 @@
+object Main {
+ def main(args: Array[String]): Unit = {
+ var nastyVar = null
+ }
+}