This repository has been archived by the owner on Jan 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sbt
148 lines (130 loc) · 6.66 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import sbt._
import sbt.Keys._
import Dependencies._
import scalariform.formatter.preferences._
name := "RSocket"
lazy val thisVersion = "0.1"
organization in ThisBuild := "lightbend"
version in ThisBuild := thisVersion
scalaVersion in ThisBuild := "2.12.10"
//resolvers += "Frog OSS Snapshots" at "https://oss.jfrog.org/oss-snapshot-local"
// settings for a native-packager based docker project based on sbt-docker plugin
def sbtdockerAppBase(id: String)(base: String = id): Project = Project(id, base = file(base))
.enablePlugins(sbtdocker.DockerPlugin, JavaAppPackaging)
.settings(
dockerfile in docker := {
val appDir = stage.value
val targetDir = "/opt/app"
new Dockerfile {
from("lightbend/java-bash-base:0.0.1")
copy(appDir, targetDir)
run("chmod", "-R", "777", "/opt/app")
entryPoint(s"$targetDir/bin/${executableScriptName.value}")
}
},
// Set name for the image
imageNames in docker := Seq(
ImageName(namespace = Some(organization.value),
repository = name.value.toLowerCase,
tag = Some(version.value))
),
buildOptions in docker := BuildOptions(cache = false)
)
lazy val client = sbtdockerAppBase("client")("./client")
.settings(
mainClass in Compile := Some("com.lightbend.sensordata.producer.rsocket.ProducerRunner"),
libraryDependencies ++= Seq(rsocketBalancer)
)
.dependsOn(support)
lazy val interactions = (project in file("./interactions"))
.settings(libraryDependencies ++= Seq(rsocketCore, rsocketTransport, rsocketBalancer, slf4, logback),
dependencyOverrides += "io.netty" % "netty-buffer" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-codec" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-codec-http" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-common" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-handler" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-resolver" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport-native-epoll" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport-native-unix-common" % "4.1.49.Final"
)
lazy val transports = (project in file("./transports"))
.settings(libraryDependencies ++= Seq(rsocketCore, rsocketTransport, rsocketLocal, argona, reactorKafka, kafka, curator, commonIO, slf4, logback),
dependencyOverrides += "io.netty" % "netty-buffer" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-codec" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-codec-http" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-common" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-handler" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-resolver" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport-native-epoll" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport-native-unix-common" % "4.1.49.Final",
dependencyOverrides += "org.apache.kafka" % "kafka-clients" % "2.4.0"
)
lazy val support = (project in file("./support"))
.enablePlugins(CloudflowLibraryPlugin)
.settings(
libraryDependencies ++= Seq(rsocketCore, rsocketTransport, akkastream, typesafeConfig, ficus, slf4, logback, scalaTest),
dependencyOverrides += "io.netty" % "netty-buffer" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-codec" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-codec-http" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-common" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-handler" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-resolver" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport-native-epoll" % "4.1.49.Final",
dependencyOverrides += "io.netty" % "netty-transport-native-unix-common" % "4.1.49.Final"
)
.settings(commonSettings)
lazy val sensorData = (project in file("./sensordata"))
.enablePlugins(CloudflowApplicationPlugin, CloudflowAkkaPlugin)
.settings(
name := "sensordata",
version := thisVersion,
libraryDependencies ++= Seq(marshallers),
)
.settings(commonSettings)
.dependsOn(support)
lazy val commonScalacOptions = Seq(
"-encoding", "UTF-8",
"-target:jvm-1.8",
"-Xlog-reflective-calls",
"-Xlint:_",
"-deprecation",
"-feature",
"-language:_",
"-unchecked"
)
lazy val scalacTestCompileOptions = commonScalacOptions ++ Seq(
// "-Xfatal-warnings", // Avro generates unused imports, so this is commented out not to break build
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused. (But there's no way to suppress warning when legitimate!!)
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
)
lazy val scalacSrcCompileOptions = scalacTestCompileOptions ++ Seq(
"-Ywarn-value-discard")
lazy val commonSettings = Seq(
scalacOptions in Compile := scalacSrcCompileOptions,
scalacOptions in Test := scalacTestCompileOptions,
scalacOptions in (Compile, console) := commonScalacOptions,
scalacOptions in (Test, console) := commonScalacOptions,
scalariformPreferences := scalariformPreferences.value
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(AlignSingleLineCaseStatements.MaxArrowIndent, 90)
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(DoubleIndentMethodDeclaration, true)
.setPreference(IndentLocalDefs, true)
.setPreference(IndentPackageBlocks, true)
.setPreference(RewriteArrowSymbols, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(NewlineAtEndOfFile, true)
.setPreference(AllowParamGroupsOnNewlines, true)
.setPreference(SpacesWithinPatternBinders, false) // otherwise case head +: tail@_ fails to compile!
)