-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
85 lines (64 loc) · 2.76 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
import ResourceFilter.filterResources
// region Dependencies
resolvers ++= Seq(
"SpigotMC" at "https://maven.elmakers.com/repository/",
"Sonatype OSS" at "https://s01.oss.sonatype.org/content/groups/public/"
)
val providedDependencies =
Seq("org.spigotmc" % "spigot-api" % "1.16.4-R0.1-SNAPSHOT").map(_ % "provided")
val testDependencies =
Seq("org.scalamock" %% "scalamock" % "6.0.0", "org.scalatest" %% "scalatest" % "3.2.19")
.map(_ % "test")
libraryDependencies ++= providedDependencies ++ testDependencies
excludeDependencies ++= Seq(ExclusionRule(organization = "org.bukkit", name = "bukkit"))
// endregion
// region プラグインJarに埋め込むリソースの処理
// This region is
// * licensed under GPL v3 (https://github.com/GiganticMinecraft/SeichiAssist/blob/2e2c33af7138b3f0f6137245ba389c7a98f92f23/LICENSE)
// * written in SeichiAssist (https://github.com/GiganticMinecraft/SeichiAssist/blob/398d224228b933f5523ceebf173f3fad46605cb8/build.sbt#L135-L171)
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 ++= Seq(baseDirectory.value / "LICENSE")
// トークン置換を行ったファイルをunmanagedResourcesのコピーから除外する
unmanagedResources / excludeFilter :=
filesToBeReplacedInResourceFolder.foldLeft((unmanagedResources / excludeFilter).value)(
_.||(_)
)
// endregion
// region Other settings
lazy val root = (project in file(".")).settings(
name := "TimeToGo",
scalaVersion := "2.13.15",
assembly / assemblyJarName := s"${name.value}-${version.value}.jar",
// scalafixがsemanticdbを必要とする
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
scalacOptions ++= Seq(
"-encoding",
"utf8",
"-unchecked",
"-language:higherKinds",
"-deprecation",
"-Ypatmat-exhaust-depth",
"320",
"-Ymacro-annotations",
"-Ywarn-unused"
),
javacOptions ++= Seq("-encoding", "utf8"),
// build.sbtそのほかビルドの設定が変わったときにsbtを自動リロードさせる
Global / onChangedBuildSource := ReloadOnSourceChanges,
// テストが落ちた時にスタックトレースを表示する
Compile / testOptions += Tests.Argument("-oS")
)
// endregion