-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
171 lines (161 loc) · 8.48 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
import com.typesafe.tools.mima.plugin.MimaKeys.mimaPreviousArtifacts
import com.typesafe.tools.mima.plugin.MimaKeys.mimaReportSignatureProblems
import sbt.Keys.parallelExecution
import com.geirsson.CiReleasePlugin
GlobalScope / parallelExecution := false
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1)
inThisBuild(
Seq(
organization := "com.lightbend.akka",
organizationName := "Lightbend Inc.",
homepage := Some(url("https://doc.akka.io/libraries/akka-persistence-dynamodb/current")),
scmInfo := Some(
ScmInfo(
url("https://github.com/akka/akka-persistence-dynamodb"),
"https://github.com/akka/akka-persistence-dynamodb.git")),
startYear := Some(2024),
developers += Developer(
"contributors",
"Contributors",
"",
url("https://github.com/akka/akka-persistence-dynamodb/graphs/contributors")),
releaseNotesURL := (
if (isSnapshot.value) None
else Some(url(s"https://github.com/akka/akka-persistence-dynamodb/releases/tag/v${version.value}"))
),
licenses := {
val tagOrBranch =
if (isSnapshot.value) "main"
else "v" + version.value
Seq(("BUSL-1.1", url(s"https://github.com/akka/akka-persistence-dynamodb/blob/${tagOrBranch}/LICENSE")))
},
description := "An Akka Persistence plugin backed by Amazon DynamoDB",
// append -SNAPSHOT to version when isSnapshot
dynverSonatypeSnapshots := true,
resolvers += "Akka library repository".at("https://repo.akka.io/maven"),
resolvers ++=
(if (Dependencies.AkkaVersion.endsWith("-SNAPSHOT"))
Seq("Akka library snapshot repository".at("https://repo.akka.io/snapshots"))
else Seq.empty)))
val defaultScalacOptions = Seq("-release", "11")
def common: Seq[Setting[_]] =
Seq(
crossScalaVersions := Dependencies.ScalaVersions,
scalaVersion := Dependencies.Scala213,
crossVersion := CrossVersion.binary,
scalafmtOnCompile := true,
// Setting javac options in common allows IntelliJ IDEA to import them automatically
Compile / javacOptions ++= Seq("-encoding", "UTF-8", "--release", "11"),
Compile / javacOptions ++= Seq("-Werror", "-Xlint:deprecation", "-Xlint:unchecked"),
Compile / scalacOptions ++= defaultScalacOptions,
Compile / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => Seq("-Xfatal-warnings", "-Xlint", "-unchecked", "-deprecation")
case _ => Seq("-Xfatal-warnings")
}),
Compile / console / scalacOptions := defaultScalacOptions,
Test / console / scalacOptions := defaultScalacOptions,
Compile / doc / scalacOptions := defaultScalacOptions ++ Seq(
"-doc-title",
"Akka Persistence DynamoDB",
"-doc-version",
version.value) ++ {
// make use of https://github.com/scala/scala/pull/8663
if (scalaBinaryVersion.value.startsWith("3")) {
Seq(
s"-external-mappings:https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api/java.base/")
} else
Seq(
"-jdk-api-doc-base",
s"https://docs.oracle.com/en/java/javase/${Dependencies.JavaDocLinkVersion}/docs/api/java.base/")
},
Compile / doc / autoAPIMappings := true,
headerLicense := Some(HeaderLicense.Custom("""Copyright (C) 2024 Lightbend Inc. <https://www.lightbend.com>""")),
Test / logBuffered := false,
Test / parallelExecution := false,
// show full stack traces and test case durations
Test / testOptions += Tests.Argument("-oDF"),
// -v Log "test run started" / "test started" / "test run finished" events on log level "info" instead of "debug".
// -a Show stack traces and exception class name for AssertionErrors.
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"),
Test / fork := true, // some non-heap memory is leaking
Test / javaOptions ++= {
import scala.collection.JavaConverters._
// include all passed -Dakka. properties to the javaOptions for forked tests
// useful to switch DB dialects for example
val akkaProperties = System.getProperties.stringPropertyNames.asScala.toList.collect {
case key: String if key.startsWith("akka.") || key.startsWith("conf") =>
"-D" + key + "=" + System.getProperty(key)
}
"-Xms1G" :: "-Xmx1G" :: "-XX:MaxDirectMemorySize=256M" :: akkaProperties
},
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value),
Global / excludeLintKeys += projectInfoVersion,
Global / excludeLintKeys += mimaReportSignatureProblems,
Global / excludeLintKeys += mimaPreviousArtifacts,
Global / excludeLintKeys += docs / previewSite / previewPath,
mimaReportSignatureProblems := true,
mimaPreviousArtifacts := Set.empty
// FIXME enable after first official release
// Set(
// organization.value %% moduleName.value % previousStableVersion.value
// .getOrElse(throw new Error("Unable to determine previous version")))
)
lazy val dontPublish = Seq(publish / skip := true, Compile / publishArtifact := false)
lazy val root = (project in file("."))
.settings(common)
.settings(dontPublish)
.settings(
name := "akka-persistence-dynamodb-root",
publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo"))))
.enablePlugins(ScalaUnidocPlugin)
.disablePlugins(SitePlugin, MimaPlugin, CiReleasePlugin)
.aggregate(core, docs)
def suffixFileFilter(suffix: String): FileFilter = new SimpleFileFilter(f => f.getAbsolutePath.endsWith(suffix))
lazy val core = (project in file("core"))
.settings(common)
.settings(name := "akka-persistence-dynamodb", libraryDependencies ++= Dependencies.core)
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(CiReleasePlugin)
lazy val docs = project
.in(file("docs"))
.enablePlugins(AkkaParadoxPlugin, ParadoxSitePlugin, PreprocessPlugin, PublishRsyncPlugin)
.disablePlugins(MimaPlugin, CiReleasePlugin)
.dependsOn(core % "compile;test->test")
.settings(common)
.settings(dontPublish)
.settings(
name := "Akka Persistence plugin for Amazon DynamoDB",
libraryDependencies ++= (Dependencies.TestDeps.cloudwatchMetricPublisher +: Dependencies.docs),
makeSite := makeSite.dependsOn(LocalRootProject / ScalaUnidoc / doc).value,
previewPath := (Paradox / siteSubdirName).value,
Preprocess / siteSubdirName := s"api/akka-persistence-dynamodb/${projectInfoVersion.value}",
Preprocess / sourceDirectory := (LocalRootProject / ScalaUnidoc / unidoc / target).value,
Paradox / siteSubdirName := s"libraries/akka-persistence-dynamodb/${projectInfoVersion.value}",
paradoxGroups := Map("Language" -> Seq("Java", "Scala")),
Compile / paradoxProperties ++= Map(
"project.url" -> "https://doc.akka.io/libraries/akka-persistence-dynamodb/current/",
"canonical.base_url" -> "https://doc.akka.io/libraries/akka-persistence-dynamodb/current",
"akka.version" -> Dependencies.AkkaVersion,
"scala.version" -> scalaVersion.value,
"scala.binary.version" -> scalaBinaryVersion.value,
"extref.akka-core.base_url" -> s"https://doc.akka.io/libraries/akka-core/${Dependencies.AkkaVersionInDocs}/%s",
"extref.akka-projection.base_url" -> s"https://doc.akka.io/libraries/akka-projection/${Dependencies.AkkaProjectionVersionInDocs}/%s",
"extref.java-docs.base_url" -> "https://docs.oracle.com/en/java/javase/11/%s",
"scaladoc.com.typesafe.config.base_url" -> s"https://lightbend.github.io/config/latest/api/",
"scaladoc.scala.base_url" -> s"https://www.scala-lang.org/api/current/",
"scaladoc.akka.persistence.dynamodb.base_url" -> s"/${(Preprocess / siteSubdirName).value}/",
"scaladoc.akka.projection.base_url" -> s"https://doc.akka.io/api/akka-projection/${Dependencies.AkkaProjectionVersionInDocs}/",
"scaladoc.akka.base_url" -> s"https://doc.akka.io/api/akka-core/${Dependencies.AkkaVersionInDocs}/",
"javadoc.akka.persistence.dynamodb.base_url" -> "", // no Javadoc is published
"javadoc.akka.base_url" -> s"https://doc.akka.io/japi/akka-core/${Dependencies.AkkaVersionInDocs}/"),
ApidocPlugin.autoImport.apidocRootPackage := "akka",
apidocRootPackage := "akka",
resolvers += Resolver.jcenterRepo,
publishRsyncArtifacts += makeSite.value -> "www/",
publishRsyncHost := "[email protected]")
val isJdk11orHigher: Boolean = {
val result = VersionNumber(sys.props("java.specification.version")).matchesSemVer(SemanticSelector(">=11"))
if (!result)
throw new IllegalArgumentException("JDK 11 or higher is required")
result
}