Skip to content

Commit d1e31f1

Browse files
Adding plugins
1 parent 50eb7b3 commit d1e31f1

15 files changed

+216
-0
lines changed

project/WelcomeMessage.scala

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import sbt._
2+
import Keys._
3+
4+
object WelcomeMessage {
5+
def welcomeMessage(guardrailVersion: String) = {
6+
import scala.Console
7+
8+
def header(text: String): String = s"${Console.WHITE}${text}${Console.RESET}"
9+
10+
def section(text: String): String = s"${Console.YELLOW}> ${Console.CYAN}${text}:${Console.RESET}"
11+
def item(text: String): String = s"${Console.GREEN}> ${Console.CYAN}${text}${Console.RESET}"
12+
def subItem(text: String): String = s" ${Console.YELLOW}> ${Console.CYAN}${text}${Console.RESET}"
13+
14+
def gatesPR: String = s"${Console.YELLOW}this gates PRs being merged${Console.RESET}"
15+
16+
s"""|${header(" _ _ _ ")}
17+
|${header(" | | (_) |")}
18+
|${header(" __ _ _ _ __ _ _ __ __| |_ __ __ _ _| |")}
19+
|${header(" / _` | | | |/ _` | '__/ _` | '__/ _` | | |")}
20+
|${header(" | (_| | |_| | (_| | | | (_| | | | (_| | | |")}
21+
|${header(" \\__, |\\__,_|\\__,_|_| \\__,_|_| \\__,_|_|_|")}
22+
|${header(" __/ |")}
23+
|${header(s" |___/ ${guardrailVersion}")}
24+
|
25+
|Useful sbt tasks:
26+
|${item("format")} - Format all code, ${gatesPR}
27+
|${item("testSuite")} - Run every available test suite, ${gatesPR}
28+
|${item("runtimeSuite")} - Similar to testSuite, but skip core tests
29+
|${section("Generate sample sources")}
30+
|${subItem("runScalaExample")} - Only generate Scala sources for integration tests
31+
|${subItem("runIssue")} - Only run codegen for a single issue (usage: runIssue [scala|java|*] $$framework <file>)
32+
|${item("publishLocal")} - Publish to local ivy repo
33+
|${item("publishM2")} - Publish to local m2 repo
34+
| """.stripMargin
35+
}
36+
}

project/ci-release.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

project/dependency-tree.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addDependencyTreePlugin

project/github-release.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("ohnosequences" % "sbt-github-release" % "0.7.0")

project/plugins.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// for jdk11
2+
libraryDependencies += "com.sun.activation" % "javax.activation" % "1.2.0"

project/scalafix.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")

project/scalafmt.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")

project/scoverage.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "2.0.9")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package dev.guardrail.sbt
2+
3+
import sbt._
4+
import sbt.Keys._
5+
6+
object Dependencies {
7+
val scalatestVersion = "3.2.17"
8+
9+
val testDependencies = Seq(
10+
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
11+
"org.scalacheck" %% "scalacheck" % "1.17.0" % Test,
12+
"org.scalatestplus" %% "scalatestplus-scalacheck" % "3.1.0.0-RC2" % Test
13+
).map(_.cross(CrossVersion.for3Use2_13))
14+
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package dev.guardrail.sbt
2+
3+
class ExampleCase(val file: java.io.File, val prefix: String, val cliArgs: List[String], val frameworks: Option[Set[(String, Set[String])]]) {
4+
def args(cliArgs: String*): ExampleCase = new ExampleCase(file, prefix, cliArgs=cliArgs.toList, frameworks = frameworks)
5+
def frameworks(frameworks: (String, Set[String])*): ExampleCase = new ExampleCase(file, prefix, cliArgs, Some(frameworks.toSet))
6+
}
7+
object ExampleCase {
8+
def apply(file: java.io.File, prefix: String): ExampleCase = new ExampleCase(file, prefix, List.empty, None)
9+
def unapply(value: ExampleCase): Option[(java.io.File, String, List[String], Option[Set[(String, Set[String])]])] = Option((value.file, value.prefix, value.cliArgs, value.frameworks))
10+
}

0 commit comments

Comments
 (0)