forked from heremaps/here-sbt-bom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
154 lines (141 loc) · 4.32 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
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
import sbtrelease.Version
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
import scala.xml.transform._
val organizationSettings: Seq[Setting[_]] = Seq(
scalaVersion := "2.12.15",
organization := "com.here.platform",
projectInfo := ModuleInfo(
nameFormal = "HERE sbt-bom plugin",
description =
"The sbt-bom plugin sbt-bom plugin provides a way to use Maven BOM (bill of materials) in sbt projects",
homepage = Some(url("http://here.com")),
startYear = Some(2021),
licenses = Vector(),
organizationName = "HERE Europe B.V",
organizationHomepage = Some(url("http://here.com")),
scmInfo = Some(
ScmInfo(
connection = "scm:git:https://github.com/heremaps/here-sbt-bom.git",
devConnection = "scm:git:git@github.com:heremaps/here-sbt-bom.git",
browseUrl = url("https://github.com/heremaps/here-sbt-bom")
)
),
developers = Vector(
Developer(
"here",
"HERE Artifact Service Team",
"ARTIFACT_SERVICE_SUPPORT@here.com",
url = url("https://github.com/heremaps")
)
)
)
)
lazy val licenseSettings = Seq(
headerEmptyLine := false,
headerLicense := Some(HeaderLicense.Custom(IO.read(file("./LICENSE")))),
Compile / headerSources ++= {
val base = baseDirectory.value
val baseDirectories = (base / "src" / "sbt-test" / "bom")
val customJars = (baseDirectories ** "*.scala")
customJars.get()
}
)
lazy val scalaCompilerOptions = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture"
)
lazy val commonSettings = organizationSettings ++ licenseSettings
lazy val `root` = project
.in(file("."))
.settings(
publish := {
print("Skip publishing root artifacts")
}
)
.settings(commonSettings)
.aggregate(`sbt-bom`)
lazy val `sbt-bom` = project
.in(file("plugin"))
.enablePlugins(SbtPlugin)
.settings(publishSettings)
.settings(commonSettings)
.settings(
Compile / unmanagedResources ++= Seq(baseDirectory.value / "LICENSE"),
// Testing
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq("-Dplugin.version=" + version.value)
},
scriptedBufferLog := false,
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.15" % Test,
"org.scalamock" %% "scalamock" % "5.2.0" % Test
)
)
lazy val publishSettings = Seq(
ThisBuild / 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")
},
pomIncludeRepository := { _ => false },
publishMavenStyle := true,
publishConfiguration := publishConfiguration.value.withOverwrite(true)
)
ThisBuild / pomExtra :=
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
ThisBuild / scalacOptions ++= scalaCompilerOptions
Global / onChangedBuildSource := ReloadOnSourceChanges
useGpgAgent := false
useGpgPinentry := true
sonatypeProfileName := "com.here"
// Defines the release process
releaseIgnoreUntrackedFiles := true
releaseTagName := (ThisBuild / version).value
releaseTagComment := s"Release ${(ThisBuild / version).value} from build ${sys.env
.getOrElse("TRAVIS_BUILD_ID", "None")}"
releaseNextVersion := { ver =>
Version(sys.props.getOrElse("currentVersion", ver))
.map(_.bump(releaseVersionBump.value).string)
.getOrElse(sbtrelease.versionFormatError(ver))
}
commands += Command.command("prepareRelease")((state: State) => {
println("Preparing release...")
val projectState = Project extract state
val customState = projectState.appendWithoutSession(
Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
setNextVersion,
runClean,
runTest,
tagRelease
)
),
state
)
Command.process("release with-defaults", customState)
})