-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to Gradle, set up publishing, get rid of item steerables workaro…
…und (#26) * Gradle changes * init: remove item steerable option * Use javadowngrader to produce Java 8 compatible jars * Address review --------- Co-authored-by: Joshua Castle <[email protected]>
- Loading branch information
1 parent
d9e8af2
commit bde84b0
Showing
39 changed files
with
694 additions
and
891 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 |
---|---|---|
@@ -1,40 +1,68 @@ | ||
name: Build Hurricane | ||
name: Build | ||
|
||
on: push | ||
on: | ||
workflow_dispatch: | ||
push: | ||
paths-ignore: | ||
- '.gitignore' | ||
- 'LICENSE' | ||
- 'README.md' | ||
|
||
jobs: | ||
build-job: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v2 | ||
- name: Setup Gradle | ||
uses: GeyserMC/actions/setup-gradle-composite@master | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
cache: 'maven' | ||
|
||
- name: Prepare NMS 1.17 mappings | ||
run: mvn ca.bkaw:paper-nms-maven-plugin:1.2:init -pl :nms-1_17_R1 | ||
setup-java_java-version: 21 | ||
|
||
- name: Prepare NMS 1.18 mappings | ||
run: mvn ca.bkaw:paper-nms-maven-plugin:1.2:init -pl :nms-1_18_R1 | ||
- name: Build Hurricane | ||
run: ./gradlew build | ||
|
||
- name: Prepare NMS 1.18.2 mappings | ||
run: mvn ca.bkaw:paper-nms-maven-plugin:1.2:init -pl :nms-1_18_R2 | ||
- name: Archive Artifacts | ||
uses: GeyserMC/actions/upload-multi-artifact@master | ||
if: success() | ||
with: | ||
artifacts: | | ||
spigot/build/libs/hurricane-spigot.jar | ||
- name: Prepare NMS 1.19.2 mappings | ||
run: mvn ca.bkaw:paper-nms-maven-plugin:1.2:init -pl :nms-1_19_R1 | ||
- name: Get Version | ||
if: ${{ success() && github.repository == 'GeyserMC/Hurricane' && github.ref_name == 'master' }} | ||
id: get-version | ||
run: | | ||
version=$(cat gradle.properties | grep -o "^version=[0-9\\.]*" | cut -d"=" -f2) | ||
echo "VERSION=${version}" >> $GITHUB_OUTPUT | ||
- name: Prepare NMS 1.19.3 mappings | ||
run: mvn ca.bkaw:paper-nms-maven-plugin:1.2:init -pl :nms-1_19_R2 | ||
- name: Get Release Metadata | ||
if: ${{ success() && github.repository == 'GeyserMC/Hurricane' && github.ref_name == 'master' }} | ||
uses: GeyserMC/actions/release@master | ||
id: metadata | ||
with: | ||
appID: ${{ secrets.RELEASE_APP_ID }} | ||
appPrivateKey: ${{ secrets.RELEASE_APP_PK }} | ||
files: | | ||
spigot:spigot/build/libs/hurricane-spigot.jar | ||
releaseEnabled: false | ||
saveMetadata: true | ||
releaseProject: 'hurricane' | ||
releaseVersion: ${{ steps.get-version.outputs.VERSION }} | ||
|
||
- name: Build with Maven | ||
run: mvn -B package -T 2C | ||
- name: Publish to Downloads API | ||
if: ${{ success() && github.repository == 'GeyserMC/Hurricane' && github.ref_name == 'master' }} | ||
uses: GeyserMC/actions/upload-release@master | ||
with: | ||
username: ${{ vars.DOWNLOADS_USERNAME }} | ||
privateKey: ${{ secrets.DOWNLOADS_PRIVATE_KEY }} | ||
host: ${{ secrets.DOWNLOADS_SERVER_IP }} | ||
files: | | ||
spigot/build/libs/hurricane-spigot.jar | ||
changelog: ${{ steps.metadata.outputs.body }} | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Notify Discord | ||
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/Hurricane' }} | ||
uses: GeyserMC/actions/notify-discord@master | ||
with: | ||
files: spigot/target/Hurricane.jar | ||
discordWebhook: ${{ secrets.DISCORD_WEBHOOK }} | ||
status: ${{ job.status }} | ||
body: ${{ steps.metadata.outputs.body }} |
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
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,13 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation(libs.shadow) | ||
implementation(libs.paperweight) | ||
implementation(libs.javadowngrader) | ||
} |
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,12 @@ | ||
dependencyResolutionManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
} | ||
versionCatalogs { | ||
register("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "build-logic" |
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,15 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.named | ||
|
||
fun Project.relocate(pattern: String) { | ||
tasks.named<ShadowJar>("shadowJar") { | ||
relocate(pattern, "org.geysermc.hurricane.relocations.$pattern") | ||
} | ||
} | ||
|
||
fun Project.exclude(group: String) { | ||
tasks.named<ShadowJar>("shadowJar") { | ||
exclude(group) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
build-logic/src/main/kotlin/hurricane.java-conventions.gradle.kts
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,37 @@ | ||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
} | ||
|
||
repositories { | ||
//mavenLocal() | ||
maven("https://papermc.io/repo/repository/maven-public/") | ||
maven("https://oss.sonatype.org/content/groups/public/") | ||
maven("https://repo.opencollab.dev/maven-releases/") | ||
maven("https://repo.opencollab.dev/maven-snapshots/") | ||
maven("https://repo.maven.apache.org/maven2/") | ||
} | ||
|
||
group = properties["group"] as String | ||
version = properties["version"] as String | ||
java.sourceCompatibility = JavaVersion.VERSION_17 | ||
|
||
publishing { | ||
publications.create<MavenPublication>("maven") { | ||
from(components["java"]) | ||
} | ||
} | ||
|
||
tasks.withType<JavaCompile>() { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
tasks { | ||
processResources { | ||
filesMatching(listOf("plugin.yml")) { | ||
expand( | ||
"version" to properties["version"] | ||
) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
build-logic/src/main/kotlin/hurricane.paperweight-conventions.gradle.kts
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,12 @@ | ||
|
||
plugins { | ||
id("hurricane.java-conventions") | ||
id("io.papermc.paperweight.userdev") | ||
} | ||
|
||
tasks { | ||
assemble { | ||
// according to paperweight-test-plugin | ||
dependsOn(reobfJar) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
build-logic/src/main/kotlin/hurricane.shadow-conventions.gradle.kts
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,33 @@ | ||
plugins { | ||
id("hurricane.java-conventions") | ||
id("com.gradleup.shadow") | ||
id("xyz.wagyourtail.jvmdowngrader") | ||
} | ||
|
||
tasks { | ||
jar { | ||
archiveClassifier.set("unshaded") | ||
archiveVersion.set("") | ||
} | ||
|
||
shadowJar { | ||
archiveClassifier.set("shaded") | ||
archiveVersion.set("") | ||
} | ||
|
||
downgradeJar { | ||
mustRunAfter(shadowJar) | ||
inputFile.set(shadowJar.get().archiveFile) | ||
archiveClassifier.set("") | ||
archiveVersion.set("") | ||
} | ||
|
||
build { | ||
dependsOn(shadowJar) | ||
dependsOn(downgradeJar) | ||
} | ||
} | ||
|
||
jvmdg { | ||
downgradeTo = JavaVersion.VERSION_1_8 | ||
} |
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,2 @@ | ||
group=org.geysermc.hurricane | ||
version=2.1-SNAPSHOT |
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,27 @@ | ||
[versions] | ||
configurate ="4.2.0-SNAPSHOT" | ||
geyser ="2.4.2-SNAPSHOT" | ||
floodgate ="2.2.3-SNAPSHOT" | ||
paper ="1.18.2-R0.1-SNAPSHOT" | ||
paperweight = "1.5.5" | ||
shadow = "8.3.0" | ||
javadowngrader = "1.0.0" | ||
|
||
[libraries] | ||
configurate-hocon = { group = "org.spongepowered", name = "configurate-hocon", version.ref = "configurate" } | ||
floodgate-api = { group = "org.geysermc.floodgate", name = "api", version.ref = "floodgate" } | ||
geyser-api = { group = "org.geysermc.geyser", name = "api", version.ref = "geyser" } | ||
paper-api = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" } | ||
paperweight = { group = "io.papermc.paperweight", name = "paperweight-userdev", version.ref = "paperweight" } | ||
shadow = { group = "com.gradleup.shadow", name = "shadow-gradle-plugin", version.ref = "shadow" } | ||
javadowngrader = { group = "xyz.wagyourtail.jvmdowngrader", name = "gradle-plugin", version.ref = "javadowngrader" } | ||
|
||
[bundles] | ||
geyser = [ | ||
"floodgate-api", | ||
"geyser-api" | ||
] | ||
|
||
[plugins] | ||
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" } | ||
paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "paperweight" } |
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.9-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.