-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to gradle, java 17 and fix examples
- Loading branch information
1 parent
7123bf9
commit 0f28b75
Showing
22 changed files
with
587 additions
and
326 deletions.
There are no files selected for viewing
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,39 @@ | ||
name: Java CI with Gradle | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
# Only run on PRs if the source branch is on someone else's repo | ||
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
# See https://github.com/actions/checkout/commits | ||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | ||
|
||
- name: Validate Gradle wrapper | ||
# See https://github.com/gradle/wrapper-validation-action/commits | ||
uses: gradle/wrapper-validation-action@342dbebe7272035434f9baccc29a816ec6dd2c7b | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK 17 | ||
# See https://github.com/actions/setup-java/commits | ||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build |
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
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 |
---|---|---|
@@ -1,13 +1,31 @@ | ||
bin | ||
lib | ||
target | ||
testing | ||
# Compiled plugin files | ||
target/ | ||
|
||
.settings | ||
# IDE files | ||
.idea/ | ||
.vscode/* | ||
.settings/* | ||
*.iml | ||
*.iws | ||
*.ipr | ||
.classpath | ||
.project | ||
.directory | ||
.factorypath | ||
|
||
*.iml | ||
.idea | ||
# UML | ||
*.plantuml | ||
|
||
# Gradle | ||
.gradle | ||
**/build/ | ||
!src/**/build/ | ||
**/run/ | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
# Cache of project | ||
.gradletasknamecache |
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
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,117 @@ | ||
plugins { | ||
idea | ||
`java-library` | ||
`maven-publish` | ||
id("net.kyori.indra") version "3.1.3" | ||
id("net.kyori.indra.git") version "3.1.3" | ||
id("net.kyori.indra.publishing") version "3.1.3" | ||
id("net.kyori.indra.checkstyle") version "3.1.3" | ||
id("io.freefair.lombok") version "8.4" | ||
} | ||
|
||
indra { | ||
github("GeyserMC", "MCProtocolLib") | ||
|
||
mitLicense() | ||
publishReleasesTo("opencollab-release-repo", "https://repo.opencollab.dev/maven-releases/") | ||
publishSnapshotsTo("opencollab-snapshot-repo", "https://repo.opencollab.dev/maven-snapshots/") | ||
|
||
configurePublications { | ||
pom { | ||
name.set("MCProtocolLib") | ||
url.set("https://github.com/GeyserMC/MCProtocolLib/") | ||
organization { | ||
name.set("GeyserMC") | ||
url.set("https://github.com/GeyserMC") | ||
} | ||
developers { | ||
developer { | ||
id.set("steveice10") | ||
name.set("Steveice10") | ||
email.set("Steveice10@gmail.com") | ||
} | ||
developer { | ||
id.set("GeyserMC") | ||
name.set("GeyserMC") | ||
url.set("https://geysermc.org/") | ||
} | ||
} | ||
} | ||
|
||
versionMapping { | ||
usage(Usage.JAVA_API) { fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) } | ||
usage(Usage.JAVA_RUNTIME) { fromResolutionResult() } | ||
} | ||
} | ||
|
||
javaVersions { | ||
target(17) | ||
strictVersions() | ||
testWith(17) | ||
minimumToolchain(17) | ||
} | ||
} | ||
|
||
val repoName = if (version.toString().endsWith("SNAPSHOT")) "maven-snapshots" else "maven-releases" | ||
publishing { | ||
repositories { | ||
maven("https://repo.opencollab.dev/${repoName}/") { | ||
credentials.username = System.getenv("OPENCOLLAB_USERNAME") | ||
credentials.password = System.getenv("OPENCOLLAB_PASSWORD") | ||
name = "opencollab" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
// Minecraft related libraries | ||
api("com.github.steveice10:opennbt:1.6") | ||
api("com.github.GeyserMC:mcauthlib:6621fd0") | ||
|
||
// Kyori adventure | ||
api("net.kyori:adventure-text-serializer-gson:4.14.0") | ||
api("net.kyori:adventure-text-serializer-gson-legacy-impl:4.14.0") | ||
|
||
// Math utilities | ||
api("org.cloudburstmc.math:api:2.0") | ||
api("org.cloudburstmc.math:immutable:2.0") | ||
|
||
// Stripped down fastutil | ||
api("com.nukkitx.fastutil:fastutil-object-int-maps:8.5.3") | ||
api("com.nukkitx.fastutil:fastutil-int-object-maps:8.5.3") | ||
|
||
// Netty | ||
api("io.netty:netty-all:4.1.99.Final") | ||
api("io.netty:netty-codec-haproxy:4.1.99.Final") | ||
api("io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.23.Final") | ||
|
||
// Lombok | ||
compileOnly("org.projectlombok:lombok:1.18.30") | ||
annotationProcessor("org.projectlombok:lombok:1.18.30") | ||
|
||
// Test dependencies | ||
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") | ||
} | ||
|
||
group = "com.github.steveice10" | ||
version = "1.20.2-1-SNAPSHOT" | ||
description = "MCProtocolLib is a simple library for communicating with Minecraft clients and servers." | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
options.compilerArgs.add("-Xlint:all,-serial,-processing") | ||
} | ||
|
||
tasks.withType<Javadoc> { | ||
options.encoding = "UTF-8" | ||
title = "MCProtocolLib Javadocs" | ||
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet") | ||
} | ||
|
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,7 @@ | ||
plugins { | ||
java | ||
} | ||
|
||
dependencies { | ||
implementation(rootProject) | ||
} |
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
Binary file not shown.
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,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.