Skip to content

Commit

Permalink
Merge pull request #1414 from GiganticMinecraft/develop
Browse files Browse the repository at this point in the history
バージョン 35 リリース
Lucky3028 authored Mar 3, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 7116600 + 6736d7e commit ca01f1d
Showing 554 changed files with 13,696 additions and 9,104 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ on:

jobs:
build_test_and_upload:
env:
BUILD_ENVIRONMENT_IS_CI_OR_LOCAL: "CI"
runs-on: ubuntu-20.04
container: ghcr.io/giganticminecraft/seichiassist-builder:1a64049
steps:
@@ -79,6 +81,12 @@ jobs:
touch -t "$timestamp" $proto
done
- name: Check format with Scalafmt
run: sbt scalafmtCheckAll

- name: Check lint with Scalafix
run: sbt "scalafix --check"

- name: Test and build artifact
run: sbt assembly

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
/project/target
/project/project
/target
.bsp/

# Local files
deployLocal.sh
8 changes: 8 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rules = [
NoAutoTupling,
RemoveUnused,
DisableSyntax,
LeakingImplicitClassVal,
NoValInForComprehension,
ProcedureSyntax,
]
29 changes: 29 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version = 3.4.3
preset=IntelliJ
runner.dialect = scala213

maxColumn = 96

includeNoParensInSelectChains = true

optIn {
breakChainOnFirstMethodDot = false
forceBlankLineBeforeDocstring = true
}

newlines {
beforeCurlyLambdaParams = multilineWithCaseOnly
afterCurlyLambda = squash
implicitParamListModifierPrefer = before
sometimesBeforeColonInMethodReturnType = true
}

assumeStandardLibraryStripMargin = true
align.stripMargin = true

docstrings {
style = Asterisk
oneline = unfold
}

trailingCommas = never
122 changes: 82 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -3,13 +3,45 @@ import sbt.Keys.baseDirectory

import java.io._

// region 全プロジェクト共通のメタデータ

ThisBuild / scalaVersion := "2.13.1"
// ThisBuild / version はGitHub Actionsによって自動更新される
// ThisBuild / version はGitHub Actionsによって取得/自動更新される
// 次の行は ThisBuild / version := "(\d*)" の形式でなければならない。
ThisBuild / version := "34"
ThisBuild / version := "35"
ThisBuild / organization := "click.seichi"
ThisBuild / description := "ギガンティック☆整地鯖の独自要素を司るプラグイン"

// Scalafixが要求するため、semanticdbは有効化する
ThisBuild / semanticdbEnabled := true

// endregion

// region 雑多な設定

// kind-projector 構文を使いたいため
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.13.2" cross CrossVersion.full)

// Scalafixがsemanticdbを必要とするため
ThisBuild / semanticdbEnabled := true

// CIビルドで詳細なログを確認するため
ThisBuild / logLevel := {
if (scala.sys.env.get("BUILD_ENVIRONMENT_IS_CI_OR_LOCAL").contains("CI")) {
Level.Debug
} else {
Level.Info
}
}

// テストが落ちた時にスタックとレースを表示するため。
// ScalaTest のオプションは https://www.scalatest.org/user_guide/using_the_runner を参照のこと。
Compile / testOptions += Tests.Argument("-oS")

// endregion

// region 依存関係

resolvers ++= Seq(
"jitpack.io" at "https://jitpack.io",
"maven.sk89q.com" at "https://maven.sk89q.com/repo/",
@@ -75,28 +107,31 @@ val dependenciesToEmbed = Seq(
"com.beachape" %% "enumeratum" % "1.5.13",

// protobuf
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion,
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion
)

addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.13.2" cross CrossVersion.full)
// endregion

// region assemblyで含む依存関係の処理

// localDependenciesはprovidedとして扱い、jarに埋め込まない
assembly / assemblyExcludedJars := {
(assembly / fullClasspath).value
.filter { a =>
def directoryContainsFile(directory: File, file: File) =
file.absolutePath.startsWith(directory.absolutePath)
(assembly / fullClasspath).value.filter { a =>
def directoryContainsFile(directory: File, file: File) =
file.absolutePath.startsWith(directory.absolutePath)

directoryContainsFile(baseDirectory.value / "localDependencies", a.data)
}
directoryContainsFile(baseDirectory.value / "localDependencies", a.data)
}
}

val tokenReplacementMap = settingKey[Map[String, String]]("Map specifying what tokens should be replaced to")
// endregion

tokenReplacementMap := Map(
"name" -> name.value,
"version" -> version.value
)
// region プラグインJarに埋め込むリソースの処理

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")

@@ -106,7 +141,8 @@ Compile / filteredResourceGenerator :=
filterResources(
filesToBeReplacedInResourceFolder,
tokenReplacementMap.value,
(Compile / resourceManaged).value, (Compile / resourceDirectory).value
(Compile / resourceManaged).value,
(Compile / resourceDirectory).value
)

Compile / resourceGenerators += (Compile / filteredResourceGenerator)
@@ -115,33 +151,39 @@ Compile / unmanagedResources += baseDirectory.value / "LICENSE"

// トークン置換を行ったファイルをunmanagedResourcesのコピーから除外する
unmanagedResources / excludeFilter :=
filesToBeReplacedInResourceFolder.foldLeft((unmanagedResources / excludeFilter).value)(_.||(_))
filesToBeReplacedInResourceFolder.foldLeft((unmanagedResources / excludeFilter).value)(
_.||(_)
)

// endregion

logLevel := Level.Debug
// region ScalaPBの設定

// ScalaPBの設定
Compile / PB.protoSources := Seq(baseDirectory.value / "protocol")
Compile / PB.targets := Seq(scalapb.gen() -> (Compile / sourceManaged).value / "scalapb")

Compile / testOptions += Tests.Argument("-oS")
// endregion

// region 各プロジェクトの設定

lazy val root = (project in file(".")).settings(
name := "SeichiAssist",
assembly / assemblyOutputPath := baseDirectory.value / "target" / "build" / s"SeichiAssist.jar",
libraryDependencies := providedDependencies ++ testDependencies ++ dependenciesToEmbed,
excludeDependencies := Seq(ExclusionRule(organization = "org.bukkit", name = "bukkit")),
unmanagedBase := baseDirectory.value / "localDependencies",
scalacOptions ++= Seq(
"-encoding",
"utf8",
"-unchecked",
"-language:higherKinds",
"-deprecation",
"-Ypatmat-exhaust-depth",
"320",
"-Ymacro-annotations",
"-Ywarn-unused"
),
javacOptions ++= Seq("-encoding", "utf8")
)

lazy val root = (project in file("."))
.settings(
name := "SeichiAssist",
assembly / assemblyOutputPath := baseDirectory.value / "target" / "build" / s"SeichiAssist.jar",
libraryDependencies := providedDependencies ++ testDependencies ++ dependenciesToEmbed,
excludeDependencies := Seq(
ExclusionRule(organization = "org.bukkit", name = "bukkit")
),
unmanagedBase := baseDirectory.value / "localDependencies",
scalacOptions ++= Seq(
"-encoding", "utf8",
"-unchecked",
"-language:higherKinds",
"-deprecation",
"-Ypatmat-exhaust-depth", "320",
"-Ymacro-annotations",
"-Ywarn-unused",
),
javacOptions ++= Seq("-encoding", "utf8")
)
// endregion
7 changes: 7 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
// プラグインJarを(依存関係にあるJarをすべて同梱して)出力するため
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")

// Lintを掛けるため
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")

// コードフォーマットするため
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
6 changes: 5 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -117,6 +117,11 @@ commands:
usage: /<command>
permission-message: *denied
permission: seichiassist.hat
ec:
description: エンダーチェストを開く
usage: /<command>
permission: seichiassist.ec
permission-message: *denied
minestack:
description: Toggle whether minestack collects applicable item automatically
usage: /minestack <on | off>
@@ -148,7 +153,6 @@ permissions:
- seichiassist.fd
- seichiassist.present.*
- seichiassist.hat
- seichiassist.minestack
seichiassist.event:
default: op
seichiassist.shareinv:
Loading

0 comments on commit ca01f1d

Please sign in to comment.