forked from akka/alpakka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommon.scala
117 lines (111 loc) · 5.17 KB
/
Common.scala
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
import sbt._
import sbt.Keys._
import sbt.plugins.JvmPlugin
import org.scalafmt.sbt.ScalafmtPlugin.autoImport._
import de.heikoseeberger.sbtheader._
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import com.lightbend.paradox.projectinfo.ParadoxProjectInfoPluginKeys._
import Whitesource.whitesourceGroup
object Common extends AutoPlugin {
object autoImport {
val fatalWarnings = settingKey[Boolean]("Warnings stop compilation with an error")
}
import autoImport._
override def trigger = allRequirements
override def requires = JvmPlugin && HeaderPlugin
override def globalSettings = Seq(
organization := "com.lightbend.akka",
organizationName := "Lightbend Inc.",
organizationHomepage := Some(url("https://www.lightbend.com/")),
homepage := Some(url("https://doc.akka.io/docs/alpakka/current")),
apiURL := Some(url(s"https://doc.akka.io/api/alpakka/${version.value}")),
scmInfo := Some(ScmInfo(url("https://github.com/akka/alpakka"), "[email protected]:akka/alpakka.git")),
developers += Developer("contributors",
"Contributors",
"https://gitter.im/akka/dev",
url("https://github.com/akka/alpakka/graphs/contributors")),
licenses := Seq(("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))),
description := "Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.",
fatalWarnings := true
)
override lazy val projectSettings = Dependencies.Common ++ Seq(
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value),
whitesourceGroup := Whitesource.Group.Community,
crossVersion := CrossVersion.binary,
crossScalaVersions := Dependencies.ScalaVersions,
scalaVersion := Dependencies.Scala212,
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-deprecation",
"-Xlint",
"-Ywarn-dead-code",
"-target:jvm-1.8"
),
scalacOptions ++= (scalaVersion.value match {
case Dependencies.Scala213 => Seq.empty[String]
case _ => Seq("-Xfuture", "-Yno-adapted-args")
}),
scalacOptions ++= (scalaVersion.value match {
case Dependencies.Scala212 if insideCI.value && fatalWarnings.value && !Dependencies.Nightly =>
Seq("-Xfatal-warnings")
case _ => Seq.empty
}),
Compile / doc / scalacOptions := scalacOptions.value ++ Seq(
"-doc-title",
"Alpakka",
"-doc-version",
version.value,
"-sourcepath",
(baseDirectory in ThisBuild).value.toString,
"-skip-packages",
"akka.pattern:" + // for some reason Scaladoc creates this
"org.mongodb.scala:" + // this one is a mystery as well
// excluding generated grpc classes, except the model ones (com.google.pubsub)
"com.google.api:com.google.cloud:com.google.iam:com.google.logging:" +
"com.google.longrunning:com.google.protobuf:com.google.rpc:com.google.type"
),
Compile / doc / scalacOptions ++= (scalaVersion.value match {
case Dependencies.Scala211 =>
Seq(
"-doc-source-url", {
val branch = if (isSnapshot.value) "master" else s"v${version.value}"
s"https://github.com/akka/alpakka/tree/${branch}€{FILE_PATH}.scala#L1"
}
)
case _ =>
Seq(
"-doc-source-url", {
val branch = if (isSnapshot.value) "master" else s"v${version.value}"
s"https://github.com/akka/alpakka/tree/${branch}€{FILE_PATH_EXT}#L€{FILE_LINE}"
},
"-doc-canonical-base-url",
"https://doc.akka.io/api/alpakka/current/"
)
}),
Compile / doc / scalacOptions -= "-Xfatal-warnings",
compile / javacOptions ++= Seq(
"-Xlint:unchecked"
),
compile / javacOptions ++= (scalaVersion.value match {
case Dependencies.Scala212 if insideCI.value && fatalWarnings.value => Seq("-Werror")
case _ => Seq.empty
}),
autoAPIMappings := true,
apiURL := Some(url(s"https://doc.akka.io/api/alpakka/${version.value}/akka/stream/alpakka/index.html")),
// show full stack traces and test case durations
testOptions in Test += Tests.Argument("-oDF"),
// -a Show stack traces and exception class name for AssertionErrors.
// -v Log "test run started" / "test started" / "test run finished" events on log level "info" instead of "debug".
// -q Suppress stdout for successful tests.
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v", "-q"),
// By default scalatest futures time out in 150 ms, dilate that to 600ms.
// This should not impact the total test time as we don't expect to hit this
// timeout.
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-F", "4"),
scalafmtOnCompile := true,
headerLicense := Some(HeaderLicense.Custom("Copyright (C) 2016-2019 Lightbend Inc. <http://www.lightbend.com>"))
)
}