Skip to content

Commit

Permalink
[ci-skip] chore: Clean up how the jar is compiled
Browse files Browse the repository at this point in the history
Cleans up how the jar is compiled and how the version is applied to subprojects.
It also changes the plugin.yml -> paper-plugin.yml
  • Loading branch information
ryderbelserion authored Apr 21, 2024
2 parents 0c14c31 + 66842a8 commit 2d2b0aa
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 65 deletions.
12 changes: 10 additions & 2 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
plugins {
`paper-plugin`
id("com.github.johnrengelman.shadow")

`root-plugin`
}

project.group = "us.crazycrew.crazycrates"
project.version = "1.0-snapshot"

repositories {
maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
compileOnly(libs.vital)
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")

compileOnly(libs.config.me)

compileOnly(libs.vital)
}

java {
Expand Down
38 changes: 26 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
plugins {
`root-plugin`
import git.formatLog
import git.latestCommitHash
import git.latestCommitMessage

plugins {
id("io.papermc.hangar-publish-plugin") version "0.1.2"
id("com.modrinth.minotaur") version "2.+"
}

rootProject.version = if (System.getenv("NEXT_BUILD_NUMBER") != null) "2.1-${System.getenv("NEXT_BUILD_NUMBER")}" else "2.1"
id("com.github.johnrengelman.shadow")

dependencies {
api(project(":paper", configuration = "shadow"))
`root-plugin`
}

val isSnapshot = rootProject.version.toString().contains("-")
val buildNumber: String? = System.getenv("NEXT_RUN_NUMBER")

rootProject.version = if (buildNumber != null) "2.1-$buildNumber" else "2.1"

val isSnapshot = true

val content: String = if (isSnapshot) {
if (System.getenv("COMMIT_MESSAGE") != null) {
Expand All @@ -23,6 +27,10 @@ val content: String = if (isSnapshot) {
rootProject.file("CHANGELOG.md").readText(Charsets.UTF_8)
}

subprojects.filter { it.name != "api" }.forEach {
it.project.version = rootProject.version
}

modrinth {
token.set(System.getenv("MODRINTH_TOKEN"))

Expand All @@ -35,9 +43,12 @@ modrinth {

changelog.set(content)

uploadFile.set(file("$rootDir/jars/${rootProject.name}-${rootProject.version}.jar"))
uploadFile.set(rootProject.projectDir.resolve("jars/${rootProject.name}-${rootProject.version}.jar"))

gameVersions.set(listOf(libs.versions.bundle.get()))
gameVersions.set(listOf(
"1.20.4"
//"1.20.5"
))

loaders.add("paper")
loaders.add("purpur")
Expand All @@ -61,9 +72,12 @@ hangarPublish {

platforms {
paper {
jar.set(file("$rootDir/jars/${rootProject.name}-${rootProject.version}.jar"))
jar.set(rootProject.projectDir.resolve("jars/${rootProject.name}-${rootProject.version}.jar"))

platformVersions.set(listOf(libs.versions.bundle.get()))
platformVersions.set(listOf(
"1.20.4"
//"1.20.5"
))

dependencies {
hangar("PlaceholderAPI") {
Expand All @@ -90,7 +104,7 @@ hangarPublish {
tasks {
assemble {
doFirst {
delete("$rootDir/jars")
delete(rootProject.projectDir.resolve("jars"))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package git

import org.gradle.api.Project
import java.io.ByteArrayOutputStream

Expand Down
4 changes: 0 additions & 4 deletions buildSrc/src/main/kotlin/root-plugin.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
plugins {
id("com.github.johnrengelman.shadow")

`java-library`

`maven-publish`
Expand All @@ -19,8 +17,6 @@ repositories {

maven("https://repo.triumphteam.dev/snapshots/")

maven("https://repo.crazycrew.us/snapshots/")

maven("https://repo.crazycrew.us/releases/")

maven("https://repo.oraxen.com/releases/")
Expand Down
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name = CrazyCrates
group = com.badbones69.crazycrates
description = Create unlimited crates with multiple crate types to choose from!
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.parallel=false

org.gradle.parallel = true
org.gradle.caching = true
org.gradle.jvmargs = '-Xmx3G'
group=com.badbones69.crazycrates
authors=["ryderbelserion", "BadBones69"]
description=Create unlimited crates with multiple crate types to choose from!
website=https://modrinth.com/plugin/crazycrates
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[plugins]
bukkit-convention = { id = "xyz.jpenilla.resource-factory-bukkit-convention", version = "1.0.0" }
run-paper = { id = "xyz.jpenilla.run-paper", version = "2.2.3" }

[versions]
bundle = "1.20.4"
minecraftVersion = "1.20.4"

[libraries]
itemsadder-api = { group = "com.github.LoneDev6", name = "api-itemsadder", version = "3.6.1" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
40 changes: 14 additions & 26 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
plugins {
id("com.github.johnrengelman.shadow")

alias(libs.plugins.run.paper)

`paper-plugin`
}

val mcVersion = libs.versions.bundle

dependencies {
compileOnly(fileTree("$rootDir/libs/compile").include("*.jar"))

implementation(project(":api"))

implementation(libs.bundles.triumph)
implementation(libs.triumph.cmds)

implementation(libs.config.me)

Expand Down Expand Up @@ -51,35 +51,23 @@ tasks {
}

shadowJar {
archiveClassifier.set("")

//archiveFileName.set("${rootProject.name}-${rootProject.version}.jar")
//destinationDirectory.set(rootProject.projectDir.resolve("jars"))

listOf(
"dev.triumphteam",
"org.bstats",
"ch.jalu"
).forEach {
relocate(it, "libs.$it")
}
).forEach { relocate(it, "libs.$it") }
}

processResources {
val properties = hashMapOf(
"name" to rootProject.name,
"version" to rootProject.version,
"group" to rootProject.group,
"description" to rootProject.description,
"apiVersion" to "1.20",
"authors" to listOf("RyderBelserion", "BadBones69"),
"website" to "https://modrinth.com/plugin/crazycrates"
)

inputs.properties(properties)

filesMatching("plugin.yml") {
expand(properties)
inputs.properties("name" to rootProject.name)
inputs.properties("version" to project.version)
inputs.properties("group" to project.group)
//inputs.properties("authors" to project.properties["authors"])
inputs.properties("description" to project.properties["description"])
inputs.properties("website" to project.properties["website"])

filesMatching("paper-plugin.yml") {
expand(inputs.properties)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ public void onEnable() {

@Override
public void onDisable() {
// CancelTask
// Cancel the tasks
getServer().getGlobalRegionScheduler().cancelTasks(this);
getServer().getAsyncScheduler().cancelTasks(this);

// Cancel the timer task.
this.timer.cancel();

Expand Down
32 changes: 32 additions & 0 deletions paper/src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: '${name}'
main: '${group}.CrazyCrates'

version: '${version}'
api-version: '1.20'
description: '${description}'
website: '${website}'

folia-supported: true

dependencies:
server:
DecentHolograms:
load: BEFORE
required: false
join-classpath: true
PlaceholderAPI:
load: BEFORE
required: false
join-classpath: true
ItemsAdder:
load: BEFORE
required: false
join-classpath: true
Oraxen:
load: BEFORE
required: false
join-classpath: true
CMI:
load: BEFORE
required: false
join-classpath: true
12 changes: 0 additions & 12 deletions paper/src/main/resources/plugin.yml

This file was deleted.

0 comments on commit 2d2b0aa

Please sign in to comment.