From 1fa867b9554d11b4bbefc79630c3d9de49e176b7 Mon Sep 17 00:00:00 2001 From: Ryder Belserion Date: Sun, 16 Jun 2024 14:38:19 -0400 Subject: [PATCH] chore: parity with other buildscripts --- .github/workflows/release.yml | 4 +- build.gradle.kts | 5 +- buildSrc/build.gradle.kts | 11 +-- buildSrc/settings.gradle.kts | 24 ++++- .../src/main/kotlin/java-plugin.gradle.kts | 46 ++++++++++ .../src/main/kotlin/paper-plugin.gradle.kts | 16 ++-- .../src/main/kotlin/root-plugin.gradle.kts | 38 -------- gradle.properties | 20 ++-- gradle/libs.versions.toml | 84 ++++++++++------- gradle/wrapper/gradle-wrapper.properties | 2 +- paper/build.gradle.kts | 91 +++++++++++-------- settings.gradle.kts | 25 +++-- 12 files changed, 209 insertions(+), 157 deletions(-) create mode 100644 buildSrc/src/main/kotlin/java-plugin.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/root-plugin.gradle.kts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d85b4a..5dad1a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,11 +21,11 @@ jobs: - name: Validate Gradle Wrapper uses: gradle/actions/wrapper-validation@v3 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 check-latest: true - name: Gradle Properties Import. diff --git a/build.gradle.kts b/build.gradle.kts index 153de5b..44b196f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ plugins { alias(libs.plugins.minotaur) alias(libs.plugins.hangar) - `root-plugin` + `java-plugin` } val buildNumber: String? = System.getenv("BUILD_NUMBER") @@ -33,8 +33,7 @@ modrinth { gameVersions.set(listOf(libs.versions.minecraft.get())) - loaders.add("paper") - loaders.add("purpur") + loaders.addAll("paper", "purpur") autoAddDependsOn.set(false) detectLoaders.set(false) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 51b54c6..d4e1846 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,12 +1,11 @@ +import com.ryderbelserion.feather.feather + plugins { + id("com.ryderbelserion.feather-logic") version "0.0.1" + `kotlin-dsl` } -repositories { - gradlePluginPortal() - mavenCentral() -} - dependencies { - implementation(libs.paperweight.userdev) + feather("0.0.1") } \ No newline at end of file diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index b5f44b0..523a2cf 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -1,9 +1,23 @@ +rootProject.name = "buildSrc" + dependencyResolutionManagement { - versionCatalogs { - create("libs") { - from(files("../gradle/libs.versions.toml")) - } + repositories { + maven("https://repo.crazycrew.us/releases") + + gradlePluginPortal() + + mavenCentral() } } -rootProject.name = "buildSrc" \ No newline at end of file +pluginManagement { + repositories { + maven("https://repo.crazycrew.us/releases") + + gradlePluginPortal() + } +} + +plugins { + id("com.ryderbelserion.feather-settings") +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/java-plugin.gradle.kts b/buildSrc/src/main/kotlin/java-plugin.gradle.kts new file mode 100644 index 0000000..7f0f291 --- /dev/null +++ b/buildSrc/src/main/kotlin/java-plugin.gradle.kts @@ -0,0 +1,46 @@ +import com.ryderbelserion.feather.enums.Repository + +plugins { + id("com.ryderbelserion.feather-core") + + `maven-publish` + + `java-library` +} + +repositories { + maven("https://repo.extendedclip.com/content/repositories/placeholderapi") + + maven("https://repo.codemc.io/repository/maven-public") + + maven("https://repo.oraxen.com/releases") + + maven(Repository.CrazyCrewReleases.url) + + maven(Repository.Jitpack.url) + + flatDir { dirs("libs") } + + mavenCentral() +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} + +tasks { + compileJava { + options.encoding = Charsets.UTF_8.name() + options.release.set(21) + } + + javadoc { + options.encoding = Charsets.UTF_8.name() + } + + processResources { + filteringCharset = Charsets.UTF_8.name() + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/paper-plugin.gradle.kts b/buildSrc/src/main/kotlin/paper-plugin.gradle.kts index 4c63e65..bf7e7f1 100644 --- a/buildSrc/src/main/kotlin/paper-plugin.gradle.kts +++ b/buildSrc/src/main/kotlin/paper-plugin.gradle.kts @@ -1,17 +1,13 @@ +import com.ryderbelserion.feather.enums.Repository + plugins { - id("root-plugin") + id("java-plugin") } repositories { - maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") + maven("https://repo.triumphteam.dev/snapshots") - maven("https://repo.papermc.io/repository/maven-public/") + maven("https://maven.enginehub.org/repo") - maven("https://repo.codemc.io/repository/maven-public/") - - maven("https://repo.triumphteam.dev/snapshots/") - - maven("https://repo.fancyplugins.de/releases/") - - flatDir { dirs("libs") } + maven(Repository.Paper.url) } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/root-plugin.gradle.kts b/buildSrc/src/main/kotlin/root-plugin.gradle.kts deleted file mode 100644 index dcc1203..0000000 --- a/buildSrc/src/main/kotlin/root-plugin.gradle.kts +++ /dev/null @@ -1,38 +0,0 @@ -plugins { - `java-library` - - `maven-publish` -} - -base { - archivesName.set(rootProject.name) -} - -repositories { - maven("https://repo.crazycrew.us/snapshots/") - - maven("https://repo.crazycrew.us/releases/") - - maven("https://jitpack.io/") - - mavenCentral() -} - -java { - toolchain.languageVersion.set(JavaLanguageVersion.of("17")) -} - -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() - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ab8f511..4158531 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,10 @@ -org.gradle.jvmargs = '-Xmx3G' -org.gradle.caching = true -org.gradle.parallel = true -org.gradle.warning.mode = all - -authors = ["Ryderbelserion, Badbones69"] -website = https://modrinth.com/plugin/crazyauctions -sources = https://github.com/Crazy-Crew/CrazyAuctions -issues = https://github.com/Crazy-Crew/CrazyAuctions/issues +org.gradle.jvmargs = -Xmx3G +org.gradle.daemon = false +org.gradle.parallel = false group = com.badbones69.crazyauctions +authors = ["Ryderbelserion, Badbones69"] description = Auction off items in style. -apiVersion = 1.20 - -mcVersion = 1.20.4 -isBeta = true \ No newline at end of file +website = https://modrinth.com/plugin/crazyauctions +sources = https://github.com/Crazy-Crew/CrazyAuctions +issues = https://github.com/Crazy-Crew/CrazyAuctions/issues \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 786227d..8c25e37 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,48 +1,66 @@ -[plugins] -run-paper = { id = "xyz.jpenilla.run-paper", version = "2.2.3" } -minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" } -hangar = { id = "io.papermc.hangar-publish-plugin", version.ref = "hangar" } -shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" } - [versions] -kyori = "4.16.0" -bundle = "1.20.4-R0.1-SNAPSHOT" -cluster = "1.0-SNAPSHOT" -minotaur = "2.+" +# Minecraft +paper = "1.21-R0.1-SNAPSHOT" +minecraft = "1.21" + +# Plugins +itemsadder = "3.6.3-beta-14" +headdatabaseapi = "1.3.1" +placeholderapi = "2.11.6" +decentholograms = "2.8.8" +fancyholograms = "2.2.0" +worldguard = "7.0.10" +oraxen = "1.171.0" +nbtapi = "2.13.0" +vault = "1.7.1" + +# Libraries +triumph-cmd = "2.0.0-ALPHA-10" +tirumph-gui = "3.1.7" +jetbrains = "24.1.0" +kyori = "4.17.0" +vital = "1.5.9" + +# Paper +paperweight="1.7.1" +runPaper = "2.3.0" hangar = "0.1.2" -paper = "1.20.4-R0.1-SNAPSHOT" -minecraft = "1.20.4" +# Other +shadowJar = "8.1.7" + +# Modrinth +minotaur = "2.+" + +[plugins] +paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "paperweight" } +hangar = { id = "io.papermc.hangar-publish-plugin", version.ref = "hangar" } +shadowJar = { id = "io.github.goooler.shadow", version.ref = "shadowJar" } +runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" } +minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" } [libraries] -simple-yaml = { group = "com.github.Carleslc.Simple-YAML", name = "Simple-Yaml", version = "1.8.4" } +# Plugins +decent-holograms = { module = "com.github.decentsoftware-eu:decentholograms", version.ref = "decentholograms" } +fancy-holograms = { module = "de.oliver:FancyHolograms", version.ref = "fancyholograms" } -minimessage-api = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "kyori" } -adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "kyori" } +headdatabaseapi = { module = "com.arcaniax:HeadDatabase-API", version.ref = "headdatabaseapi" } +placeholderapi = { module = "me.clip:placeholderapi", version.ref = "placeholderapi" } -itemsadder-api = { group = "com.github.LoneDev6", name = "api-itemsadder", version = "3.6.1" } -oraxen-api = { group = "io.th0rgal", name = "oraxen", version = "1.171.0" } -placeholder-api = { group = "me.clip", name = "placeholderapi", version = "2.11.5" } -head-database-api = { group = "com.arcaniax", name = "HeadDatabase-API", version = "1.3.1" } +vault = { module = "com.github.MilkBowl:VaultAPI", version.ref = "vault" } -paperweight-userdev = { group = "io.papermc.paperweight.userdev", name = "io.papermc.paperweight.userdev.gradle.plugin", version = "1.5.11" } -publishing-modrinth = { group = "com.modrinth.minotaur", name = "Minotaur", version = "2.8.7" } -publishing-hangar = { group = "io.papermc", name = "hangar-publish-plugin", version = "0.1.2" } +itemsadder = { module = "com.github.LoneDev6:api-itemsadder", version.ref = "itemsadder" } +oraxen = { module = "io.th0rgal:oraxen", version.ref = "oraxen" } -cluster-api = { group = "com.ryderbelserion.cluster", name = "api", version.ref = "cluster" } -cluster-paper = { group = "com.ryderbelserion.cluster", name = "paper", version.ref = "cluster" } +# Libraries +triumph-cmds = { module = "dev.triumphteam:triumph-cmd-bukkit", version.ref = "triumph-cmd" } +triumph-gui = { module = "dev.triumphteam:triumph-gui", version.ref = "tirumph-gui" } -fancy-holograms = { group = "de.oliver", name = "FancyHolograms", version = "2.0.6" } -decent-holograms = { group = "com.github.decentsoftware-eu", name = "decentholograms", version = "2.8.6" } +jetbrains = { module = "org.jetbrains:annotations", version.ref = "jetbrains" } -triumph-cmds = { group = "dev.triumphteam", name = "triumph-cmd-bukkit", version = "2.0.0-ALPHA-9" } -triumph-gui = { group = "dev.triumphteam", name = "triumph-gui", version = "3.1.7" } - -vault = { group = "com.github.MilkBowl", name = "VaultAPI", version = "1.7.1" } -metrics = { group = "org.bstats", name = "bstats-bukkit", version = "3.0.2" } -config-me = { group = "ch.jalu", name = "configme", version = "1.4.1" } +vital-paper = { module = "com.ryderbelserion.vital:paper", version.ref = "vital" } +vital-core = { module = "com.ryderbelserion.vital:core", version.ref = "vital" } [bundles] -adventure = ["minimessage-api", "adventure-api"] holograms = ["fancy-holograms", "decent-holograms"] triumph = ["triumph-cmds", "triumph-gui"] \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 92c1ac1..dab2a01 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index e46ce12..89a6648 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -1,38 +1,53 @@ plugins { + alias(libs.plugins.paperweight) + alias(libs.plugins.shadowJar) + alias(libs.plugins.runPaper) + `paper-plugin` - - id("io.papermc.paperweight.userdev") - - alias(libs.plugins.run.paper) - alias(libs.plugins.shadow) } -repositories { - maven("https://repo.oraxen.com/releases/") +base { + archivesName.set(rootProject.name) } dependencies { - paperweight.paperDevBundle(libs.versions.bundle) + paperweight.paperDevBundle(libs.versions.paper) - implementation(libs.metrics) + compileOnly(libs.placeholderapi) - compileOnly(libs.placeholder.api) - - compileOnly(libs.oraxen.api) + compileOnly(libs.oraxen) compileOnly(libs.vault) compileOnly(fileTree("libs").include("*.jar")) } -tasks { - assemble { - dependsOn(reobfJar) +paperweight { + reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.REOBF_PRODUCTION +} - doLast { - copy { - from(reobfJar.get()) - into(rootProject.projectDir.resolve("jars")) +val component: SoftwareComponent = components["java"] + +tasks { + 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("maven") { + groupId = rootProject.group.toString() + artifactId = "${rootProject.name.lowercase()}-${project.name.lowercase()}-api" + version = rootProject.version.toString() + + from(component) } } } @@ -53,29 +68,33 @@ tasks { minecraftVersion("1.20.4") } - shadowJar { - listOf( - "org.bstats" - ).forEach { - relocate(it, "libs.$it") + assemble { + dependsOn(reobfJar) + + doLast { + copy { + from(reobfJar.get()) + into(rootProject.projectDir.resolve("jars")) + } } } + shadowJar { + archiveBaseName.set(rootProject.name) + archiveClassifier.set("") + } + 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) + inputs.properties("name" to rootProject.name) + inputs.properties("version" to project.version) + inputs.properties("group" to project.group) + inputs.properties("description" to project.properties["description"]) + inputs.properties("apiVersion" to libs.versions.minecraft.get()) + inputs.properties("authors" to project.properties["authors"]) + inputs.properties("website" to project.properties["website"]) filesMatching("plugin.yml") { - expand(properties) + expand(inputs.properties) } } } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 824a9c3..906547b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,14 +1,19 @@ +import com.ryderbelserion.feather.includeProject + enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") -pluginManagement { - repositories { - maven("https://repo.papermc.io/repository/maven-public/") - - gradlePluginPortal() - mavenCentral() - } -} - rootProject.name = "CrazyAuctions" -include(":paper") \ No newline at end of file +pluginManagement { + repositories { + maven("https://repo.crazycrew.us/releases") + + gradlePluginPortal() + } +} + +plugins { + id("com.ryderbelserion.feather-settings") version "0.0.1" +} + +listOf("paper").forEach(::includeProject) \ No newline at end of file