-
Notifications
You must be signed in to change notification settings - Fork 142
/
build.sbt
123 lines (112 loc) · 5.53 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
import com.lightbend.paradox.apidoc.ApidocPlugin.autoImport.apidocRootPackage
import com.geirsson.CiReleasePlugin
ThisBuild / resolvers += "Akka library repository".at("https://repo.akka.io/maven")
lazy val `akka-persistence-jdbc` = project
.in(file("."))
.enablePlugins(ScalaUnidocPlugin)
.disablePlugins(MimaPlugin, SitePlugin, CiReleasePlugin)
.aggregate(core, docs, migrator)
.settings(name := "akka-persistence-jdbc-root", publish / skip := true)
lazy val core = project
.in(file("core"))
.enablePlugins(MimaPlugin)
.disablePlugins(SitePlugin, CiReleasePlugin)
.settings(
name := "akka-persistence-jdbc",
libraryDependencies ++= Dependencies.Libraries,
// Workaround for https://github.com/slick/slick/issues/2933
libraryDependencies ++=
(if (scalaVersion.value.startsWith("2.13")) Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
else Nil),
mimaReportSignatureProblems := true,
mimaPreviousArtifacts := {
if (scalaVersion.value.startsWith("3")) {
Set.empty
} else {
Set(
organization.value %% name.value % previousStableVersion.value.getOrElse(
throw new Error("Unable to determine previous version for MiMa")))
}
})
lazy val integration = project
.in(file("integration"))
.settings(IntegrationTests.settings)
.settings(name := "akka-persistence-jdbc-integration", libraryDependencies ++= Dependencies.Libraries)
.disablePlugins(MimaPlugin, SitePlugin, CiReleasePlugin)
.dependsOn(core % "compile->compile;test->test")
lazy val migrator = project
.in(file("migrator"))
.disablePlugins(SitePlugin, MimaPlugin, CiReleasePlugin)
.settings(
name := "akka-persistence-jdbc-migrator",
libraryDependencies ++= Dependencies.Migration ++ Dependencies.Libraries,
// TODO remove this when ready to publish it
publish / skip := true)
.dependsOn(core % "compile->compile;test->test")
lazy val `migrator-integration` = project
.in(file("migrator-integration"))
.settings(IntegrationTests.settings)
.settings(name := "akka-persistence-jdbc-migrator-integration", libraryDependencies ++= Dependencies.Libraries)
.disablePlugins(MimaPlugin, SitePlugin, CiReleasePlugin)
.dependsOn(migrator)
lazy val docs = project
.enablePlugins(ProjectAutoPlugin, AkkaParadoxPlugin, ParadoxSitePlugin, PreprocessPlugin, PublishRsyncPlugin)
.disablePlugins(MimaPlugin, CiReleasePlugin)
.settings(
name := "Akka Persistence plugin for JDBC",
publish / skip := true,
makeSite := makeSite.dependsOn(LocalRootProject / ScalaUnidoc / doc).value,
previewPath := (Paradox / siteSubdirName).value,
Preprocess / siteSubdirName := s"api/akka-persistence-jdbc/${if (isSnapshot.value) "snapshot"
else version.value}",
Preprocess / sourceDirectory := (LocalRootProject / ScalaUnidoc / unidoc / target).value,
Paradox / siteSubdirName := s"libraries/akka-persistence-jdbc/${if (isSnapshot.value) "snapshot" else version.value}",
Compile / paradoxProperties ++= Map(
"project.url" -> "https://doc.akka.io/libraries/akka-persistence-jdbc/current/",
"github.base_url" -> "https://github.com/akka/akka-persistence-jdbc/",
"canonical.base_url" -> "https://doc.akka.io/libraries/akka-persistence-jdbc/current",
"akka.version" -> Dependencies.AkkaVersion,
"slick.version" -> Dependencies.SlickVersion,
"extref.github.base_url" -> s"https://github.com/akka/akka-persistence-jdbc/blob/${if (isSnapshot.value) "master"
else "v" + version.value}/%s",
// Slick
"extref.slick.base_url" -> s"https://scala-slick.org/doc/${Dependencies.SlickVersion}/%s",
// Akka
"extref.akka.base_url" -> s"https://doc.akka.io/libraries/akka-core/${Dependencies.AkkaBinaryVersion}/%s",
"scaladoc.akka.base_url" -> s"https://doc.akka.io/api/akka-core/${Dependencies.AkkaBinaryVersion}/",
"javadoc.akka.base_url" -> s"https://doc.akka.io/japi/akka-core/${Dependencies.AkkaBinaryVersion}/",
"javadoc.akka.link_style" -> "direct",
// Java
"javadoc.base_url" -> "https://docs.oracle.com/javase/8/docs/api/",
// Scala
"scaladoc.scala.base_url" -> s"https://www.scala-lang.org/api/${scalaBinaryVersion.value}.x/",
"scaladoc.akka.persistence.jdbc.base_url" -> s"/${(Preprocess / siteSubdirName).value}/"),
paradoxGroups := Map("Language" -> Seq("Java", "Scala")),
resolvers += Resolver.jcenterRepo,
publishRsyncArtifacts += makeSite.value -> "www/",
publishRsyncHost := "[email protected]",
apidocRootPackage := "akka")
Global / onLoad := (Global / onLoad).value.andThen { s =>
val v = version.value
if (dynverGitDescribeOutput.value.hasNoTags)
throw new MessageOnlyException(
s"Failed to derive version from git tags. Maybe run `git fetch --unshallow`? Derived version: $v")
s
}
TaskKey[Unit]("verifyCodeFmt") := {
scalafmtCheckAll.all(ScopeFilter(inAnyProject)).result.value.toEither.left.foreach { _ =>
throw new MessageOnlyException(
"Unformatted Scala code found. Please run 'scalafmtAll' and commit the reformatted code")
}
(Compile / scalafmtSbtCheck).result.value.toEither.left.foreach { _ =>
throw new MessageOnlyException(
"Unformatted sbt code found. Please run 'scalafmtSbt' and commit the reformatted code")
}
}
addCommandAlias("verifyCodeStyle", "headerCheck; verifyCodeFmt")
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
}