This repository has been archived by the owner on Jul 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sbt
225 lines (205 loc) · 8.02 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// *****************************************************************************
// Projects
// *****************************************************************************
lazy val IT = config("it") extend Test
lazy val types = (project in file("types"))
.settings(commonSettings)
.settings(publishSettings)
.settings(licenses += ("MIT", url("http://opensource.org/licenses/MIT")))
.settings(
moduleName := "arweave4s-types",
name := "Arweave4s Types",
buildInfoKeys := Seq[BuildInfoKey](version, scalaVersion, sbtVersion),
buildInfoPackage := "co.upvest.arweave4s",
libraryDependencies ++= Seq(
library.circeCore % Compile,
library.circeParser % Compile,
library.sttpCore % Compile,
library.spongyCastleCore % Compile,
)
)
lazy val test = (project in file("test"))
.settings(commonSettings)
.settings(publishSettings)
.settings(licenses += ("MIT", url("http://opensource.org/licenses/MIT")))
.dependsOn(types)
.settings(
moduleName := "arweave4s-test",
name := "Arweave4s Tests",
buildInfoKeys := Seq[BuildInfoKey](version, scalaVersion, sbtVersion),
buildInfoPackage := "co.upvest.arweave4s",
libraryDependencies ++= Seq(
library.scalaTest % Test,
library.scalaCheck % Compile,
)
)
lazy val core = (project in file("core"))
.settings(commonSettings)
.settings(publishSettings)
.settings(licenses += ("MIT", url("http://opensource.org/licenses/MIT")))
.configs(IntegrationTest)
.settings(inConfig(IT)(Defaults.testSettings))
.enablePlugins(BuildInfoPlugin)
.dependsOn(types, test % Test)
.settings(
moduleName := "arweave4s-core",
name := "Arweave4s Core",
buildInfoKeys := Seq[BuildInfoKey](version, scalaVersion, sbtVersion),
buildInfoPackage := "co.upvest.arweave4s",
libraryDependencies ++= Seq(
// compiler plugins
compilerPlugin(library.kindProjector),
// compile time dependencies
library.circeCore % Compile,
library.circeParser % Compile,
library.sttpCore % Compile,
library.sttpCirce % Compile,
// test dependencies
library.scalaCheck % "it",
library.scalaTest % "it",
library.sttpAsyncBackend % "it",
library.logback % "it"
).map(dependencies =>
library.exclusions.foldRight(dependencies) { (rule, module) =>
module.excludeAll(rule)
})
)
lazy val root = (project in file("."))
.settings(publishSettings)
.aggregate(core, test, types)
// *****************************************************************************
// Dependencies
// *****************************************************************************
lazy val library =
new {
object Version {
val circe = "0.11.1"
val scalaCheck = "1.14.0"
val scalaTest = "3.0.5"
val sttp = "1.5.9"
val spongyCastle = "1.58.0.0"
val kindProjector = "0.9.9"
val logback = "1.2.3"
}
val circeCore = "io.circe" %% "circe-core" % Version.circe
val circeParser = "io.circe" %% "circe-parser" % Version.circe
val sttpCore = "com.softwaremill.sttp" %% "core" % Version.sttp
val sttpCirce = "com.softwaremill.sttp" %% "circe" % Version.sttp
val sttpAsyncBackend = "com.softwaremill.sttp" %% "async-http-client-backend-future" % Version.sttp
val spongyCastleCore = "com.madgag.spongycastle" % "core" % Version.spongyCastle
val scalaCheck = "org.scalacheck" %% "scalacheck" % Version.scalaCheck
val scalaTest = "org.scalatest" %% "scalatest" % Version.scalaTest
val kindProjector = "org.spire-math" %% "kind-projector" % Version.kindProjector
val logback = "ch.qos.logback" % "logback-classic" % Version.logback
// All exclusions that should be applied to every module
val exclusions = Seq()
}
// *****************************************************************************
// Settings
// *****************************************************************************
organization in ThisBuild := "co.upvest"
lazy val tagName = Def.setting{
s"v${if (releaseUseGlobalVersion.value) (version in ThisBuild).value else version.value}"
}
lazy val commonSettings = Seq(
scalaVersion := "2.12.8",
organization := "co.upvest",
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.8",
"-encoding", "UTF-8",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit",
"-Ywarn-unused-import",
"-Ypartial-unification",
"-Xmacro-settings:materialize-derivations",
"-Xfuture",
"-Ycache-plugin-class-loader:last-modified",
"-Ycache-macro-class-loader:last-modified"
),
scalacOptions in (Compile, console) ~= {
_ filterNot (_ == "-Ywarn-unused-import")
},
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
cancelable in Global := true,
fork in Global := true,
)
lazy val credentialSettings = Seq(
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
)
import sbtrelease.ReleaseStateTransformations._
import sbtrelease.Version
def checkoutBranch(branch: String): ReleaseStep = { st: State =>
val Some(vcs) = Project.extract(st).get(releaseVcs)
val 0 = vcs.cmd("checkout", branch).!
st
}
lazy val releaseSettings = Seq(
releaseTagName := tagName.value,
useGpg := true,
pgpReadOnly := true,
usePgpKeyHex("5C90DFE428FC2B33"),
pgpPassphrase := Some(Array.empty),
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseVcsSign := true,
releaseVersionBump := Version.Bump.Minor,
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := Function.const(false),
releaseCommitMessage := "Bumping version",
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")
},
publishConfiguration := publishConfiguration.value.withOverwrite(isSnapshot.value),
PgpKeys.publishSignedConfiguration := PgpKeys.publishSignedConfiguration.value.withOverwrite(isSnapshot.value),
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(isSnapshot.value),
PgpKeys.publishLocalSignedConfiguration := PgpKeys.publishLocalSignedConfiguration.value.withOverwrite(isSnapshot.value),
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
setReleaseVersion,
tagRelease,
publishArtifacts,
releaseStepCommand("sonatypeReleaseAll"),
checkoutBranch("develop"),
setNextVersion,
commitNextVersion,
pushChanges
)
)
lazy val publishSettings = Seq(
homepage := Some(url("https://github.com/toknapp/arweave4s")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
scmInfo := Some(ScmInfo(url("https://github.com/toknapp/arweave4s"), "scm:[email protected]:toknapp/arweave4s.git")),
autoAPIMappings := true,
apiURL := Some(url("https://tech.upvest.co/arweave4s/api/")),
pomExtra := (
<developers>
<developer>
<id>allquantor</id>
<name>Ivan Morozov</name>
<url>https://github.com/allquantor/</url>
</developer>
<developer>
<id>rootmos</id>
<name>Gustav Behm</name>
<url>https://github.com/rootmos/</url>
</developer>
</developers>
)
) ++ credentialSettings ++ releaseSettings