-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
100 lines (78 loc) · 3.15 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
import ResourceFilter.filterResources
ThisBuild / scalaVersion := "2.13.12"
ThisBuild / version := "0.1.0"
ThisBuild / description := "A BungeeCord plugin for controlling access to data shared among downstream servers"
//region dependency config
resolvers ++= Seq(
"bungeecord-repo" at "https://oss.sonatype.org/content/repositories/snapshots",
)
val providedDependencies = Seq(
"net.md-5" % "bungeecord-api" % "1.12-SNAPSHOT",
"net.md-5" % "bungeecord-parent" % "1.12-SNAPSHOT",
// no runtime
"org.typelevel" %% "simulacrum" % "1.0.1"
).map(_ % "provided")
val testDependencies = Seq(
"org.scalamock" %% "scalamock" % "4.4.0",
"org.scalatest" %% "scalatest" % "3.2.17",
"org.scalatestplus" %% "scalacheck-1-14" % "3.2.2.0",
).map(_ % "test")
val dependenciesToEmbed = Seq(
"org.typelevel" %% "cats-core" % "2.3.0",
"org.typelevel" %% "cats-effect" % "2.3.0",
"com.github.etaty" %% "rediscala" % "1.9.0",
)
// treat localDependencies as "provided" and do not shade them in the output Jar
assembly / assemblyExcludedJars := {
(assembly / fullClasspath).value
.filter { a =>
def directoryContainsFile(directory: File, file: File) =
file.absolutePath.startsWith(directory.absolutePath)
directoryContainsFile(baseDirectory.value / "localDependencies", a.data)
}
}
assembly / assemblyMergeStrategy := {
case PathList(x) if x.endsWith(".conf") => MergeStrategy.concat
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
//endregion
//region settings for token replacements
val tokenReplacementMap = settingKey[Map[String, String]]("Map specifying what tokens should be replaced to")
tokenReplacementMap := Map(
"name" -> name.value,
"version" -> version.value
)
val filesToBeReplacedInResourceFolder = Seq("plugin.yml")
val filteredResourceGenerator = taskKey[Seq[File]]("Resource generator to filter resources")
Compile / filteredResourceGenerator :=
filterResources(
filesToBeReplacedInResourceFolder,
tokenReplacementMap.value,
(Compile / resourceManaged).value, (Compile / resourceDirectory).value
)
Compile / resourceGenerators += (Compile / filteredResourceGenerator)
Compile / unmanagedResources += baseDirectory.value / "LICENSE"
// exclude replaced files from copying of unmanagedResources
unmanagedResources / excludeFilter :=
filesToBeReplacedInResourceFolder.foldLeft((unmanagedResources / excludeFilter).value)(_.||(_))
//endregion
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.13.2" cross CrossVersion.full)
lazy val root = (project in file("."))
.settings(
name := "BungeeSemaphore",
assembly / assemblyOutputPath := baseDirectory.value / "target" / "build" / "BungeeSemaphore.jar",
libraryDependencies := providedDependencies ++ testDependencies ++ dependenciesToEmbed,
unmanagedBase := baseDirectory.value / "localDependencies",
unmanagedBase := baseDirectory.value / "localDependencies",
scalacOptions ++= Seq(
"-encoding", "utf8",
"-unchecked",
"-language:higherKinds",
"-deprecation",
"-Ypatmat-exhaust-depth", "320",
"-Ymacro-annotations",
),
javacOptions ++= Seq("-encoding", "utf8")
)