forked from pluralsight/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
202 lines (185 loc) · 5.61 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
import sbt.Resolver
val JDK = "1.8"
val buildNumber =
scala.util.Properties.envOrNone("version").map(v => "." + v).getOrElse("")
val hydraVersion = "0.11.3" + buildNumber
val jvmMaxMemoryFlag = sys.env.getOrElse("MAX_JVM_MEMORY_FLAG", "-Xmx2g")
lazy val defaultSettings = Seq(
organization := "pluralsight",
version := hydraVersion,
scalaVersion := "2.12.11",
description := "Hydra",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
excludeDependencies += "org.slf4j" % "slf4j-log4j12",
excludeDependencies += "log4j" % "log4j",
dependencyOverrides ++= Seq(
"org.apache.commons" % "commons-lang3" % "3.12.0",
"org.apache.commons" % "commons-compress" % "1.22",
"org.apache.commons" % "lang3" % "3.1.0",
"io.confluent" % "kafka-schema-registry" % "5.4.2" % "test",
"io.confluent" % "kafka-avro-serializer" % "5.4.2" % "test"
),
addCompilerPlugin(
"org.typelevel" %% "kind-projector" % "0.11.3" cross CrossVersion.full
),
packageOptions in (Compile, packageBin) +=
Package.ManifestAttributes("Implementation-Build" -> buildNumber),
logLevel := Level.Info,
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-feature",
"-language:_",
"-deprecation",
"-unchecked",
"-Ypartial-unification"
),
javacOptions in Compile ++= Seq(
"-encoding",
"UTF-8",
"-source",
JDK,
"-target",
JDK,
"-Xlint:unchecked",
"-Xlint:deprecation",
"-Xlint:-options"
),
resolvers += Resolver.mavenLocal,
resolvers += "Confluent Maven Repo" at "https://packages.confluent.io/maven/",
resolvers += "jitpack" at "https://jitpack.io",
ivyLoggingLevel in ThisBuild := UpdateLogging.Quiet,
parallelExecution in sbt.Test := false,
javaOptions in Universal ++= Seq(
"-Dorg.aspectj.tracing.factory=default",
"-J" + jvmMaxMemoryFlag
)
)
lazy val restartSettings = Seq(
javaOptions in reStart += jvmMaxMemoryFlag
)
val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false,
// required until these tickets are closed https://github.com/sbt/sbt-pgp/issues/42,
// https://github.com/sbt/sbt-pgp/issues/36
publishTo := Some(
Resolver.file("Unused transient repository", file("target/unusedrepo"))
),
packageBin := {
new File("")
},
packageSrc := {
new File("")
},
packageDoc := {
new File("")
}
)
lazy val moduleSettings =
defaultSettings ++ Test.testSettings //++ Publish.settings
lazy val root = Project(
id = "hydra",
base = file(".")
)
.settings(moduleSettings)
.aggregate(common, core, avro, ingest, kafka)
lazy val common = Project(
id = "common",
base = file("common")
).settings(
moduleSettings,
name := "hydra-common",
libraryDependencies ++= Dependencies.baseDeps
)
lazy val core = Project(
id = "core",
base = file("core")
).dependsOn(avro)
.settings(
moduleSettings,
name := "hydra-core",
libraryDependencies ++= Dependencies.coreDeps ++ Dependencies.awsAuthDeps,
dependencyOverrides ++= Seq(
"io.confluent" % "kafka-schema-registry" % "5.4.2",
"io.confluent" % "kafka-avro-serializer" % "5.4.2"
)
)
lazy val kafka = Project(
id = "kafka",
base = file("ingestors/kafka")
).dependsOn(core, common % "compile->compile;test->test")
.configs(IntegrationTest)
.settings(
moduleSettings ++ Defaults.itSettings,
name := "hydra-kafka",
libraryDependencies ++= Dependencies.kafkaDeps,
dependencyOverrides ++= Seq(
"io.confluent" % "kafka-schema-registry" % "5.4.2",
"io.confluent" % "kafka-avro-serializer" % "5.4.2"
)
)
lazy val avro = Project(
id = "avro",
base = file("avro")
).dependsOn(common)
.settings(
moduleSettings,
name := "hydra-avro",
libraryDependencies ++= Dependencies.avroDeps
)
val sbSettings =
defaultSettings ++ Test.testSettings ++ noPublishSettings ++ restartSettings
lazy val ingest = Project(
id = "ingest",
base = file("ingest")
)
.dependsOn(core, kafka, common % "compile->compile;test->test")
.settings(
moduleSettings ++ dockerSettings,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "hydra.ingest.bootstrap",
buildInfoOptions += BuildInfoOption.ToJson,
buildInfoOptions += BuildInfoOption.BuildTime,
javaAgents += "org.aspectj" % "aspectjweaver" % "1.8.14",
name := "hydra-ingest",
libraryDependencies ++= Dependencies.ingestDeps
)
.enablePlugins(BuildInfoPlugin, JavaAppPackaging, JavaAgent, sbtdocker.DockerPlugin)
//scala style
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
testScalastyle := scalastyle.in(sbt.Test).toTask("").value
lazy val dockerSettings = Seq(
buildOptions in docker := BuildOptions(
cache = false,
removeIntermediateContainers = BuildOptions.Remove.Always,
pullBaseImage = BuildOptions.Pull.IfMissing
),
dockerfile in docker := {
val appDir: File = stage.value
val targetDir = "/app"
new Dockerfile {
from("java")
maintainer("Alex Silva <[email protected]>")
user("root")
env("JAVA_OPTS", "-Xmx2G")
runRaw("mkdir -p /etc/hydra")
run("mkdir", "-p", "/var/log/hydra")
expose(8088)
entryPoint(s"$targetDir/bin/${executableScriptName.value}")
copy(appDir, targetDir)
}
},
imageNames in docker := Seq(
// Sets the latest tag
ImageName(s"${organization.value}/hydra:latest"),
// Sets a name with a tag that contains the project version
ImageName(
namespace = Some(organization.value),
repository = "hydra",
tag = Some(version.value)
)
)
)
ThisBuild / githubWorkflowPublishTargetBranches := Seq.empty