-
Notifications
You must be signed in to change notification settings - Fork 47
/
build.sbt
108 lines (101 loc) · 3.57 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
addCommandAlias("ci", ";clean ;+test")
addCommandAlias("release", ";project root ;+publish ;sonatypeReleaseAll")
lazy val credentialSettings = Seq(
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
)
lazy val publisherSettings = Seq(
sonatypeProfileName := organization.value,
publishMavenStyle := true,
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
)
)
lazy val releaseSettings = publisherSettings ++ credentialSettings
def java8Options(scalaVersion: String): Seq[String] =
if (scalaVersion.startsWith("2.12") || scalaVersion.startsWith("2.11")) Seq("-target:jvm-1.8", "-release", "8")
else if (scalaVersion.startsWith("2.13")) Seq("-target:8", "-release", "8")
else if (scalaVersion.startsWith("3.")) Seq("-release", "8")
else sys.error(s"Unsupported scala version: $scalaVersion")
lazy val commonSettings = releaseSettings ++ Seq(
version := "3.2.0",
organization := "com.github.daddykotex",
description := "deliver electronic mail with scala",
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))),
homepage := Some(url("https://github.com/dmurvihill/courier")),
crossScalaVersions := Seq("2.11.12", "2.12.12", "2.13.4", "3.0.1", "3.1.0"),
scalaVersion := crossScalaVersions.value.last,
scmInfo := Some(
ScmInfo(
url("https://github.com/dmurvihill/courier"),
"scm:[email protected]:dmurvihill/courier.git"
)
),
developers := List(
Developer(
id = "daddykotex",
name = "David Francoeur",
email = "[email protected]",
url = url("https://davidfrancoeur.com")
),
Developer(
id = "dmurvihill",
name = "Dolan Murvihill",
email = "[email protected]",
url = url("https://github.com/dmurvihill")
)
)
)
lazy val cFlags = Seq(
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 11)) =>
Seq(
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-Ypartial-unification"
)
case Some((2, 12)) =>
ScalacOptions.All ++ Seq(
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-Xfuture",
"-Xlint:by-name-right-associative",
"-Xlint:unsound-match",
"-Yno-adapted-args",
"-Ypartial-unification",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit"
)
case Some((2, 13)) =>
ScalacOptions.All
case Some((3, 0)) =>
Seq("-rewrite")
case Some((3, 1)) =>
Seq("-rewrite")
case Some(_) | None =>
throw new IllegalArgumentException("Unable to figure out scalacOptions")
})
)
lazy val courier = (project in file("courier"))
.settings(commonSettings ++ cFlags)
.settings(
name := "courier",
libraryDependencies ++= Seq(
"com.sun.mail" % "javax.mail" % "1.6.2",
"javax.activation" % "activation" % "1.1.1",
"org.bouncycastle" % "bcpkix-jdk15on" % "1.61" % Optional,
"org.bouncycastle" % "bcmail-jdk15on" % "1.61" % Optional,
"org.scalameta" %% "munit" % "0.7.27" % Test,
"org.jvnet.mock-javamail" % "mock-javamail" % "1.9" % Test
),
testFrameworks += new TestFramework("munit.Framework")
)