Skip to content

Commit 586dca1

Browse files
committed
feat!: migrate to gradle and refactor
1 parent 6937207 commit 586dca1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1196
-1755
lines changed

.gitignore

Lines changed: 40 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,61 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/intellij,gradle
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,gradle
13

2-
# Created by https://www.gitignore.io/api/maven,eclipse
3-
# Edit at https://www.gitignore.io/?templates=maven,eclipse
4+
### Intellij ###
5+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
6+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
47

5-
### Eclipse ###
6-
.metadata
7-
bin/
8-
tmp/
9-
*.tmp
10-
*.bak
11-
*.swp
12-
*~.nib
13-
local.properties
14-
.settings/
15-
.loadpath
16-
.recommenders
17-
18-
# External tool builders
19-
.externalToolBuilders/
20-
21-
# Locally stored "Eclipse launch configurations"
22-
*.launch
23-
24-
# PyDev specific (Python IDE for Eclipse)
25-
*.pydevproject
8+
# User-specific stuff
9+
.idea/
2610

27-
# CDT-specific (C/C++ Development Tooling)
28-
.cproject
11+
# CMake
12+
cmake-build-*/
2913

30-
# CDT- autotools
31-
.autotools
14+
# File-based project format
15+
*.iws
3216

33-
# Java annotation processor (APT)
34-
.factorypath
17+
# IntelliJ
18+
out/
3519

36-
# PDT-specific (PHP Development Tools)
37-
.buildpath
20+
# mpeltonen/sbt-idea plugin
21+
.idea_modules/
3822

39-
# sbteclipse plugin
40-
.target
23+
# JIRA plugin
24+
atlassian-ide-plugin.xml
4125

42-
# Tern plugin
43-
.tern-project
26+
# Crashlytics plugin (for Android Studio and IntelliJ)
27+
com_crashlytics_export_strings.xml
28+
crashlytics.properties
29+
crashlytics-build.properties
30+
fabric.properties
4431

45-
# TeXlipse plugin
46-
.texlipse
32+
### Gradle ###
33+
.gradle
34+
**/build/
35+
!src/**/build/
4736

48-
# STS (Spring Tool Suite)
49-
.springBeans
37+
# Ignore Gradle GUI config
38+
gradle-app.setting
5039

51-
# Code Recommenders
52-
.recommenders/
40+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
41+
!gradle-wrapper.jar
5342

54-
# Annotation Processing
55-
.apt_generated/
43+
# Avoid ignore Gradle wrappper properties
44+
!gradle-wrapper.properties
5645

57-
# Scala IDE specific (Scala & Java development for Eclipse)
58-
.cache-main
59-
.scala_dependencies
60-
.worksheet
46+
# Cache of project
47+
.gradletasknamecache
6148

62-
### Eclipse Patch ###
49+
# Eclipse Gradle plugin generated files
6350
# Eclipse Core
6451
.project
65-
6652
# JDT-specific (Eclipse Java Development Tools)
6753
.classpath
6854

69-
# Annotation Processing
70-
.apt_generated
71-
72-
.sts4-cache/
55+
### Gradle Patch ###
56+
# Java heap dump
57+
*.hprof
7358

74-
### Maven ###
75-
target/
76-
pom.xml.tag
77-
pom.xml.releaseBackup
78-
pom.xml.versionsBackup
79-
pom.xml.next
80-
release.properties
81-
dependency-reduced-pom.xml
82-
buildNumber.properties
83-
.mvn/timing.properties
84-
.mvn/wrapper/maven-wrapper.jar
59+
# End of https://www.toptal.com/developers/gitignore/api/intellij,gradle
8560

86-
# End of https://www.gitignore.io/api/maven,eclipse
87-
88-
.idea/
89-
*.iml
61+
run/

build.gradle.kts

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
plugins {
2+
`java-library`
3+
`maven-publish`
4+
alias(libs.plugins.shadow)
5+
alias(libs.plugins.runPaper)
6+
}
7+
8+
val targetJavaVersion = 17
9+
version = System.getenv("VERSION") ?: "0.1.0-indev"
10+
11+
// plugin metadata
12+
val plWebsiteUrl: String by project
13+
val plDescription: String by project
14+
15+
repositories {
16+
mavenLocal()
17+
mavenCentral()
18+
maven("https://jitpack.io/")
19+
maven("https://repo.maven.apache.org/maven2/")
20+
maven("https://oss.sonatype.org/content/groups/public/")
21+
maven("https://repo.codemc.io/repository/maven-public/")
22+
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
23+
maven("https://raw.githubusercontent.com/Rayzr522/maven-repo/master/")
24+
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
25+
}
26+
27+
dependencies {
28+
// system
29+
compileOnly(libs.spigotApi)
30+
31+
// config
32+
implementation(libs.configLib)
33+
34+
// cache
35+
implementation(libs.caffeine)
36+
37+
// plugin
38+
compileOnly(libs.playerSettings)
39+
compileOnly(libs.kdStatusReloaded)
40+
compileOnly(libs.decentHolograms)
41+
compileOnly(libs.placeholderApi)
42+
43+
// check
44+
implementation(libs.jspecify)
45+
testImplementation(platform(libs.junitBom))
46+
testImplementation(libs.junitJupiter)
47+
testRuntimeOnly(libs.junitPlatformLauncher)
48+
}
49+
50+
java {
51+
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
52+
sourceCompatibility = javaVersion
53+
targetCompatibility = javaVersion
54+
if (JavaVersion.current() < javaVersion) {
55+
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
56+
}
57+
}
58+
59+
tasks {
60+
build {
61+
dependsOn(shadowJar)
62+
}
63+
64+
processResources {
65+
val props =
66+
mapOf(
67+
"version" to project.version,
68+
"name" to project.name,
69+
"description" to plDescription,
70+
"websiteUrl" to plWebsiteUrl,
71+
)
72+
inputs.properties(props)
73+
filteringCharset = "UTF-8"
74+
filesMatching("plugin.yml") {
75+
expand(props)
76+
}
77+
}
78+
79+
shadowJar {
80+
mergeServiceFiles()
81+
enableAutoRelocation = true
82+
relocationPrefix = "net.azisaba.rankingdisplayer.libs"
83+
}
84+
85+
runServer {
86+
minecraftVersion("1.16.5")
87+
ignoreUnsupportedJvm()
88+
}
89+
90+
compileJava {
91+
options.encoding = "UTF-8"
92+
93+
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) {
94+
options.release.set(targetJavaVersion)
95+
}
96+
}
97+
98+
javadoc {
99+
options.encoding = "UTF-8"
100+
}
101+
}
102+
103+
publishing {
104+
publications {
105+
create<MavenPublication>("maven") {
106+
groupId = project.group.toString()
107+
artifactId = project.name
108+
version = project.version.toString()
109+
artifact(tasks.jar)
110+
}
111+
}
112+
113+
repositories {
114+
maven {
115+
name = "azisaba-repo"
116+
credentials {
117+
username = System.getenv("REPO_USERNAME")
118+
password = System.getenv("REPO_PASSWORD")
119+
}
120+
url =
121+
if (project.version.toString().endsWith("-SNAPSHOT")) {
122+
uri("https://repo.azisaba.net/repository/maven-snapshots/")
123+
} else {
124+
uri("https://repo.azisaba.net/repository/maven-releases/")
125+
}
126+
}
127+
}
128+
}

gradle.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3+
4+
org.gradle.configuration-cache=true
5+
6+
name = RankingDisplayer
7+
group = net.azisaba
8+
description = Show your ranking in game
9+
10+
plDescription = Display kill ranking plugin
11+
plWebsiteUrl = https://github.com/AzisabaNetwork/RankingDisplayer

gradle/libs.versions.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[versions]
2+
# plugin
3+
shadow = "9.1.0"
4+
runPaper = "3.0.0"
5+
6+
# library
7+
spigotApi = "1.16.5-R0.1-SNAPSHOT"
8+
configLib = "4.6.1"
9+
caffeine = "3.2.2"
10+
kdStatusReloaded = "2.1.0"
11+
playerSettings = "1.0.0"
12+
decentHolograms = "2.8.11"
13+
placeholderApi = "2.11.6"
14+
jspecify = "1.0.0"
15+
junit = "5.13.4"
16+
17+
[plugins]
18+
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
19+
runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" }
20+
21+
[libraries]
22+
# system
23+
spigotApi = { module = "org.spigotmc:spigot-api", version.ref = "spigotApi" }
24+
25+
# config
26+
configLib = { module = "de.exlll:configlib-yaml", version.ref = "configLib" }
27+
28+
# cache
29+
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
30+
31+
# plugin
32+
kdStatusReloaded = { module = "com.github.AzisabaNetwork:KDStatusReloaded", version.ref = "kdStatusReloaded" }
33+
playerSettings = { module = "com.github.AzisabaNetwork:PlayerSettings", version.ref = "playerSettings" }
34+
decentHolograms = { module = "com.github.decentsoftware-eu:decentholograms", version.ref = "decentHolograms" }
35+
placeholderApi = { module = "me.clip:placeholderapi", version.ref = "placeholderApi" }
36+
37+
# check
38+
jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }
39+
junitBom = { module = "org.junit:junit-bom", version.ref = "junit" }
40+
junitJupiter = { module = "org.junit.jupiter:junit-jupiter" }
41+
junitPlatformLauncher = { module = "org.junit.platform:junit-platform-launcher" }

gradle/wrapper/gradle-wrapper.jar

42.7 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-9.0.0-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)