-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.sbt
147 lines (121 loc) · 4.29 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
import java.nio.file.{Files, StandardCopyOption}
import Dependencies._
lazy val root = (project in file(".")).
settings(
inThisBuild(List(
organization := "tech.sourced",
scalaVersion := "2.11.12"
)),
name := "gitbase-spark-connector",
libraryDependencies += sparkSql % Provided,
libraryDependencies ++= Seq(
scalaTest % Test,
dockerJava % Test
),
libraryDependencies ++= Seq(
mariaDB % Compile,
enry % Compile,
bblfsh % Compile
)
)
// option to show full stack traces
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oF")
parallelExecution in Test := false
scalastyleFailOnError := true
git.useGitDescribe := true
assemblyJarName in assembly := s"${name.value}-${version.value}.jar"
// Shade everything but tech.sourced.gitbase.spark so the user does not have conflicts
assemblyShadeRules := Seq(
ShadeRule.rename("com.google.common.**" ->
"tech.sourced.gitbase.spark.shaded.com.google.common.@1").inAll,
ShadeRule.rename("com.google.protobuf.**" ->
"tech.sourced.gitbase.spark.shaded.com.google.protobuf.@1").inAll,
ShadeRule.rename("io.netty.**" ->
"tech.sourced.gitbase.spark.shaded.io.netty.@1").inAll
)
assemblyMergeStrategy in assembly := {
case "META-INF/io.netty.versions.properties" => MergeStrategy.last
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
enablePlugins(GitVersioning)
enablePlugins(ScalastylePlugin)
sonatypeProfileName := "tech.sourced"
// pom settings for sonatype
homepage := Some(url("https://github.com/src-d/gitbase-spark-connector"))
scmInfo := Some(ScmInfo(url("https://github.com/src-d/gitbase-spark-connector"),
"[email protected]:src-d/gitbase-spark-connector.git"))
developers += Developer("ajnavarro",
"Antonio Navarro",
url("https://github.com/ajnavarro"))
developers += Developer("kuba--",
"Kuba Podgorski",
url("https://github.com/kuba--"))
developers += Developer("mcarmonaa",
"Manuel Carmona",
url("https://github.com/mcarmonaa"))
developers += Developer("jfontan",
"Javier Fontán",
url("https://github.com/jfontan"))
developers += Developer("erizocosmico",
"Miguel Molina",
url("https://github.com/erizocosmico"))
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
pomIncludeRepository := (_ => false)
crossPaths := false
publishMavenStyle := true
val SONATYPE_USERNAME = scala.util.Properties.envOrElse("SONATYPE_USERNAME", "NOT_SET")
val SONATYPE_PASSWORD = scala.util.Properties.envOrElse("SONATYPE_PASSWORD", "NOT_SET")
credentials += Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
SONATYPE_USERNAME,
SONATYPE_PASSWORD)
val SONATYPE_PASSPHRASE = scala.util.Properties.envOrElse("SONATYPE_PASSPHRASE", "not set")
useGpg := false
pgpSecretRing := baseDirectory.value / "project" / ".gnupg" / "secring.gpg"
pgpPublicRing := baseDirectory.value / "project" / ".gnupg" / "pubring.gpg"
pgpPassphrase := Some(SONATYPE_PASSPHRASE.toArray)
packageBin in Compile := {
val file = (packageBin in Compile).value
val dest = new java.io.File(file.getParent, s"${name.value}-${version.value}-slim.jar")
Files.copy(
new java.io.File(file.getAbsolutePath).toPath,
dest.toPath,
StandardCopyOption.REPLACE_EXISTING
)
Files.delete(file.toPath)
dest
}
publishArtifact in (Compile, packageBin) := false
val packageSlim = taskKey[File]("package-slim")
packageSlim := (packageBin in Compile).value
addArtifact(Artifact("gitbase-spark-connector", "jar", "jar", "slim"), packageSlim)
assembly := {
val file = assembly.value
val dest = new java.io.File(file.getParent, s"${name.value}-uber.jar")
Files.copy(
new java.io.File(file.getAbsolutePath).toPath,
dest.toPath,
StandardCopyOption.REPLACE_EXISTING
)
file
}
assembly := assembly.dependsOn(packageBin in Compile).value
test in assembly := {}
addArtifact(artifact in(Compile, assembly), assembly)
isSnapshot := version.value endsWith "SNAPSHOT"
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) {
Some("snapshots" at nexus + "content/repositories/snapshots")
} else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}