update buildscript

This commit is contained in:
Ryder Belserion 2023-12-21 22:25:15 -05:00
parent 7c1499a48b
commit f307d436c6
No known key found for this signature in database
13 changed files with 275 additions and 193 deletions

6
CHANGELOG.md Normal file
View File

@ -0,0 +1,6 @@
## Fixes:
* Fix an NPE with item builder
## Other:
* [Feature Requests](https://github.com/Crazy-Crew/CrazyCrates/issues)
* [Bug Reports](https://github.com/Crazy-Crew/CrazyCrates/issues)

View File

@ -1,72 +1,38 @@
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
plugins {
`java-library`
id("root-plugin")
}
tasks {
assemble {
val jarsDir = File("$rootDir/jars")
if (jarsDir.exists()) jarsDir.delete()
jarsDir.mkdirs()
doFirst {
delete(jarsDir)
jarsDir.mkdirs()
}
subprojects.forEach { project ->
dependsOn(":${project.name}:build")
doLast {
if (project.name == "common" || project.name == "api") return@doLast
copy {
from(project.layout.buildDirectory.file("libs/${rootProject.name}-${rootProject.version}.jar"))
into(jarsDir)
runCatching {
if (project.name != "api") {
copy {
from(project.layout.buildDirectory.file("libs/${rootProject.name}-${project.name.uppercaseFirstChar()}-${project.version}.jar"))
into(jarsDir)
}
}
}.onSuccess {
// Delete to save space on jenkins.
delete(project.layout.buildDirectory.get())
delete(rootProject.layout.buildDirectory.get())
}.onFailure {
println("Failed to copy file out of build folder into jars directory: Likely does not exist.")
}
}
}
}
}
subprojects {
apply(plugin = "java-library")
repositories {
maven("https://repo.crazycrew.us/snapshots/")
maven("https://repo.crazycrew.us/releases/")
maven("https://jitpack.io/")
mavenCentral()
}
if (name == "paper") {
repositories {
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://repo.codemc.io/repository/maven-public/")
maven("https://repo.triumphteam.dev/snapshots/")
maven("https://repo.oraxen.com/releases/")
flatDir { dirs("libs") }
}
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
javadoc {
options.encoding = Charsets.UTF_8.name()
}
processResources {
filteringCharset = Charsets.UTF_8.name()
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of("17"))
}
}

15
buildSrc/build.gradle.kts Normal file
View File

@ -0,0 +1,15 @@
plugins {
`kotlin-dsl`
}
dependencies {
implementation(libs.paperweight)
implementation(libs.shadowjar)
implementation(libs.runpaper)
implementation(libs.modrinth)
implementation(libs.hangar)
}

View File

@ -0,0 +1,14 @@
dependencyResolutionManagement {
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
gradlePluginPortal()
mavenCentral()
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

View File

@ -0,0 +1,25 @@
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
plugins {
id("root-plugin")
}
base {
archivesName.set("${rootProject.name}-${project.name.uppercaseFirstChar()}")
}
val mcVersion = rootProject.properties["minecraftVersion"] as String
val fabricVersion = rootProject.properties["fabricVersion"] as String
project.version = if (System.getenv("BUILD_NUMBER") != null) "$fabricVersion-${System.getenv("BUILD_NUMBER")}" else fabricVersion
tasks {
val isBeta: Boolean = rootProject.extra["isBeta"]?.toString()?.toBoolean() ?: false
val type = if (isBeta) "Beta" else "Release"
modrinth {
versionType.set(type.lowercase())
loaders.addAll("fabric")
}
}

View File

@ -0,0 +1,85 @@
import gradle.kotlin.dsl.accessors._3c6de1dd92ae3b7d1ad54590cc9ae150.base
import io.papermc.hangarpublishplugin.model.Platforms
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
plugins {
id("io.papermc.hangar-publish-plugin")
id("io.papermc.paperweight.userdev")
id("xyz.jpenilla.run-paper")
id("root-plugin")
}
base {
archivesName.set("${rootProject.name}-${project.name.uppercaseFirstChar()}")
}
repositories {
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.codemc.io/repository/maven-public/")
maven("https://repo.triumphteam.dev/snapshots/")
maven("https://repo.oraxen.com/releases/")
flatDir { dirs("libs") }
}
val mcVersion = rootProject.properties["minecraftVersion"] as String
val paperVersion = rootProject.properties["paperVersion"] as String
project.version = if (System.getenv("BUILD_NUMBER") != null) "$paperVersion-${System.getenv("BUILD_NUMBER")}" else paperVersion
dependencies {
paperweight.paperDevBundle("$mcVersion-R0.1-SNAPSHOT")
}
tasks {
assemble {
dependsOn(reobfJar)
}
runServer {
jvmArgs("-Dnet.kyori.ansi.colorLevel=truecolor")
minecraftVersion(mcVersion)
}
val directory = File("$rootDir/jars")
val isBeta: Boolean = rootProject.extra["isBeta"]?.toString()?.toBoolean() ?: false
val type = if (isBeta) "Beta" else "Release"
// Publish to hangar.papermc.io.
hangarPublish {
publications.register("plugin") {
version.set("${project.version}")
id.set(rootProject.name)
channel.set(type)
changelog.set(rootProject.file("CHANGELOG.md").readText())
apiKey.set(System.getenv("hangar_key"))
platforms {
register(Platforms.PAPER) {
jar.set(file("$directory/${rootProject.name}-${project.name.uppercaseFirstChar()}-${project.version}.jar"))
platformVersions.set(listOf(mcVersion))
}
}
}
}
modrinth {
versionType.set(type.lowercase())
loaders.addAll("paper", "purpur")
}
}

View File

@ -0,0 +1,67 @@
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
plugins {
id("com.github.johnrengelman.shadow")
id("com.modrinth.minotaur")
`java-library`
`maven-publish`
}
repositories {
maven("https://repo.crazycrew.us/snapshots/")
maven("https://repo.crazycrew.us/releases/")
maven("https://jitpack.io/")
mavenCentral()
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
javadoc {
options.encoding = Charsets.UTF_8.name()
}
processResources {
filteringCharset = Charsets.UTF_8.name()
}
shadowJar {
archiveClassifier.set("")
exclude("META-INF/**")
}
val directory = File("$rootDir/jars")
val mcVersion = rootProject.properties["minecraftVersion"] as String
modrinth {
autoAddDependsOn.set(false)
token.set(System.getenv("modrinth_token"))
projectId.set(rootProject.name.lowercase())
versionName.set("${rootProject.name} ${project.version}")
versionNumber.set("${project.version}")
uploadFile.set("$directory/${rootProject.name}-${project.name.uppercaseFirstChar()}-${project.version}.jar")
gameVersions.add(mcVersion)
changelog.set(rootProject.file("CHANGELOG.md").readText())
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of("17"))
}

View File

@ -1,7 +1,11 @@
plugins {
id("root-plugin")
}
dependencies {
compileOnlyApi(libs.bundles.adventure)
compileOnly(libs.clusterApi5)
compileOnly(libs.cluster.api)
implementation(libs.cloud.core)

View File

@ -7,10 +7,14 @@ website = https://modrinth.com/plugin/crazyauctions
sources = https://github.com/Crazy-Crew/CrazyAuctions
issues = https://github.com/Crazy-Crew/CrazyAuctions/issues
group = us.crazycrew.crazyauctions
group = com.badbones69.crazyauctions
description = Auction off items in style.
version = 2.0
apiVersion = 1.20
paperVersion = 2.0
fabricVersion = 2.0
forgeVersion = 2.0
minecraftVersion = 1.20.4
isBeta = true

View File

@ -1,10 +1,18 @@
[versions]
configurate4 = "4.1.2"
adventure4 = "4.14.0"
cluster5 = "6.3"
cloud1 = "1.8.4"
cluster_version = "6.3"
shadow_version = "8.1.1"
paperweight_version = "1.5.9"
runpaper_version = "2.2.2"
modrinth_version = "2.8.7"
hangar_version = "0.1.1"
[plugins]
hangar = { id = "io.papermc.hangar-publish-plugin", version = "0.1.0" }
modrinth = { id = "com.modrinth.minotaur", version = "2.8.4" }
@ -17,8 +25,8 @@ shadowjar = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
adventure4 = { module = "net.kyori:adventure-api", version.ref = "adventure4" }
minimessage4 = { module = "net.kyori:adventure-text-minimessage", version.ref = "adventure4" }
cluster5 = { module = "com.ryderbelserion.cluster:paper", version.ref = "cluster5" }
clusterApi5 = { module = "com.ryderbelserion.cluster:api", version.ref = "cluster5" }
cluster_paper = { module = "com.ryderbelserion.cluster:paper", version.ref = "cluster_version" }
cluster_api = { module = "com.ryderbelserion.cluster:api", version.ref = "cluster_version" }
configurate4-yaml = { module = "org.spongepowered:configurate-yaml", version.ref = "configurate4" }
@ -38,6 +46,13 @@ cloud-fabric = { module = "cloud.commandframework:cloud-fabric", version.ref = "
cloud-sponge = { module = "cloud.commandframework:cloud-sponge7", version.ref = "cloud1" }
cloud-extras = { module = "cloud.commandframework:cloud-minecraft-extras", version.ref = "cloud1" }
paperweight = { module = "io.papermc.paperweight:paperweight-userdev", version.ref = "paperweight_version" }
shadowjar = { module = "com.github.johnrengelman:shadow", version.ref = "shadow_version" }
runpaper = { module = "xyz.jpenilla:run-task", version.ref = "runpaper_version" }
hangar = { module = "io.papermc:hangar-publish-plugin", version.ref = "hangar_version" }
modrinth = { module = "com.modrinth.minotaur:Minotaur", version.ref = "modrinth_version" }
[bundles]
adventure = ["adventure4", "minimessage4"]

Binary file not shown.

View File

@ -4,4 +4,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists

View File

@ -1,20 +1,5 @@
import io.papermc.hangarpublishplugin.model.Platforms
plugins {
alias(libs.plugins.paperweight)
alias(libs.plugins.shadowjar)
alias(libs.plugins.modrinth)
alias(libs.plugins.runpaper)
alias(libs.plugins.hangar)
`maven-publish`
}
base {
archivesName.set(rootProject.name)
id("paper-plugin")
}
val mcVersion = rootProject.properties["minecraftVersion"] as String
@ -24,120 +9,16 @@ dependencies {
implementation(libs.bstats)
implementation(libs.cluster5)
implementation(libs.commandApi)
compileOnly(libs.vault)
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:$mcVersion-R0.1-SNAPSHOT")
compileOnly(fileTree("libs").include("*.jar"))
}
val isBeta: Boolean get() = rootProject.extra["isBeta"]?.toString()?.toBoolean() ?: false
val type = if (isBeta) "Beta" else "Release"
val description = """
## Changes:
* data.yml has been renamed to users.yml
## Other:
* [Feature Requests](https://github.com/Crazy-Crew/${rootProject.name}/issues)
* [Bug Reports](https://github.com/Crazy-Crew/${rootProject.name}/issues)
"""
val file = project.layout.buildDirectory.file("libs/${rootProject.name}-${rootProject.version}.jar").get().asFile
val component: SoftwareComponent = components["java"]
tasks {
// Publish to hangar.papermc.io.
hangarPublish {
publications.register("plugin") {
version.set("$rootProject.version")
id.set(rootProject.name)
channel.set(type)
changelog.set(description)
apiKey.set(System.getenv("hangar_key"))
platforms {
register(Platforms.PAPER) {
jar.set(file)
platformVersions.set(listOf(mcVersion))
}
}
}
}
// Publish to modrinth.
modrinth {
autoAddDependsOn.set(false)
token.set(System.getenv("modrinth_token"))
projectId.set(rootProject.name.lowercase())
versionName.set("${rootProject.name} ${rootProject.version}")
versionNumber.set("${rootProject.version}")
versionType.set(type.lowercase())
uploadFile.set(file)
gameVersions.add(mcVersion)
changelog.set(description)
loaders.addAll("paper", "purpur")
}
// Runs a test server.
runServer {
jvmArgs("-Dnet.kyori.ansi.colorLevel=truecolor")
minecraftVersion(mcVersion)
}
// Assembles the plugin.
assemble {
dependsOn(reobfJar)
}
publishing {
repositories {
maven {
url = uri("https://repo.crazycrew.us/releases/")
credentials {
this.username = System.getenv("GRADLE_USERNAME")
this.password = System.getenv("GRADLE_PASSWORD")
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = rootProject.group.toString()
artifactId = "${rootProject.name.lowercase()}-${project.name.lowercase()}-api"
version = rootProject.version.toString()
from(component)
}
}
}
shadowJar {
archiveClassifier.set("")
exclude("META-INF/**")
listOf(
"org.bstats", "com.ryderbelserion.cluster", "dev.jorel.commandapi"
//"com.ryderbelserion.cluster.paper",
//"de.tr7zw.changeme.nbtapi",
//"dev.triumphteam.cmd",
"org.bstats"
).forEach {
relocate(it, "libs.$it")
}
@ -145,13 +26,13 @@ tasks {
processResources {
val properties = hashMapOf(
"name" to rootProject.name,
"version" to rootProject.version,
"group" to rootProject.group,
"description" to rootProject.description,
"apiVersion" to rootProject.properties["apiVersion"],
"authors" to rootProject.properties["authors"],
"website" to rootProject.properties["website"]
"name" to rootProject.name,
"version" to project.version,
"group" to rootProject.group,
"description" to rootProject.description,
"apiVersion" to rootProject.properties["apiVersion"],
"authors" to rootProject.properties["authors"],
"website" to rootProject.properties["website"]
)
inputs.properties(properties)