This repository has been archived by the owner on Oct 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
122 lines (109 loc) · 3.95 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
import sbtsonar.SonarPlugin.autoImport.sonarUseExternalConfig
// *****************************************************************************
// Projects
// *****************************************************************************
lazy val `argonaut-magnolia` =
project
.in(file("."))
.settings(settings)
.settings(
libraryDependencies ++= Seq(
library.argonaut,
library.magnolia,
),
libraryDependencies ++= Seq(
library.scalaCheck % Test,
library.scalaCheckMagnolia % Test,
library.utest % Test
)
)
.enablePlugins(AutomateHeaderPlugin)
.enablePlugins(GitBranchPrompt)
// *****************************************************************************
// Library dependencies
// *****************************************************************************
lazy val library =
new {
object Version {
val scalaCheck = "1.14.0"
val magnolia = "0.10.0"
val argonaut = "6.2.3"
val utest = "0.6.7"
val scalacheckMagnolia = "0.2.2"
}
val magnolia = "com.propensive" %% "magnolia" % Version.magnolia
val argonaut = "io.argonaut" %% "argonaut" % Version.argonaut
val scalaCheck = "org.scalacheck" %% "scalacheck" % Version.scalaCheck
val scalaCheckMagnolia = "com.github.chocpanda" %% "scalacheck-magnolia" % Version.scalacheckMagnolia
val utest = "com.lihaoyi" %% "utest" % Version.utest
}
// *****************************************************************************
// Settings
// *****************************************************************************
lazy val settings =
commonSettings ++
fmtSettings ++
fixSettings ++
styleSettings
lazy val commonSettings =
Seq(
// scalaVersion from .travis.yml via sbt-travisci
// scalaVersion := "2.12.7",
organization := "com.github.chocpanda",
homepage := Option(url("https://github.com/ChocPanda/argonaut-magnolia")),
name := "Argonaut Magnolia",
startYear := Some(2018),
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"ChocPanda",
"Matt Searle",
url("https://github.com/ChocPanda/")
)
),
sonarUseExternalConfig := true,
scapegoatVersion in ThisBuild := "1.3.8",
updateOptions := updateOptions.value.withGigahorse(false),
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.8",
"-encoding",
"UTF-8",
"-Ypartial-unification",
"-Ywarn-unused-import"
),
testFrameworks += new TestFramework("utest.runner.Framework"),
Compile / unmanagedSourceDirectories := Seq((Compile / scalaSource).value),
Test / unmanagedSourceDirectories := Seq((Test / scalaSource).value),
Compile / compile / wartremoverWarnings ++= Warts.unsafe
)
lazy val fmtSettings =
Seq(
scalafmtOnCompile := true
)
lazy val fixSettings =
Seq(
addCompilerPlugin(scalafixSemanticdb),
scalacOptions ++= Seq(
"-Yrangepos",
"-Ywarn-unused-import"
)
)
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
lazy val styleSettings = {
Seq(
scalastyleFailOnError := true,
scalastyleFailOnWarning := true
)
}
// *****************************************************************************
// 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")