forked from CloudburstMC/Nukkit
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
262 additions
and
573 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Java CI | ||
|
||
on: [push, workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
name: Java ${{ matrix.java }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
java: | ||
[ | ||
21, | ||
] | ||
steps: | ||
# Checkout side by side | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: Nukkit | ||
submodules: true | ||
- name: Checkout Network repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: EaseCation/Network | ||
path: Network | ||
# TODO: Remove if merge | ||
ref: gradle | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: temurin | ||
cache: 'gradle' | ||
- name: Build with Gradle | ||
working-directory: Nukkit | ||
run: gradle shadowJar | ||
- name: Archive artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: success() | ||
with: | ||
name: Nukkit-${{ matrix.java }} | ||
path: Nukkit/build/libs/nukkit-1.0.0-all.jar |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,4 @@ logs | |
logs/* | ||
resource_packs | ||
resource_packs/* | ||
.gradle |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,14 +29,29 @@ Links | |
|
||
Build JAR file | ||
------------- | ||
- `git submodule update --init` | ||
- `mvn clean package` | ||
|
||
The compiled JAR can be found in the `target/` directory. | ||
First, clone this project. | ||
Then please also clone [EaseCation/Network]([email protected]:EaseCation/Network.git) next to this project as the graph following: | ||
|
||
```plaintext | ||
root | ||
├── Nukkit | ||
└── Network | ||
``` | ||
|
||
For Gradle installation, please refer to this guide: [Installation - Gradle](https://gradle.org/install/). | ||
|
||
Finally, you can run: | ||
|
||
```shell | ||
gradle shadowJar | ||
``` | ||
|
||
The fat jar will be generated at `target/libs/nukkit-1.0.0-all.jar` | ||
|
||
Running | ||
------------- | ||
Simply run `java -jar nukkit-1.0-SNAPSHOT.jar`. | ||
Simply run `java -jar nukkit.jar`. | ||
|
||
Plugin API | ||
------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer | ||
import org.gradle.api.publish.maven.MavenPublication | ||
|
||
plugins { | ||
application | ||
`java-library` | ||
`maven-publish` | ||
alias(libs.plugins.shadow) | ||
alias(libs.plugins.versions) | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { url = uri("https://repo.opencollab.dev/maven-releases/") } | ||
maven { url = uri("https://repo.opencollab.dev/maven-snapshots/") } | ||
} | ||
|
||
group = "cn.nukkit" | ||
description = "Nukkit" | ||
|
||
application { | ||
mainClass = "cn.nukkit.Nukkit" | ||
} | ||
|
||
val shadowJarTask = tasks.named<ShadowJar>("shadowJar") | ||
if (gradle.parent != null) { | ||
val shadow = shadowJarTask.get() | ||
val name = shadow.archiveBaseName.get() | ||
val extension = shadow.archiveExtension.get() | ||
val fileName = "$name.$extension" | ||
val output = shadow.outputs.files.singleFile | ||
val root = rootProject.projectDir.parentFile | ||
|
||
val subtasks = listOf(File(root, "_server"), File(root, "_login"), File(root, "_server1")) | ||
.mapIndexed { idx, dest -> | ||
tasks.register<Copy>("copyShadowJarSubtask$idx") { | ||
from(output) | ||
into(dest) | ||
rename { fileName } | ||
dependsOn(shadowJarTask) | ||
} | ||
} | ||
|
||
tasks.register<DefaultTask>("copyShadowJar") { | ||
group = "copy" | ||
subtasks.forEach { dependsOn(it) } | ||
} | ||
} | ||
|
||
tasks.shadowJar { | ||
transform(Log4j2PluginsCacheFileTransformer::class.java) | ||
exclude("**/module-info.class") | ||
} | ||
|
||
val javaLanguageVersion = JavaLanguageVersion.of(21) | ||
the<JavaPluginExtension>().apply { | ||
toolchain { | ||
languageVersion = javaLanguageVersion | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
tasks.withType<Javadoc> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
|
||
publishing { | ||
publications.create<MavenPublication>("maven") { | ||
from(components["java"]) | ||
} | ||
} | ||
|
||
dependencies { | ||
api("com.nukkitx.network:raknet") | ||
api(libs.apache.commons.compress) | ||
api(libs.apache.commons.lang3) | ||
api(libs.commons.io) | ||
api(libs.fastutil) | ||
api(libs.gson) | ||
api(libs.guava) | ||
api(libs.jackson) | ||
api(libs.jackson.datatype.guava) | ||
api(libs.jackson.datatype.jdk8) | ||
api(libs.jline.reader) | ||
api(libs.jline.terminal) | ||
api(libs.jline.terminal.jna) | ||
api(libs.jopt) | ||
api(libs.jwt) | ||
api(libs.leveldb.mcpe.jni) | ||
api(libs.leveldb.natives) | ||
api(libs.lmax.disruptor) | ||
api(libs.log4j.api) | ||
api(libs.log4j.core) | ||
api(libs.log4j.slf4j2) | ||
api(libs.minecrell.console) | ||
api(libs.org.cloudburstmc.upnp) | ||
api(libs.slf4j.api) | ||
api(libs.snakeyaml) | ||
api(libs.snakeyaml.engine) | ||
api(libs.snappy) | ||
api(libs.zero.allocation.hashing) | ||
testImplementation(libs.jupiter.api) | ||
testImplementation(libs.jupiter.engine) | ||
annotationProcessor(libs.lombok) | ||
annotationProcessor(libs.log4j.core) | ||
compileOnly(libs.lombok) | ||
compileOnly(libs.spotbugs.annotations) | ||
compileOnly(libs.javax.annotations) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[versions] | ||
jackson = "2.17.1" | ||
log4j = "2.23.1" | ||
jupiter = "5.10.2" | ||
|
||
[plugins] | ||
shadow = { id = "com.gradleup.shadow", version = "8.3.6" } | ||
versions = { id = "com.github.ben-manes.versions", version = "0.52.0" } | ||
|
||
[libraries] | ||
apache-commons-compress = { module = "org.apache.commons:commons-compress", version = "1.26.0" } | ||
apache-commons-lang3 = { module = "org.apache.commons:commons-lang3", version = "3.14.0" } | ||
commons-io = { module = "commons-io:commons-io", version = "2.15.1" } | ||
expiringmap = { module = "net.jodah:expiringmap", version = "0.5.11" } | ||
fastutil = { module = "it.unimi.dsi:fastutil", version = "8.5.12" } | ||
gson = { module = "com.google.code.gson:gson", version = "2.10.1" } | ||
guava = { module = "com.google.guava:guava", version = "33.0.0-jre" } | ||
jackson = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" } | ||
jackson-datatype-guava = { module = "com.fasterxml.jackson.datatype:jackson-datatype-guava", version.ref = "jackson" } | ||
jackson-datatype-jdk8 = { module = "com.fasterxml.jackson.datatype:jackson-datatype-jdk8", version.ref = "jackson" } | ||
javax-annotations = { module = "javax.annotation:javax.annotation-api", version = "1.3.2" } | ||
jaxb-api = { module = "javax.xml.bind:jaxb-api", version = "2.3.1" } | ||
jaxb-runtime = { module = "org.glassfish.jaxb:jaxb-runtime", version = "4.0.3" } | ||
jline-reader = { module = "org.jline:jline-reader", version = "3.25.1" } | ||
jline-terminal = { module = "org.jline:jline-terminal", version = "3.25.1" } | ||
jline-terminal-jna = { module = "org.jline:jline-terminal-jna", version = "3.25.1" } | ||
jopt = { module = "net.sf.jopt-simple:jopt-simple", version = "5.0.4" } | ||
jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "jupiter" } | ||
jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "jupiter" } | ||
jwt = { module = "com.nimbusds:nimbus-jose-jwt", version = "9.37.3" } | ||
leveldb-mcpe-jni = { module = "net.daporkchop:leveldb-mcpe-jni", version = "0.0.10-SNAPSHOT" } | ||
leveldb-natives = { module = "net.daporkchop.lib:natives", version = "0.5.8-SNAPSHOT" } | ||
lmax-disruptor = { module = "com.lmax:disruptor", version = "4.0.0" } | ||
log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4j" } | ||
log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } | ||
log4j-slf4j2 = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version.ref = "log4j" } | ||
lombok = { module = "org.projectlombok:lombok", version = "1.18.30" } | ||
minecrell-console = { module = "net.minecrell:terminalconsoleappender", version = "1.3.0" } | ||
org-cloudburstmc-upnp = { module = "org.cloudburstmc:upnp", version = "1.1.1" } | ||
org-msgpack-msgpack-core = { module = "org.msgpack:msgpack-core", version = "0.9.8" } | ||
slf4j-api = { module = "org.slf4j:slf4j-api", version = "2.0.12" } | ||
snakeyaml = { module = "org.yaml:snakeyaml", version = "2.2" } | ||
snakeyaml-engine = { module = "org.snakeyaml:snakeyaml-engine", version = "2.7" } | ||
snappy = { module = "org.xerial.snappy:snappy-java", version = "1.1.10.5" } | ||
spotbugs-annotations = { module = "com.github.spotbugs:spotbugs-annotations", version = "4.9.1" } | ||
zero-allocation-hashing = { module = "net.openhft:zero-allocation-hashing", version = "0.16" } |
Oops, something went wrong.