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 0
/
build.sbt
165 lines (148 loc) · 5.3 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
// *****************************************************************************
// Projects
// *****************************************************************************
resolvers += Resolver.sonatypeRepo("releases")
lazy val root = (project in file("."))
.settings(commonSettings: _*)
.settings(publishSettings: _*)
.settings(
name := "terminology",
libraryDependencies ++= Seq(
// compiler plugins
compilerPlugin(library.kindProjector),
// compile time dependencies
library.shapeless % Compile,
// test dependencies
library.scalaTest % "test",
library.ammonite % "test"
)
)
addCommandAlias("example", ";test:run src/test/resources/example.sc")
// *****************************************************************************
// Dependencies
// *****************************************************************************
lazy val library =
new {
object Version {
val kindProjector = "0.9.6"
val shapeless = "2.3.3"
val scalaTest = "3.0.5"
val ammonite = "1.1.0"
}
val kindProjector = "org.spire-math" %% "kind-projector" % Version.kindProjector
val shapeless = "com.chuusai" %% "shapeless" % Version.shapeless
val scalaTest = "org.scalatest" %% "scalatest" % Version.scalaTest
val ammonite = "com.lihaoyi" %% "ammonite" % Version.ammonite cross CrossVersion.full
}
// *****************************************************************************
// Settings
// *****************************************************************************
lazy val commonSettings = Seq(
scalaVersion := "2.12.4",
organization := "co.upvest",
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.8",
"-encoding",
"UTF-8",
"-Xfatal-warnings",
"-Ywarn-unused-import",
"-Yno-adapted-args",
"-Ywarn-inaccessible",
"-Ywarn-dead-code",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit",
"-Ywarn-unused-import",
"-Ypartial-unification",
"-Xmacro-settings:materialize-derivations"
),
scalacOptions in (Compile, console) ~= {
_ filterNot (_ == "-Ywarn-unused-import")
},
javacOptions ++= Seq( "-source", "1.8", "-target", "1.8"),
cancelable in Global := true,
fork in Global := true
)
// *****************************************************************************
// Release 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 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,
pgpReadOnly := true,
pgpSigningKey := Some(3042900655697024585L),
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 := s"Bumping version\n\n[skip ci]",
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/terminology")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
scmInfo := Some(
ScmInfo(
url("https://github.com/toknapp/terminology"),
"scm:[email protected]:toknapp/terminology.git")
),
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