Skip to content

Commit

Permalink
Convert maven to Gradle
Browse files Browse the repository at this point in the history
* Convert AEF from maven to Gradle
* Downgrade `caffeine` version from 3.1.8 -> 2.9.3 for `AnarchyExploitFixesLegacy`, for Java 8 compatibility
  • Loading branch information
Dreeam-qwq committed Dec 14, 2023
1 parent b51708f commit 6953539
Show file tree
Hide file tree
Showing 16 changed files with 549 additions and 401 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/maven.yml → .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ jobs:
with:
java-version: 17
distribution: temurin
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
# Artifact name
name: AnarchyExploitFixes
# A file, directory or wildcard pattern that describes what to upload
path: AnarchyExploitFixesLegacy/target/AnarchyExploitFixes-Legacy*.jar
path: AnarchyExploitFixesLegacy/build/libs/AnarchyExploitFixes-Legacy*.jar
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
# Artifact name
name: AnarchyExploitFixes
# A file, directory or wildcard pattern that describes what to upload
path: AnarchyExploitFixesFolia/target/AnarchyExploitFixes-Folia*.jar
path: AnarchyExploitFixesFolia//build/libs/AnarchyExploitFixes-Folia*.jar
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
*.jar
hs_err_pid*

# Maven
target/
# Gradle
.gradle/
build/

# IntelliJ
.idea
Expand Down
36 changes: 36 additions & 0 deletions AnarchyExploitFixesFolia/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id("me.moomoo.anarchyexploitfixes.wrapper")
id("com.github.johnrengelman.shadow") version "8.1.1"
}

dependencies {
compileOnly("dev.folia:folia-api:1.20.2-R0.1-SNAPSHOT")
api("com.github.ben-manes.caffeine:caffeine:3.1.8") // Fast caching
}

configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
archiveFileName = "${rootProject.name}-${project.name}-${project.version}.${archiveExtension.get()}"
exclude(
"LICENSE",
"module-info.class",
"META-INF/MANIFEST.MF",
"META-INF/LICENSE",
"META-INF/LICENSE.txt",
"META-INF/NOTICE.txt",
"com/cryptomorin/xseries/XBiome*",
"com/cryptomorin/xseries/XEntity*",
"com/cryptomorin/xseries/XPotion*",
"com/cryptomorin/xseries/NMSExtras*",
"com/cryptomorin/xseries/NoteBlockMusic*",
"com/cryptomorin/xseries/SkullCacheListener*"
)
relocate("com.github.benmanes.caffeine", "me.moomoo.anarchyexploitfixes.caffeine")
relocate("io.papermc.lib", "me.moomoo.anarchyexploitfixes.paperlib")
relocate("de.tr7zw.changeme.nbtapi", "me.moomoo.anarchyexploitfixes.nbtapi")
relocate("org.bstats", "me.moomoo.anarchyexploitfixes.bstats")
}
95 changes: 0 additions & 95 deletions AnarchyExploitFixesFolia/pom.xml

This file was deleted.

6 changes: 3 additions & 3 deletions AnarchyExploitFixesFolia/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: AnarchyExploitFixes
version: ${project.version}
version: ${version}
main: me.moomoo.anarchyexploitfixes.AnarchyExploitFixes
authors: [ moo, xGinko ]
description: ${project.description}
description: ${description}
softdepend: [ ProtocolLib ]
api-version: '1.19'
folia-supported: true
website: ${project.url}
website: ${url}

permissions:
anarchyexploitfixes.*:
Expand Down
38 changes: 38 additions & 0 deletions AnarchyExploitFixesLegacy/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id("me.moomoo.anarchyexploitfixes.wrapper")
id("com.github.johnrengelman.shadow") version "8.1.1"
}

dependencies {
compileOnly("com.destroystokyo.paper:paper-api:1.12.2-R0.1-SNAPSHOT")
api("com.github.cryptomorin:XSeries:9.6.0") // XSeries for cross-version support
api("com.github.ben-manes.caffeine:caffeine:2.9.3") // Fast caching // Use 2.x for Java8 compatibility
}

configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
archiveFileName = "${rootProject.name}-${project.name}-${project.version}.${archiveExtension.get()}"
exclude(
"LICENSE",
"module-info.class",
"META-INF/MANIFEST.MF",
"META-INF/LICENSE",
"META-INF/LICENSE.txt",
"META-INF/NOTICE.txt",
"com/cryptomorin/xseries/XBiome*",
"com/cryptomorin/xseries/XEntity*",
"com/cryptomorin/xseries/XPotion*",
"com/cryptomorin/xseries/NMSExtras*",
"com/cryptomorin/xseries/NoteBlockMusic*",
"com/cryptomorin/xseries/SkullCacheListener*"
)
relocate("com.github.benmanes.caffeine", "me.moomoo.anarchyexploitfixes.caffeine")
relocate("io.papermc.lib", "me.moomoo.anarchyexploitfixes.paperlib")
relocate("de.tr7zw.changeme.nbtapi", "me.moomoo.anarchyexploitfixes.nbtapi")
relocate("org.bstats", "me.moomoo.anarchyexploitfixes.bstats")
relocate("com.cryptomorin.xseries", "me.moomoo.anarchyexploitfixes.xseries")
}
105 changes: 0 additions & 105 deletions AnarchyExploitFixesLegacy/pom.xml

This file was deleted.

6 changes: 3 additions & 3 deletions AnarchyExploitFixesLegacy/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: AnarchyExploitFixes
version: ${project.version}
version: ${version}
main: me.moomoo.anarchyexploitfixes.AnarchyExploitFixes
authors: [ moo, xGinko ]
description: ${project.description}
description: ${description}
softdepend: [ ProtocolLib ]
api-version: 1.13
website: ${project.url}
website: ${url}
folia-supported: false

permissions:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ latest build, and download the artifact.

`git clone https://github.com/moom0o/AnarchyExploitFixes.git`

Run `mvn package`
Run `./gradlew clean build`

## Servers using AEF:

Expand Down
9 changes: 9 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
// Support convention plugins written in Kotlin. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build.
`kotlin-dsl`
}

repositories {
// Use the plugin portal to apply community plugins in convention plugins.
gradlePluginPortal()
}
Loading

0 comments on commit 6953539

Please sign in to comment.