forked from akka/akka-persistence-cassandra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
129 lines (108 loc) · 4.87 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
import de.heikoseeberger.sbtheader.HeaderPattern
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt.Keys._
import sbtassembly.AssemblyPlugin.autoImport._
val AkkaVersion = "2.5.1"
val akkaPersistenceCassandraDependencies = Seq(
"com.datastax.cassandra" % "cassandra-driver-core" % "3.1.4",
"com.typesafe.akka" %% "akka-persistence" % AkkaVersion,
"com.typesafe.akka" %% "akka-cluster-tools" % AkkaVersion,
"com.typesafe.akka" %% "akka-persistence-query" % AkkaVersion,
"com.typesafe.akka" %% "akka-persistence-tck" % AkkaVersion % "test",
"com.typesafe.akka" %% "akka-stream-testkit" % AkkaVersion % "test",
"org.scalatest" %% "scalatest" % "3.0.0" % "test",
"org.osgi" % "org.osgi.core" % "5.0.0" % "provided"
)
def common: Seq[Setting[_]] = SbtScalariform.scalariformSettings ++ Seq(
organization := "com.typesafe.akka",
organizationName := "Typesafe Inc.",
licenses := Seq(("Apache License, Version 2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))),
crossScalaVersions := Seq("2.11.11", "2.12.2"),
scalaVersion := crossScalaVersions.value.head,
crossVersion := CrossVersion.binary,
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-deprecation",
//"-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Xfuture"
),
headers := headers.value ++ Map(
"scala" -> (
HeaderPattern.cStyleBlockComment,
"""|/*
| * Copyright (C) 2016 Typesafe Inc. <http://www.typesafe.com>
| */
|""".stripMargin
)
),
releaseCrossBuild := true,
// show full stack traces and test case durations
testOptions in Test += 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"),
// disable parallel tests
parallelExecution in Test := false,
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
lazy val root = (project in file("."))
.aggregate(core, cassandraLauncher)
.settings(common: _*)
.settings(
name := "akka-peristence-cassandra-root",
publishArtifact := false,
publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo"))),
publish := {},
PgpKeys.publishSigned := {}
)
lazy val core = (project in file("core"))
.enablePlugins(AutomateHeaderPlugin, SbtOsgi)
.dependsOn(cassandraLauncher % Test)
.settings(common: _*)
.settings(osgiSettings: _*)
.settings(
name := "akka-persistence-cassandra",
libraryDependencies ++= akkaPersistenceCassandraDependencies,
OsgiKeys.exportPackage := Seq("akka.persistence.cassandra.*"),
OsgiKeys.importPackage := Seq(akkaImport(), optionalImport("org.apache.cassandra.*"), "*"),
OsgiKeys.privatePackage := Nil
)
lazy val cassandraLauncher = (project in file("cassandra-launcher"))
.settings(common: _*)
.settings(
name := "akka-persistence-cassandra-launcher",
managedResourceDirectories in Compile += (target in cassandraBundle).value / "bundle",
managedResources in Compile += (assembly in cassandraBundle).value
)
// This project doesn't get published directly, rather the assembled artifact is included as part of cassandraLaunchers
// resources
lazy val cassandraBundle = (project in file("cassandra-bundle"))
.enablePlugins(AutomateHeaderPlugin)
.settings(
name := "akka-persistence-cassandra-bundle",
crossPaths := false,
autoScalaLibrary := false,
libraryDependencies += "org.apache.cassandra" % "cassandra-all" % "3.10" exclude("commons-logging", "commons-logging"),
target in assembly := target.value / "bundle" / "akka" / "persistence" / "cassandra" / "launcher",
assemblyJarName in assembly := "cassandra-bundle.jar"
)
def formattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(SpacesAroundMultiImports, true)
}
def akkaImport(packageName: String = "akka.*") = versionedImport(packageName, "2.4", "2.5")
def configImport(packageName: String = "com.typesafe.config.*") = versionedImport(packageName, "1.3.0", "1.4.0")
def versionedImport(packageName: String, lower: String, upper: String) = s"""$packageName;version="[$lower,$upper)""""
def optionalImport(packageName: String) = s"$packageName;resolution:=optional"