-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
89 lines (75 loc) · 2.7 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
import sbt._
import sbt.Keys.{watchSources, _}
ThisBuild / version := "0.0.17"
ThisBuild / evictionErrorLevel := Level.Info
val credentialFile = new File("lightbend.sbt")
def doesCredentialExist : Boolean = {
import java.nio.file.Files
val exists = Files.exists(credentialFile.toPath)
println(s"doesCredentialExist: ($credentialFile) " + exists)
exists
}
def commercialDependencies : Seq[ModuleID] = {
import com.lightbend.cinnamon.sbt.Cinnamon.CinnamonKeys.cinnamon
Seq(
// BEGIN: this requires a commercial Lightbend Subscription
Cinnamon.library.cinnamonAgent,
Cinnamon.library.cinnamonAkka,
Cinnamon.library.cinnamonAkkaStream,
Cinnamon.library.cinnamonAkkaHttp,
Cinnamon.library.cinnamonPrometheus,
Cinnamon.library.cinnamonPrometheusHttpServer,
Cinnamon.library.cinnamonJvmMetricsProducer,
Cinnamon.library.cinnamonOpenTracing,
Cinnamon.library.cinnamonOpenTracingJaeger
// END: this requires a commercial Lightbend Subscription
)
}
def ossDependencies : Seq[ModuleID] = {
Seq(
"com.thesamet.scalapb" %% "scalapb-json4s" % "0.11.0",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.akka" %% "akka-http-testkit" % "10.2.6" % "test",
"org.scalatest" %% "scalatest" % "3.0.8" % "test"
)
}
lazy val sensorData = (project in file("."))
.enablePlugins(CloudflowApplicationPlugin, CloudflowAkkaPlugin, ScalafmtPlugin)
.enablePlugins(CloudflowLibraryPlugin)
.enablePlugins(Cinnamon)
.settings(
scalaVersion := "2.12.12",
runLocalConfigFile := Some("src/main/resources/local.conf"),
scalafmtOnCompile := true,
name := "sensor-data-scala-proto-grpc",
// Add the Cinnamon Agent settings for run and test
cinnamonSuppressRepoWarnings := true,
test / cinnamon := false,
run / cinnamon := true,
cinnamonLogLevel := "INFO",
libraryDependencies ++= {
if (doesCredentialExist) {
commercialDependencies ++ ossDependencies
}
else {
ossDependencies
}
},
organization := "com.lightbend.cloudflow",
headerLicense := Some(HeaderLicense.ALv2("(C) 2016-2021", "Lightbend Inc. <https://www.lightbend.com>")),
crossScalaVersions := Vector(scalaVersion.value),
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-target:jvm-1.8",
"-Xlog-reflective-calls",
"-Xlint",
"-Ywarn-unused",
"-Ywarn-unused-import",
"-deprecation",
"-feature",
"-language:_",
"-unchecked"
),
Compile / console / scalacOptions --= Seq("-Ywarn-unused", "-Ywarn-unused-import"),
Test / console / scalacOptions := (Compile / console / scalacOptions).value
)