This repository has been archived by the owner on Sep 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
181 lines (169 loc) · 7.16 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
/*
scalafmt: {
style = defaultWithAlign
maxColumn = 150
align.tokens = [
{ code = "=>", owner = "Case" }
{ code = "?", owner = "Case" }
{ code = "extends", owner = "Defn.(Class|Trait|Object)" }
{ code = "//", owner = ".*" }
{ code = "{", owner = "Template" }
{ code = "}", owner = "Template" }
{ code = ":=", owner = "Term.ApplyInfix" }
{ code = "++=", owner = "Term.ApplyInfix" }
{ code = "+=", owner = "Term.ApplyInfix" }
{ code = "%", owner = "Term.ApplyInfix" }
{ code = "%%", owner = "Term.ApplyInfix" }
{ code = "%%%", owner = "Term.ApplyInfix" }
{ code = "->", owner = "Term.ApplyInfix" }
{ code = "?", owner = "Term.ApplyInfix" }
{ code = "<-", owner = "Enumerator.Generator" }
{ code = "?", owner = "Enumerator.Generator" }
{ code = "=", owner = "(Enumerator.Val|Defn.(Va(l|r)|Def|Type))" }
]
}
*/
// Dependency versions
val akkaVersion = "2.6.1"
val akkaHttpVersion = "10.1.11"
val apacheCompressVersion = "1.19"
val alpakkaVersion = "1.1.2"
val catsVersion = "2.1.0"
val catsEffectVersion = "2.0.0"
val circeVersion = "0.12.3"
val commonsVersion = "0.23.0"
val iamVersion = "1.3.0"
val mockitoVersion = "1.11.0"
val monixVersion = "3.1.0"
val pureconfigVersion = "0.12.2"
val scalaTestVersion = "3.1.0"
// Dependencies modules
lazy val akkaHttp = "com.typesafe.akka" %% "akka-http" % akkaHttpVersion
lazy val akkaHttpTestKit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion
lazy val alpakkaFiles = "com.lightbend.akka" %% "akka-stream-alpakka-file" % alpakkaVersion
lazy val apacheCompress = "org.apache.commons" % "commons-compress" % apacheCompressVersion
lazy val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
lazy val akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaVersion
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsEffect = "org.typelevel" %% "cats-effect" % catsEffectVersion
lazy val circeCore = "io.circe" %% "circe-core" % circeVersion
lazy val commonsCore = "ch.epfl.bluebrain.nexus" %% "commons-core" % commonsVersion
lazy val commonsKamon = "ch.epfl.bluebrain.nexus" %% "commons-kamon" % commonsVersion
lazy val commonsTest = "ch.epfl.bluebrain.nexus" %% "commons-test" % commonsVersion
lazy val iamClient = "ch.epfl.bluebrain.nexus" %% "iam-client" % iamVersion
lazy val mockito = "org.mockito" %% "mockito-scala" % mockitoVersion
lazy val monixEval = "io.monix" %% "monix-eval" % monixVersion
lazy val pureconfig = "com.github.pureconfig" %% "pureconfig" % pureconfigVersion
lazy val scalaTest = "org.scalatest" %% "scalatest" % scalaTestVersion
lazy val storage = project
.in(file("."))
.settings(assemblySettings, testSettings, buildInfoSettings)
.enablePlugins(BuildInfoPlugin, ServicePackagingPlugin)
.aggregate(client)
.settings(
name := "storage",
moduleName := "storage",
coverageFailOnMinimum := true,
javaSpecificationVersion := "1.8",
Docker / packageName := "nexus-storage",
libraryDependencies ++= Seq(
apacheCompress,
akkaHttp,
akkaStream,
akkaSlf4j,
alpakkaFiles,
catsCore,
catsEffect,
circeCore,
commonsCore,
commonsKamon,
iamClient,
monixEval,
pureconfig,
akkaHttpTestKit % Test,
commonsTest % Test,
mockito % Test,
scalaTest % Test
),
cleanFiles ++= Seq(
baseDirectory.value / "permissions-fixer" / "target" / "**",
baseDirectory.value / "nexus-storage.jar"
),
mappings in Universal := {
(mappings in Universal).value :+ cargo.value
}
)
lazy val client = project
.in(file("client"))
.disablePlugins(AssemblyPlugin)
.settings(
testSettings,
name := "storage-client",
moduleName := "storage-client",
coverageFailOnMinimum := true,
javaSpecificationVersion := "1.8",
libraryDependencies ++= Seq(
akkaHttp,
akkaStream,
catsCore,
circeCore,
commonsCore,
iamClient,
akkaHttpTestKit % Test,
commonsTest % Test,
mockito % Test,
scalaTest % Test
)
)
lazy val assemblySettings = Seq(
test in assembly := {},
assemblyOutputPath in assembly := baseDirectory.value / "nexus-storage.jar",
assemblyMergeStrategy in assembly := {
case PathList("org", "apache", "commons", "logging", xs @ _*) => MergeStrategy.last
case PathList("akka", "remote", "kamon", xs @ _*) => MergeStrategy.last
case PathList("kamon", "instrumentation", "akka", "remote", xs @ _*) => MergeStrategy.last
case "META-INF/versions/9/module-info.class" => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
)
lazy val testSettings = Seq(
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-o", "-u", "target/test-reports"),
Test / parallelExecution := false
)
lazy val buildInfoSettings = Seq(
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.storage.config"
)
lazy val cargo = taskKey[(File, String)]("Run Cargo to build 'nexus-fixer'")
cargo := {
import scala.sys.process._
val log = streams.value.log
val cmd = Process(Seq("cargo", "build", "--release"), baseDirectory.value / "permissions-fixer")
if ((cmd !) == 0) {
log.success("Cargo build successful.")
(baseDirectory.value / "permissions-fixer" / "target" / "release" / "nexus-fixer") -> "bin/nexus-fixer"
} else {
log.error("Cargo build failed.")
throw new RuntimeException
}
}
inThisBuild(
List(
homepage := Some(url("https://github.com/BlueBrain/nexus-storage")),
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
scmInfo := Some(ScmInfo(url("https://github.com/BlueBrain/nexus-storage"), "scm:git:[email protected]:BlueBrain/nexus-storage.git")),
developers := List(
Developer("bogdanromanx", "Bogdan Roman", "[email protected]", url("https://bluebrain.epfl.ch/")),
Developer("hygt", "Henry Genet", "[email protected]", url("https://bluebrain.epfl.ch/")),
Developer("umbreak", "Didac Montero Mendez", "[email protected]", url("https://bluebrain.epfl.ch/")),
Developer("wwajerowicz", "Wojtek Wajerowicz", "[email protected]", url("https://bluebrain.epfl.ch/"))
),
// These are the sbt-release-early settings to configure
releaseEarlyWith := BintrayPublisher,
releaseEarlyNoGpg := true,
releaseEarlyEnableSyncToMaven := false
)
)
addCommandAlias("review", ";clean;scalafmtSbt;test:scalafmtCheck;scalafmtSbtCheck;coverage;scapegoat;test;coverageReport;coverageAggregate")