Update build script

This commit is contained in:
Ryder Belserion 2024-03-05 12:08:54 -05:00
parent ee28bda29a
commit 47205145fb
No known key found for this signature in database
18 changed files with 422 additions and 257 deletions

16
.gitignore vendored
View File

@ -1,22 +1,22 @@
build
.gradle
.idea
buildSrc/.gradle
buildSrc/build
common/.gradle
common/build
jars
common/build
paper/build
api/build
common/.gradle
api/.gradle
paper/.gradle
paper/run
!paper/run/config
!paper/run/spigot.yml
!paper/run/bukkit.yml
!paper/run/eula.txt
!paper/run/server.properties
!paper/run/plugins
!paper/run/plugins
!paper/run/ops.json

0
CHANGELOG.md Normal file
View File

View File

@ -1,9 +1,9 @@
<br />
[![crazyauctions](https://raw.githubusercontent.com/RyderBelserion/Assets/main/crazycrew/webp/CrazyAuctionsBanner.webp)](https://modrinth.com/plugin/crazyauctions)
<div align="center">
[![CrazyAuctions](https://raw.githubusercontent.com/RyderBelserion/Assets/main/crazycrew/webp/CrazyAuctionsBanner.webp)](https://modrinth.com/plugin/crazyauctions)
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
@ -16,14 +16,14 @@
![Purpur](https://cdn.jsdelivr.net/gh/intergrav/devins-badges/assets/compact/supported/purpur_vector.svg)
<p align="center">
Auction off your items in style!
A crates plugin that offers quality crates with ease!
<br />
<a href="https://github.com/Crazy-Crew/CrazyAuctions/wiki"><strong>Explore the docs »</strong></a>
<a href="https://docs.crazycrew.us/crazyauctions/home"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/Crazy-Crew/CrazyAuctions/issues">Report Bug</a>
<a href="https://github.com/Crazy-Crew/CrazyAuctions/issues/new?assignees=ryderbelserion&labels=bug&projects=&template=bugs.yml&title=%5BBug+Report%5D%3A+">Report Bug</a>
·
<a href="https://github.com/Crazy-Crew/CrazyAuctions/discussions/categories/feature-requests">Request Feature</a>
<a href="https://github.com/Crazy-Crew/CrazyAuctions/issues/new?assignees=&labels=feature&template=feature_request.md&title=%5BFeature%5D+">Request Feature</a>
·
<a href="https://discord.gg/badbones-s-live-chat-182615261403283459">Get Support</a>
</p>
@ -47,54 +47,45 @@
</ol>
</details>
## Resource Page
### Beta Builds
All beta builds will be on Modrinth marked as beta.<br>
<a href="https://modrinth.com/plugin/crazyauctions">![Modrinth](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/cozy/available/modrinth_64h.png)</a>
### Resource Page
[![Hangar](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/compact/available/hangar_46h.png)](https://hangar.papermc.io/CrazyCrew/CrazyAuctions)
[![Modrinth](https://raw.githubusercontent.com/intergrav/devins-badges/v3/assets/compact/available/modrinth_46h.png)](https://modrinth.com/user/plugin/CrazyAuctions)
## Getting Started
How to get started with contributing / maintaining your own version of CrazyAuctions!
### Prerequisites
A list of things necessary to make sure you can build CrazyAuctions properly.
* Intellij IDEA
* > https://www.jetbrains.com/idea/download/
* Gradle
### Installation
1. Clone the repo
```sh
git clone https://github.com/Crazy-Crew/CrazyAuctions.git
```
2. Open the repository using Intellij IDEA & wait until it finishes downloading/indexing.
3. Run the assemble task.
3. Run the clean assemble task.
```gradle
./gradlew assemble
./gradlew clean assemble
```
## Roadmap
Check our public [trello board](https://trello.com/b/CcPYmsBt) for our current plans, any bugs and general tracking of the project progress.
Check our public [trello board](https://trello.com/b/bzQ5TwXo) for our current plans, any bugs and general tracking of the project progress.
## Contributing
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/yourfeature`)
3. Commit your Changes (`git commit -m 'your amazing feature.'`)
4. Push to the Branch (`git push`)
5. Open a Pull Request to the dev branch to add your feature/fix.
5. Open a Pull Request to the `main` branch to add your feature/fix.
## License
Distributed under the MIT License. See [`LICENSE`](/LICENSE) for more information.
[discord-shield]: https://img.shields.io/discord/182615261403283459.svg?style=flat&logo=appveyor
[discord-url]: https://discord.gg/crazycrew
[discord-url]: https://discord.gg/badbones-s-live-chat-182615261403283459
[contributors-shield]: https://img.shields.io/github/contributors/Crazy-Crew/CrazyAuctions.svg?style=flat&logo=appveyor
[contributors-url]: https://github.com/Crazy-Crew/CrazyAuctions/graphs/contributors

View File

@ -1,59 +0,0 @@
plugins {
id 'java-library'
}
defaultTasks 'build'
assemble {
subprojects.forEach { project -> dependsOn ":${project.name}:build" }
doLast {
File dir = new File(rootDir, "jars")
if (dir.exists()) dir.delete()
dir.mkdirs()
copy {
from(project("paper").layout.buildDirectory.file("libs/${rootProject.name}-${rootProject.version}.jar").get())
into(dir)
}
}
}
subprojects {
apply plugin: 'java-library'
repositories {
maven { url = 'https://repo.crazycrew.us/releases' }
maven { url = 'https://jitpack.io' }
mavenCentral()
}
if (name == "paper") {
repositories {
maven { url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
}
}
compileJava {
options.encoding = 'UTF-8'
options.release.set(17)
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
javadoc {
options.encoding = 'UTF-8'
}
processResources {
filteringCharset = 'UTF-8'
}
}

40
build.gradle.kts Normal file
View File

@ -0,0 +1,40 @@
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
plugins {
id("root-plugin")
}
tasks {
assemble {
val jarsDir = File("$rootDir/jars")
doFirst {
delete(jarsDir)
jarsDir.mkdirs()
}
subprojects.filter { it.name == "paper" || it.name == "fabric" }.forEach { project ->
dependsOn(":${project.name}:build")
doLast {
runCatching {
val file = File("$jarsDir/${project.name.uppercaseFirstChar().lowercase()}")
file.mkdirs()
copy {
from(project.layout.buildDirectory.file("libs/${rootProject.name}-${project.version}.jar"))
into(file)
}
}.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.")
}
}
}
}
}

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,18 @@
plugins {
id("root-plugin")
}
base {
archivesName.set(rootProject.name)
}
val mcVersion = providers.gradleProperty("mcVersion").get()
val fabricVersion = providers.gradleProperty("version").get()
project.version = if (System.getenv("BUILD_NUMBER") != null) "$fabricVersion-${System.getenv("BUILD_NUMBER")}" else fabricVersion
tasks {
modrinth {
loaders.addAll("fabric")
}
}

View File

@ -0,0 +1,51 @@
plugins {
id("io.papermc.paperweight.userdev")
id("xyz.jpenilla.run-paper")
id("root-plugin")
}
base {
archivesName.set(rootProject.name)
}
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 = providers.gradleProperty("mcVersion").get()
project.version = if (System.getenv("BUILD_NUMBER") != null) "${rootProject.version}-${System.getenv("BUILD_NUMBER")}" else rootProject.version
dependencies {
paperweight.paperDevBundle("$mcVersion-R0.1-SNAPSHOT")
}
tasks {
assemble {
dependsOn(reobfJar)
}
runServer {
jvmArgs("-Dnet.kyori.ansi.colorLevel=truecolor")
defaultCharacterEncoding = Charsets.UTF_8.name()
minecraftVersion(mcVersion)
}
modrinth {
loaders.addAll("paper", "purpur")
}
}

View File

@ -0,0 +1,147 @@
import gradle.kotlin.dsl.accessors._8291d1211fdf2e346e0abe66afb65704.idea
import io.papermc.hangarpublishplugin.model.Platforms
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
import java.io.ByteArrayOutputStream
plugins {
id("io.papermc.hangar-publish-plugin")
id("com.github.johnrengelman.shadow")
id("com.modrinth.minotaur")
`java-library`
`maven-publish`
idea
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
repositories {
maven("https://repo.crazycrew.us/snapshots/")
maven("https://repo.crazycrew.us/releases/")
maven("https://jitpack.io/")
mavenCentral()
}
// The commit id for the "main" branch prior to merging a pull request.
/*val start = "e888a19"
// The commit id BEFORE merging the pull request so before "Merge pull request #30"
val end = "f78f454"
val commitLog = getGitHistory().joinToString(separator = "") { formatGitLog(it) }
fun getGitHistory(): List<String> {
val output: String = ByteArrayOutputStream().use { outputStream ->
project.exec {
executable("git")
args("log", "$start..$end", "--format=format:%h %s")
standardOutput = outputStream
}
outputStream.toString()
}
return output.split("\n")
}
fun formatGitLog(commitLog: String): String {
val hash = commitLog.take(7)
val message = commitLog.substring(8) // Get message after commit hash + space between
return "[$hash](https://github.com/Crazy-Crew/${rootProject.name}/commit/$hash) $message<br>"
}*/
val changes = """
${rootProject.file("CHANGELOG.md").readText(Charsets.UTF_8)}
## Commits
<details>
<summary>Other</summary>
commitLog
</details>
""".trimIndent()
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/${project.name.lowercase()}")
val mcVersion = providers.gradleProperty("mcVersion").get()
val isBeta: Boolean = providers.gradleProperty("isBeta").get().toBoolean()
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(changes)
apiKey.set(System.getenv("hangar_key"))
platforms {
register(Platforms.PAPER) {
jar.set(file("$directory/${rootProject.name}-${project.version}.jar"))
platformVersions.set(listOf(mcVersion))
}
}
}
}
modrinth {
versionType.set(type.lowercase())
autoAddDependsOn.set(false)
token.set(System.getenv("modrinth_token"))
projectId.set(rootProject.name.lowercase())
changelog.set(changes)
versionName.set("${rootProject.name} ${project.version}")
versionNumber.set("${project.version}")
uploadFile.set("$directory/${rootProject.name}-${project.version}.jar")
gameVersions.add(mcVersion)
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of("17"))
}

View File

@ -1,5 +1,6 @@
org.gradle.jvmargs = '-Xmx3G'
org.gradle.parallel = false
org.gradle.caching = true
org.gradle.parallel = true
org.gradle.warning.mode = all
authors = ["Ryderbelserion, Badbones69"]
@ -9,8 +10,8 @@ issues = https://github.com/Crazy-Crew/CrazyAuctions/issues
group = com.badbones69.crazyauctions
description = Auction off items in style.
version = 1.3.2
version = 1.3.3
apiVersion = 1.20
minecraftVersion = 1.20.2
mcVersion = 1.20.4
isBeta = true

View File

@ -1,35 +1,28 @@
[versions]
kyori_version = "4.14.0"
cluster_version = "3.1"
shadow_version = "8.1.1"
paperweight_version = "1.5.9"
runpaper_version = "2.2.3"
modrinth_version = "2.8.7"
hangar_version = "0.1.2"
[plugins]
hangar = { id = "io.papermc.hangar-publish-plugin", version = "0.1.0" }
modrinth = { id = "com.modrinth.minotaur", version = "2.8.4" }
hangar = { id = "io.papermc.hangar-publish-plugin", version.ref = "hangar_version" }
modrinth = { id = "com.modrinth.minotaur", version.ref = "modrinth_version" }
paperweight = { id = "io.papermc.paperweight.userdev", version = "1.5.9" }
runpaper = { id = "xyz.jpenilla.run-paper", version = "2.2.2" }
shadowjar = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "paperweight_version" }
runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runpaper_version" }
shadowjar = { id = "com.github.johnrengelman.shadow", version.ref = "shadow_version" }
[libraries]
adventure = { module = "net.kyori:adventure-api", version.ref = "kyori_version" }
minimessage = { module = "net.kyori:adventure-text-minimessage", version.ref = "kyori_version" }
cluster_paper = { module = "com.ryderbelserion.cluster.paper:cluster-paper", version.ref = "cluster_version" }
cluster_api = { module = "com.ryderbelserion.cluster.api:cluster-api", version.ref = "cluster_version" }
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" }
vault = { module = "com.github.MilkBowl:VaultAPI", version = "1.7.1" }
triumph_cmds = { module = "dev.triumphteam:triumph-cmd-bukkit", version = "2.0.0-SNAPSHOT" }
config_me = { module = "ch.jalu:configme", version = "1.4.1" }
metrics = { module = "org.bstats:bstats-bukkit", version = "3.0.2" }
itemsadder = { module = "com.github.LoneDev6:api-itemsadder", version = "3.6.1" }
oraxen = { module = "io.th0rgal:oraxen", version = "1.164.0" }
holographicdisplays = { module = "me.filoghost.holographicdisplays:holographicdisplays-api", version = "3.0.0" }
decentholograms = { module = "com.github.decentsoftware-eu:decentholograms", version = "2.8.4" }
placeholderapi = { module = "me.clip:placeholderapi", version = "2.11.4" }
hangar = { module = "io.papermc:hangar-publish-plugin", version.ref = "hangar_version" }
modrinth = { module = "com.modrinth.minotaur:Minotaur", version.ref = "modrinth_version" }

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@ -1,127 +0,0 @@
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)
}
base {
archivesName = "${rootProject.name}"
}
dependencies {
implementation(libs.metrics)
compileOnly(libs.vault)
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:$minecraftVersion-R0.1-SNAPSHOT")
}
String type = isBeta ? "Beta" : "Release"
String description = """
## Fixes:
* Fix not being able to buy items
* Fix an issue where it would scream about tasks needing to be run sync
## Other:
* [Feature Requests](https://github.com/Crazy-Crew/${rootProject.name}/issues)
* [Bug Reports](https://github.com/Crazy-Crew/${rootProject.name}/issues)
"""
File file = project.layout.buildDirectory.file("libs/${rootProject.name}-${rootProject.version}.jar").get().asFile
tasks {
runServer {
// 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(["$minecraftVersion"])
}
}
}
}
// Publish to modrinth.
modrinth {
setAutoAddDependsOn(false)
token.set(System.getenv("modrinth_token"))
projectId.set(rootProject.name.toLowerCase())
versionName.set("${rootProject.name} ${rootProject.version}")
versionNumber.set("${rootProject.version}")
versionType.set(type.toLowerCase())
uploadFile.set(file)
gameVersions.add(minecraftVersion)
changelog.set(description)
loaders.addAll("paper", "purpur")
}
jvmArgs("-Dnet.kyori.ansi.colorLevel=truecolor")
minecraftVersion(minecraftVersion)
}
assemble {
dependsOn(reobfJar)
}
shadowJar {
mergeServiceFiles()
exclude("META-INF/**")
List.of(
"org.bstats"
).forEach {
relocate(it, "libs.$it")
}
}
processResources {
Map<String, String> props = new HashMap<>()
props.put("name", rootProject.name)
props.put("version", "$rootProject.version")
props.put("group", "$project.group")
props.put("description", rootProject.description)
props.put("apiVersion", apiVersion)
props.put("authors", authors)
props.put("website", website)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
}

41
paper/build.gradle.kts Normal file
View File

@ -0,0 +1,41 @@
plugins {
id("paper-plugin")
}
dependencies {
implementation(libs.metrics)
compileOnly(libs.vault) {
exclude("org.bukkit", "bukkit")
}
compileOnly(fileTree("libs").include("*.jar"))
}
tasks {
shadowJar {
listOf(
"org.bstats"
).forEach {
relocate(it, "libs.$it")
}
}
processResources {
val properties = hashMapOf(
"name" to rootProject.name,
"version" to project.version,
"group" to rootProject.group,
"description" to rootProject.description,
"apiVersion" to providers.gradleProperty("apiVersion").get(),
"authors" to providers.gradleProperty("authors").get(),
"website" to providers.gradleProperty("website").get()
)
inputs.properties(properties)
filesMatching("plugin.yml") {
expand(properties)
}
}
}

View File

@ -1,13 +0,0 @@
pluginManagement {
repositories {
maven { url = 'https://repo.papermc.io/repository/maven-public/' }
gradlePluginPortal()
mavenCentral()
}
}
rootProject.name = 'CrazyAuctions'
include 'paper'

53
settings.gradle.kts Normal file
View File

@ -0,0 +1,53 @@
pluginManagement {
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
gradlePluginPortal()
mavenCentral()
}
}
dependencyResolutionManagement {
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
gradlePluginPortal()
mavenCentral()
}
versionCatalogs {
create("libs") {
version("cluster", "6.3")
library("holographicdisplays", "me.filoghost.holographicdisplays", "holographicdisplays-api").version("3.0.0")
library("decentholograms", "com.github.decentsoftware-eu", "decentholograms").version("2.8.6")
library("triumphcmds", "dev.triumphteam", "triumph-cmd-bukkit").version("2.0.0-SNAPSHOT")
library("cluster_paper", "com.ryderbelserion.cluster", "paper").versionRef("cluster")
library("cluster_api", "com.ryderbelserion.cluster", "paper").versionRef("cluster")
library("itemsadder", "com.github.LoneDev6", "api-itemsadder").version("3.6.1")
library("placeholderapi", "me.clip", "placeholderapi").version("2.11.5")
library("triumphgui", "dev.triumphteam", "triumph-gui").version("3.1.7")
library("metrics", "org.bstats", "bstats-bukkit").version("3.0.2")
library("nbtapi", "de.tr7zw", "item-nbt-api").version("2.12.2")
library("vault", "com.github.MilkBowl", "VaultAPI").version("1.7.1")
library("oraxen", "io.th0rgal", "oraxen").version("1.164.0")
library("configme", "ch.jalu", "configme").version("1.4.1")
}
}
}
rootProject.name = "CrazyAuctions"
include("paper")
//include("fabric")