-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
122 lines (108 loc) · 4.12 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// *****************************************************************************
// Projects
// *****************************************************************************
lazy val PlayExample =
project
.in(file("."))
.settings(settings)
.settings(
name := "Example Play Web Service",
version := "1.0",
libraryDependencies ++= Seq(
library.cats,
library.macwire,
library.playCirce,
library.shapeless
),
libraryDependencies ++= Seq(
library.scalacheck % Test,
library.playScalaTest % Test,
library.mockitoCore % Test
)
)
.enablePlugins(PlayScala)
// *****************************************************************************
// Library dependencies
// *****************************************************************************
val library = new {
val Version = new {
val scalacheck = "1.14.0"
val cats = "1.4.0"
val playScalaTest = "3.1.2"
val macwire = "2.3.0"
val mockitoCore = "2.18.3"
val playCirce = "2610.0"
val shapeless = "2.3.3"
}
val scalacheck = "org.scalacheck" %% "scalacheck" % Version.scalacheck
val shapeless = "com.chuusai" %% "shapeless" % Version.shapeless
val cats = "org.typelevel" %% "cats-core" % Version.cats
val playScalaTest = "org.scalatestplus.play" %% "scalatestplus-play" % Version.playScalaTest
val playCirce = "com.dripower" %% "play-circe" % Version.playCirce
val macwire = "com.softwaremill.macwire" %% "macros" % Version.macwire % "provided"
val mockitoCore = "org.mockito" % "mockito-core" % Version.mockitoCore
}
// *****************************************************************************
// Commands
// *****************************************************************************
addCommandAlias("fix", "; compile:scalafix; test:scalafix")
addCommandAlias("fixCheck", "; compile:scalafix --check; test:scalafix --check")
addCommandAlias("fmt", "; compile:scalafmt; test:scalafmt; scalafmtSbt")
addCommandAlias("fmtCheck", "; compile:scalafmtCheck; test:scalafmtCheck; scalafmtSbtCheck")
addCommandAlias("styleCheck", "; compile:scalastyle; test:scalastyle")
// *****************************************************************************
// Settings
// *****************************************************************************
lazy val settings =
commonSettings ++
scalafmtSettings ++
scalaFixSettings ++
scalastyleSettings
resolvers += Resolver.sonatypeRepo("releases")
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.8")
lazy val commonSettings =
Seq(
scalaVersion := "2.12.7",
organization := "io.panda",
organizationName := "Matt Searle",
startYear := Some(2018),
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.8",
"-encoding",
"UTF-8",
"-Ypartial-unification",
"-language:higherKinds",
),
Compile / unmanagedSourceDirectories := Seq((Compile / scalaSource).value),
Test / unmanagedSourceDirectories := Seq((Test / scalaSource).value),
wartremoverWarnings in (Compile, compile) ++= Warts.unsafe,
wartremoverExcluded ++= Seq(
crossTarget.value / "routes" / "main" / "router" / "Routes.scala",
crossTarget.value / "routes" / "main" / "router" / "RoutesPrefix.scala",
crossTarget.value / "routes" / "main" / "controllers" / "ReverseRoutes.scala",
crossTarget.value / "routes" / "main" / "controllers" / "javascript" / "JavaScriptReverseRoutes.scala"
)
)
lazy val scalafmtSettings =
Seq(
scalafmtOnCompile := true
)
lazy val scalaFixSettings =
Seq(
libraryDependencies += compilerPlugin(scalafixSemanticdb),
scalacOptions ++= Seq(
"-Yrangepos",
"-Ywarn-unused-import",
"-P:semanticdb:exclude:.*routes.*|.*Routes.*"
)
)
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
lazy val scalastyleSettings = {
Seq(
scalastyleFailOnError := true,
scalastyleFailOnWarning := true
)
}