forked from vertica/spark-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
111 lines (94 loc) · 4.34 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
// (c) Copyright [2020-2021] Micro Focus or one of its affiliates.
// 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 java.util.Properties
// Retrieving the connector version number from a common file.
val versionProps = settingKey[Properties]("Connector version properties")
versionProps := {
val prop = new Properties()
IO.load(prop, new File("../version.properties"))
prop
}
scalaVersion := "2.12.12"
name := "spark-vertica-connector"
organization := "com.vertica"
version := versionProps.value.getProperty("connector-version")
resolvers += "Artima Maven Repository" at "https://repo.artima.com/releases"
resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
libraryDependencies += "com.vertica.jdbc" % "vertica-jdbc" % "11.0.2-0"
libraryDependencies += "org.apache.spark" %% "spark-core" % "3.3.0"
libraryDependencies += "org.apache.spark" %% "spark-sql" % "3.3.0"
libraryDependencies += "org.apache.hadoop" % "hadoop-hdfs" % "3.3.2"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.2" % Test
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.2" % "test"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2"
libraryDependencies += "org.scalamock" %% "scalamock" % "4.4.0" % Test
libraryDependencies += "org.typelevel" %% "cats-core" % "2.1.1"
// Hadoop's jersey-server conflicts with Spark's and can cause a Spark UI issue
excludeDependencies += ExclusionRule("com.sun.jersey", "jersey-server")
Test / parallelExecution := false
assembly / assemblyMergeStrategy := {
case n if n.contains("services") => MergeStrategy.concat
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case x => MergeStrategy.first
}
import sbtsonar.SonarPlugin.autoImport.sonarProperties
sonarProperties ++= Map(
"sonar.host.url" -> "http://localhost:80",
)
ThisBuild / scapegoatVersion := "1.3.3"
scapegoatReports := Seq("xml")
Scapegoat / scalacOptions += "-P:scapegoat:overrideLevels:all=Warning"
scalacOptions += "-Ypartial-unification"
scalacOptions += "-Ywarn-value-discard"
scalastyleFailOnError := true
scalastyleFailOnWarning := true
// Explanation for exclusions from unit test coverage:
// - JDBC Layer: excluded as a bottom-layer component that does IO -- covered by integration tests.
// - File Store Layer: excluded as a bottom-layer component that does IO -- covered by integration tests.
// - Pipe Factory: as the rest of the components rely on abstract interfaces, this is the place
// that creates the concrete implementations of those, such as the bottom-layer components mentioned above.
// - Parquet reader files taken from third part spark library
// - Reflections: Our reflection classes invokes methods at runtime for ones that are not defined at compile time. Thus
// unit tests will fail and can't be tested.
coverageExcludedPackages := "<empty>;.*jdbc.*;.*fs.*;.*core.factory.*;.*parquet.*;.*reflections.*"
coverageMinimum := 80
coverageFailOnMinimum := true
assembly / assemblyShadeRules := Seq(
ShadeRule.rename("cats.**" -> "shadeCats.@1").inAll
)
assembly / assemblyExcludedJars := {
val cp = (assembly / fullClasspath).value
cp.filter{f => f.data.getName.contains("spark") ||
f.data.getName.contains("hadoop")
}
}
Test / fork := true
Test / envVars := Map(
"AWS_ACCESS_KEY_ID" -> "test",
"AWS_SECRET_ACCESS_KEY" -> "foo",
"AWS_SESSION_TOKEN" -> "testsessiontoken",
"AWS_DEFAULT_REGION" -> "us-west-1",
"AWS_CREDENTIALS_PROVIDER" -> "test-provider",
"GCS_HMAC_KEY_ID" -> "id",
"GCS_HMAC_KEY_SECRET" -> "secret",
"GCS_SERVICE_KEY_ID" -> "id",
"GCS_SERVICE_KEY" -> "secret",
"GCS_SERVICE_EMAIL" -> "email",
)
lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "buildinfo"
)