-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
98 lines (76 loc) · 3.34 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
import ResourceFilter.filterResources
import sbt.Keys.baseDirectory
// region Dependencies
resolvers ++= Seq(
"maven.elmakers.com" at "https://maven.elmakers.com/repository/", // spigot
"Sonatype OSS" at "https://s01.oss.sonatype.org/content/groups/public/",
"Multiverse" at "https://repo.onarandombox.com/content/groups/public/"
)
val providedDependencies = Seq(
"org.spigotmc" % "spigot-api" % "1.18.2-R0.1-SNAPSHOT",
"com.onarandombox.multiversecore" % "Multiverse-Core" % "4.3.0"
).map(_ % "provided")
val embeddedDependencies = Seq("com.beachape" %% "enumeratum" % "1.7.5")
val testDependencies = Seq(
"org.scalamock" %% "scalamock" % "6.0.0",
"org.scalatest" %% "scalatest" % "3.2.19",
"org.scalatestplus" %% "scalacheck-1-16" % "3.2.14.0"
).map(_ % "test")
libraryDependencies := providedDependencies ++ embeddedDependencies ++ testDependencies
excludeDependencies ++= Seq(
ExclusionRule(organization = "org.bukkit", name = "bukkit"),
ExclusionRule(organization = "org.bukkit", name = "craftbukkit"),
ExclusionRule(organization = "com.pneumaticraft.commandhandler", name = "CommandHandler")
)
// 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 := "RegenerateWorld",
scalaVersion := "2.13.15",
assembly / assemblyJarName := s"${name.value}-${version.value}.jar",
assembly / test := (Test / test).value, // assmeblyの中でtestをする
// 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