Skip to content

Commit b82e609

Browse files
Initial project setup with Gradle and plugin scaffold
Add Gradle build scripts, wrapper, and configuration for a Kotlin JVM project targeting Java 25. Include basic .gitignore, clean scripts for build artifacts, and a minimal HytlDev plugin class with manifest for the htyl.dev serverlist.
0 parents  commit b82e609

12 files changed

Lines changed: 560 additions & 0 deletions

File tree

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
7+
### IntelliJ IDEA ###
8+
.idea/modules.xml
9+
.idea/jarRepositories.xml
10+
.idea/compiler.xml
11+
.idea/libraries/
12+
*.iws
13+
*.iml
14+
*.ipr
15+
out/
16+
!**/src/main/**/out/
17+
!**/src/test/**/out/
18+
19+
### Kotlin ###
20+
.kotlin
21+
22+
### Eclipse ###
23+
.apt_generated
24+
.classpath
25+
.factorypath
26+
.project
27+
.settings
28+
.springBeans
29+
.sts4-cache
30+
bin/
31+
!**/src/main/**/bin/
32+
!**/src/test/**/bin/
33+
34+
### NetBeans ###
35+
/nbproject/private/
36+
/nbbuild/
37+
/dist/
38+
/nbdist/
39+
/.nb-gradle/
40+
41+
### VS Code ###
42+
.vscode/
43+
44+
### Mac OS ###
45+
.DS_Store
46+
.idea/

build.gradle.kts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.apache.tools.ant.taskdefs.condition.Os
3+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4+
import java.util.Calendar
5+
import java.util.TimeZone
6+
7+
plugins {
8+
val kotlin_version: String by System.getProperties()
9+
kotlin("jvm").version(kotlin_version)
10+
11+
id("com.gradleup.shadow") version "8.3.6"
12+
}
13+
14+
val kotlin_version: String by System.getProperties()
15+
val ktor_version: String by project
16+
17+
group = "cc.modlabs"
18+
version = System.getenv("VERSION_OVERRIDE") ?: Calendar.getInstance(TimeZone.getTimeZone("UTC")).run {
19+
"${get(Calendar.YEAR)}.${get(Calendar.MONTH) + 1}.${get(Calendar.DAY_OF_MONTH)}.${
20+
String.format("%02d%02d", get(Calendar.HOUR_OF_DAY), get(Calendar.MINUTE))
21+
}"
22+
}
23+
24+
repositories {
25+
maven("https://nexus.modlabs.cc/repository/maven-mirrors/")
26+
}
27+
28+
val shadowDependencies = listOf(
29+
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",
30+
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version",
31+
"io.ktor:ktor-client-core:$ktor_version",
32+
"io.ktor:ktor-client-cio:$ktor_version"
33+
//"cc.modlabs:ktale:${project.ext["ktaleVersion"] as String}",
34+
//"cc.modlabs:KlassicX:2025.12.4.1928"
35+
)
36+
37+
dependencies {
38+
testImplementation(kotlin("test"))
39+
implementation("com.hypixel.hytale:Server:2026.01.13-dcad8778f")
40+
41+
shadowDependencies.forEach {
42+
shadow(it)
43+
implementation(it)
44+
}
45+
}
46+
47+
tasks.test {
48+
useJUnitPlatform()
49+
}
50+
kotlin {
51+
jvmToolchain {
52+
languageVersion.set(JavaLanguageVersion.of(25))
53+
}
54+
55+
compilerOptions {
56+
jvmTarget.set(JvmTarget.JVM_25)
57+
}
58+
59+
}
60+
61+
java {
62+
toolchain {
63+
languageVersion.set(JavaLanguageVersion.of(25))
64+
}
65+
}
66+
67+
val cleanArtifacts = tasks.register<Exec>("cleanArtifacts") {
68+
group = "build"
69+
description = "Runs cleanlibs.bat on Windows or cleanlibs.sh on *nix before build"
70+
workingDir = project.rootDir
71+
// choose the right command based on OS
72+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
73+
commandLine("cmd", "/c", "cleanlibs.bat")
74+
} else {
75+
commandLine("sh", "cleanlibs.sh")
76+
}
77+
}
78+
79+
tasks {
80+
jar {
81+
dependsOn(cleanArtifacts)
82+
}
83+
84+
build {
85+
dependsOn("shadowJar")
86+
}
87+
88+
withType<ProcessResources> {
89+
filesMatching("manifest.json") {
90+
expand(
91+
"version" to project.version,
92+
"name" to project.name,
93+
)
94+
}
95+
}
96+
97+
withType<ShadowJar> {
98+
mergeServiceFiles()
99+
configurations = listOf(project.configurations.shadow.get())
100+
archiveFileName.set(project.name + "-" + project.version + "-shaded.jar")
101+
exclude("_COROUTINE/**")
102+
}
103+
}

cleanlibs.bat

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@echo off
2+
REM Define the target directory
3+
set "TARGET_DIR=.\build\libs"
4+
5+
REM Check if the directory exists
6+
if not exist "%TARGET_DIR%" (
7+
echo The directory %TARGET_DIR% does not exist.
8+
exit /b 1
9+
)
10+
11+
REM Delete all .jar files in the directory
12+
del /f /q "%TARGET_DIR%\*.jar"
13+
14+
REM Confirm the operation
15+
echo All .jar files in %TARGET_DIR% have been deleted.

cleanlibs.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Define the target directory
4+
TARGET_DIR="./build/libs"
5+
6+
# Check if the directory exists
7+
if [ ! -d "$TARGET_DIR" ]; then
8+
echo "The directory $TARGET_DIR does not exist."
9+
exit 1
10+
fi
11+
12+
# Delete all .jar files in the directory
13+
find "$TARGET_DIR" -maxdepth 1 -type f -name "*.jar" -exec rm -f {} \;
14+
15+
# Confirm the operation
16+
echo "All .jar files in $TARGET_DIR have been deleted."

gradle.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
kotlin.code.style=official
2+
3+
systemProp.kotlin_version = 2.3.0
4+
5+
# Utility Dependencies
6+
fruxzAscendVersion=2025.6-85272c2
7+
klassicXVersion=2025.12.16.1611
8+
ktaleVersion=2026.1.16.0954
9+
10+
# External JVM Dependencies
11+
ktor_version=3.3.3

gradle/wrapper/gradle-wrapper.jar

59.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Tue Jan 13 17:49:07 CET 2026
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)