-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
144 lines (129 loc) · 4.96 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
/*
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import sbt.Keys.name
import sbt.*
import Dependencies.*
import Dependencies.Versions.spark3
import VersionAxes.*
ThisBuild / scalaVersion := Setup.scala213.asString
ThisBuild / versionScheme := Some("early-semver")
Global / onChangedBuildSource := ReloadOnSourceChanges
val limitedProject: Boolean = Setup.currentJava < Setup.recommendedJava
initialize := {
val _ = initialize.value // Ensure previous initializations are run
assert(Setup.currentJava >= Setup.requiredJava,
s"Running on Java version ${Setup.currentJava}, required is at least version ${Setup.requiredJava}, recommended is ${Setup.recommendedJava}")
if (limitedProject) {
val log = Keys.sLog.value
log.warn(s"Some nodules will not be loaded, because they require at least Java ${Setup.recommendedJava} while Java ${Setup.currentJava} has been found")
log.warn("""Affected modules are: "atum-server", "atum-database"""")
}
}
enablePlugins(FlywayPlugin)
flywayUrl := FlywayConfiguration.flywayUrl
flywayUser := FlywayConfiguration.flywayUser
flywayPassword := FlywayConfiguration.flywayPassword
flywayLocations := FlywayConfiguration.flywayLocations
flywaySqlMigrationSuffixes := FlywayConfiguration.flywaySqlMigrationSuffixes
flywayBaselineVersion := FlywayConfiguration.flywayBaselineVersion
libraryDependencies ++= flywayDependencies
/**
* Module `server` is the service application that collects and stores measured data And upo request retrives them
*/
lazy val server = {
val server = (projectMatrix in file("server"))
.settings(
Setup.commonSettings ++ Seq(
name := "atum-server",
javacOptions ++= Setup.serverAndDbJavacOptions,
Compile / packageBin / publishArtifact := false,
packageBin := (Compile / assembly).value,
artifactPath / (Compile / packageBin) := baseDirectory.value / s"target/${name.value}-${version.value}.jar",
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
Setup.serverMergeStrategy,
publish / skip := true
): _*
)
.enablePlugins(AssemblyPlugin)
.enablePlugins(AutomateHeaderPlugin)
.addSingleScalaBuild(Setup.serverAndDbScalaVersion, Dependencies.serverDependencies)
.dependsOn(model)
if (limitedProject) {
null // if value other then null is returned, the condition doesn't seem to work.
} else {
server
}
}
/**
* Module `agent` is the library to be plugged into the Spark application to measure the data and send it to the server
*/
lazy val agent = (projectMatrix in file("agent"))
.disablePlugins(sbtassembly.AssemblyPlugin)
.settings(
Setup.commonSettings ++ Seq(
name := "atum-agent",
javacOptions ++= Setup.clientJavacOptions
): _*
)
.addSparkCrossBuild(SparkVersionAxis(spark3), Setup.clientSupportedScalaVersions, Dependencies.agentDependencies)
.dependsOn(model)
/**
* Module `model` is the data model for data exchange with server
*/
lazy val model = (projectMatrix in file("model"))
.disablePlugins(sbtassembly.AssemblyPlugin)
.settings(
Setup.commonSettings ++ Seq(
name := "atum-model",
javacOptions ++= Setup.clientJavacOptions,
): _*
)
.addScalaCrossBuild(Setup.clientSupportedScalaVersions, Dependencies.modelDependencies)
/**
* Module `database` is the source of database structures of the service
*/
lazy val database = {
val database = (projectMatrix in file("database"))
.disablePlugins(sbtassembly.AssemblyPlugin)
.settings(
Setup.commonSettings ++ Seq(
name := "atum-database",
javacOptions ++= Setup.serverAndDbJavacOptions,
publish / skip := true
): _*
)
.addSingleScalaBuild(Setup.serverAndDbScalaVersion, Dependencies.databaseDependencies)
if (limitedProject) {
null // if value other then null is returned, the condition doesn't seem to work.
} else {
database
}
}
/**
* Module `reader` is the library to be plugged into application which wants to easily read the measured data stored on
* the server
*/
lazy val reader = (projectMatrix in file("reader"))
.disablePlugins(sbtassembly.AssemblyPlugin)
.settings(
Setup.commonSettings ++ Seq(
name := "atum-reader",
javacOptions ++= Setup.clientJavacOptions,
publish / skip := true // module is not yet finished, so we don't want to publish it
): _*
)
.addScalaCrossBuild(Setup.clientSupportedScalaVersions, Dependencies.readerDependencies)
.dependsOn(model)