Skip to content

Commit 9a3507f

Browse files
authored
Merge pull request #176 from AzisabaNetwork/feat/migrate-to-gradle
Migrate to gradle
2 parents 8dd25f3 + 60b4ba3 commit 9a3507f

File tree

18 files changed

+681
-38
lines changed

18 files changed

+681
-38
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,24 @@ jobs:
1818
permissions:
1919
contents: read
2020
steps:
21-
- uses: actions/checkout@v3
22-
- uses: actions/setup-java@v3
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
2323
with:
2424
java-version: "8"
25-
distribution: "adopt"
26-
cache: "maven"
25+
distribution: "temurin"
26+
2727
- run: java -version
28-
- run: mvn --version
29-
- run: mvn -B package
28+
29+
- name: Setup Gradle
30+
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
31+
with:
32+
validate-wrappers: true
33+
34+
- name: Build with Gradle
35+
run: ./gradlew build
36+
37+
- name: Upload artifacts
38+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
39+
with:
40+
name: artifacts
41+
path: build/libs/*.jar

.github/workflows/deploy.yml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,30 @@ name: Deploy
33
on:
44
workflow_dispatch:
55
push:
6-
branches:
7-
- main
8-
paths-ignore:
9-
- "**.md"
10-
- "renovate.json"
6+
tags:
7+
- "*"
118

129
jobs:
1310
build:
1411
runs-on: ubuntu-latest
1512
permissions:
1613
contents: read
1714
steps:
18-
- uses: actions/checkout@v3
19-
- name: Set up JDK 8
20-
uses: actions/setup-java@v3
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
- uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
2117
with:
22-
java-version: '8'
23-
distribution: 'adopt'
24-
server-id: azisaba
25-
- name: Build with Maven
26-
run: mvn -B package --file pom.xml
27-
- name: Prepare settings.xml
28-
run: |
29-
echo "<settings><servers><server><id>azisaba</id><username>${{ secrets.REPO_USERNAME }}</username><password>${{ secrets.REPO_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
30-
- name: Deploy
31-
run: mvn deploy
18+
java-version: "8"
19+
distribution: "temurin"
20+
21+
- run: java -version
22+
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
25+
with:
26+
validate-wrappers: true
27+
28+
- name: Publish to azisaba repo
29+
run: ./gradlew publish
30+
env:
31+
REPO_USERNAME: ${{ secrets.REPO_USERNAME }}
32+
REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }}

.gitignore

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,30 @@ buildNumber.properties
114114
# JDT-specific (Eclipse Java Development Tools)
115115
.classpath
116116

117-
# End of https://www.toptal.com/developers/gitignore/api/maven,intellij+all
117+
# End of https://www.toptal.com/developers/gitignore/api/maven,intellij+all
118+
119+
# Created by https://www.toptal.com/developers/gitignore/api/gradle
120+
# Edit at https://www.toptal.com/developers/gitignore?templates=gradle
121+
122+
### Gradle ###
123+
.gradle
124+
**/build/
125+
!src/**/build/
126+
127+
# Ignore Gradle GUI config
128+
gradle-app.setting
129+
130+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
131+
!gradle-wrapper.jar
132+
133+
# Avoid ignore Gradle wrappper properties
134+
!gradle-wrapper.properties
135+
136+
# Cache of project
137+
.gradletasknamecache
138+
139+
### Gradle Patch ###
140+
# Java heap dump
141+
*.hprof
142+
143+
# End of https://www.toptal.com/developers/gitignore/api/gradle

.pinact.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/suzuki-shunsuke/pinact/refs/heads/main/json-schema/pinact.json
2+
# pinact - https://github.com/suzuki-shunsuke/pinact
3+
version: 3
4+
# files:
5+
# - pattern: action.yaml
6+
# - pattern: */action.yaml
7+
8+
ignore_actions:
9+
# - name: slsa-framework/slsa-github-generator/\.github/workflows/generator_generic_slsa3\.yml
10+
# ref: v\d+\.\d+\.\d+
11+
# - name: actions/.*
12+
# ref: main
13+
# - name: suzuki-shunsuke/.*
14+
# ref: release-.*

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ RedisとLunaChatを使用して、複数マイクラサーバーのグローバ
2525
4. チャットが共有されていることを確認する
2626

2727
## 設定項目
28-
| Key | Value |
29-
|:---:|:---:|
30-
|server-name|サーバー名。主に個人チャットの際の表示に使用されます|
31-
|redis.*|Redisサーバーの接続情報|
32-
|redis.group|接続するグループ名。同じグループ名が指定されたサーバーのチャットのみ共有されます|
33-
|formats.*|チャットのフォーマットを指定します。チャンネルチャットはそのチャンネルのフォーマット設定が使用されます|
34-
|discord.*|Discordの接続情報を指定します|
28+
| Key | Value |
29+
|:-----------:|:---------------------------------------------------:|
30+
| server-name | サーバー名。主に個人チャットの際の表示に使用されます |
31+
| redis.* | Redisサーバーの接続情報 |
32+
| redis.group | 接続するグループ名。同じグループ名が指定されたサーバーのチャットのみ共有されます |
33+
| formats.* | チャットのフォーマットを指定します。チャンネルチャットはそのチャンネルのフォーマット設定が使用されます |
34+
| discord.* | Discordの接続情報を指定します |
3535

3636
## ライセンス / License
3737
[GNU General Public License v3.0](LICENSE)

build.gradle.kts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
plugins {
2+
`java-library`
3+
`maven-publish`
4+
alias(libs.plugins.shadow)
5+
alias(libs.plugins.lombok)
6+
}
7+
8+
group = "net.azisaba"
9+
version = "4.5.1"
10+
description = "RyuZUPluginChat"
11+
java.sourceCompatibility = JavaVersion.VERSION_1_8
12+
13+
val orgName: String by project
14+
val repoUrl: String by project
15+
16+
repositories {
17+
mavenCentral()
18+
maven("https://oss.sonatype.org/content/groups/public/")
19+
maven("https://repo.azisaba.net/repository/maven-public/")
20+
maven("https://papermc.io/repo/repository/maven-snapshots/")
21+
maven("https://papermc.io/repo/repository/maven-public/")
22+
maven("https://repo.aikar.co/content/groups/aikar/")
23+
maven("https://repo.maven.apache.org/maven2/")
24+
}
25+
26+
dependencies {
27+
implementation(libs.discord4j)
28+
implementation(libs.jedis)
29+
implementation(libs.aikar.taskchain)
30+
implementation(libs.semver4j)
31+
compileOnly(libs.paper.api)
32+
compileOnly(libs.luckperms.api)
33+
compileOnly(libs.lunachatplus)
34+
compileOnly(libs.jetbrains.annotation)
35+
36+
// Test dependencies
37+
testImplementation(platform(libs.junit.bom))
38+
testImplementation(libs.junit.jupiter)
39+
testRuntimeOnly(libs.junit.platform.launcher)
40+
testCompileOnly(libs.jetbrains.annotation)
41+
}
42+
43+
tasks.withType<JavaCompile> {
44+
options.encoding = "UTF-8"
45+
}
46+
47+
tasks.withType<Javadoc> {
48+
options.encoding = "UTF-8"
49+
}
50+
51+
tasks.processResources {
52+
val props =
53+
mapOf(
54+
"name" to name,
55+
"version" to version,
56+
"description" to description,
57+
"orgName" to orgName,
58+
"url" to repoUrl,
59+
)
60+
inputs.properties(props)
61+
filteringCharset = "UTF-8"
62+
filesMatching("plugin.yml") {
63+
expand(props)
64+
}
65+
}
66+
67+
tasks.build {
68+
dependsOn(tasks.shadowJar)
69+
}
70+
71+
tasks.shadowJar {
72+
isEnableRelocation = true
73+
relocationPrefix = "net.azisaba.ryuzupluginchat.dependency"
74+
}
75+
76+
lombok {
77+
version = libs.versions.lombok.asProvider()
78+
}
79+
80+
tasks.test {
81+
useJUnitPlatform()
82+
}
83+
84+
publishing {
85+
publications {
86+
create<MavenPublication>("maven") {
87+
groupId = project.group.toString()
88+
artifactId = project.name
89+
version = project.version.toString()
90+
artifact(tasks.jar)
91+
}
92+
}
93+
94+
repositories {
95+
maven {
96+
name = "azisaba-repo"
97+
credentials {
98+
username = System.getenv("REPO_USERNAME")
99+
password = System.getenv("REPO_PASSWORD")
100+
}
101+
url =
102+
if (project.version.toString().endsWith("-SNAPSHOT")) {
103+
uri("https://repo.azisaba.net/repository/maven-snapshots/")
104+
} else {
105+
uri("https://repo.azisaba.net/repository/maven-releases/")
106+
}
107+
}
108+
}
109+
}

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
org.gradle.configuration-cache=true
2+
3+
name = RyuZUPluginChat
4+
description = Plugin that works with LunaChat, Redis, and Discord(Optional) to share chats between Spigot servers.
5+
orgName = AzisabaNetwork
6+
repoUrl = https://github.com/AzisabaNetwork/RyuZUPluginChat

gradle/libs.versions.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[versions]
2+
# Plugins
3+
shadow = "8.3.6"
4+
lombok-gradle = "8.13.1"
5+
6+
# Libraries
7+
paper-api = "1.15.2-R0.1-SNAPSHOT"
8+
lombok = "1.18.38"
9+
semver4j = "3.1.0"
10+
jedis = "4.3.1"
11+
aikar-taskchain = "3.7.2"
12+
discord4j = "3.2.3"
13+
lunachatplus = "3.3.0"
14+
luckperms-api = "5.4"
15+
jetbrains-annotation = "26.0.2"
16+
junit = "5.13.0"
17+
junit-platform = "1.13.0"
18+
19+
[plugins]
20+
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
21+
lombok = { id = "io.freefair.lombok", version.ref = "lombok-gradle" }
22+
23+
[libraries]
24+
aikar-taskchain = { module = "co.aikar:taskchain-core", version.ref = "aikar-taskchain" }
25+
paper-api = { module = "com.destroystokyo.paper:paper-api", version.ref = "paper-api" }
26+
discord4j = { module = "com.discord4j:discord4j-core", version.ref = "discord4j" }
27+
semver4j = { module = "com.vdurmont:semver4j", version.ref = "semver4j" }
28+
lunachatplus = { module = "net.azisaba:lunachatplus", version.ref = "lunachatplus" }
29+
luckperms-api = { module = "net.luckperms:api", version.ref = "luckperms-api" }
30+
jedis = { module = "redis.clients:jedis", version.ref = "jedis" }
31+
jetbrains-annotation = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotation" }
32+
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
33+
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
34+
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }

gradle/wrapper/gradle-wrapper.jar

42.6 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)