-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
113 lines (100 loc) · 4 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
/*
* 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 // default version TODO
ThisBuild / versionScheme := Some("early-semver")
Global / onChangedBuildSource := ReloadOnSourceChanges
initialize := {
val _ = initialize.value // Ensure previous initializations are run
val requiredJavaVersion = VersionNumber("11")
val currentJavaVersion = VersionNumber(sys.props("java.specification.version"))
println(s"Running on Java version $currentJavaVersion, required is at least version $requiredJavaVersion")
//this routine can be used to assert the required Java version
}
enablePlugins(FlywayPlugin)
flywayUrl := FlywayConfiguration.flywayUrl
flywayUser := FlywayConfiguration.flywayUser
flywayPassword := FlywayConfiguration.flywayPassword
flywayLocations := FlywayConfiguration.flywayLocations
flywaySqlMigrationSuffixes := FlywayConfiguration.flywaySqlMigrationSuffixes
libraryDependencies ++= flywayDependencies
/**
* Module `server` is the service application that collects and stores measured data And upo request retrives them
*/
lazy 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
): _*
)
.enablePlugins(AssemblyPlugin)
.enablePlugins(AutomateHeaderPlugin)
.addSingleScalaBuild(Setup.serverAndDbScalaVersion, Dependencies.serverDependencies)
.dependsOn(model)
/**
* 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 = (projectMatrix in file("database"))
.disablePlugins(sbtassembly.AssemblyPlugin)
.settings(
Setup.commonSettings ++ Seq(
name := "atum-database",
javacOptions ++= Setup.serverAndDbJavacOptions,
test := {}
): _*
)
.addSingleScalaBuild(Setup.serverAndDbScalaVersion, Dependencies.databaseDependencies)
//----------------------------------------------------------------------------------------------------------------------
lazy val dbTest = taskKey[Unit]("Launch DB tests")
dbTest := {
println("Running DB tests")
(database.jvm(Setup.serverAndDbScalaVersion.asString) / Test / test).value
}