Skip to content

Commit

Permalink
Update build logic to 0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
NichtStudioCode committed Jul 25, 2023
1 parent f461074 commit ed55681
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 40 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build-addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
arguments: |
jetpacks:addonJar
-PoutDir=../artifacts/
-PxenondevsNms
env:
ORG_GRADLE_PROJECT_xenondevsNmsUsername: ${{ secrets.XENONDEVS_NMS_USERNAME }}
ORG_GRADLE_PROJECT_xenondevsNmsPassword: ${{ secrets.XENONDEVS_NMS_PASSWORD }}
Expand Down Expand Up @@ -68,7 +67,6 @@ jobs:
arguments: |
logistics:addonJar
-PoutDir=../artifacts/
-PxenondevsNms
env:
ORG_GRADLE_PROJECT_xenondevsNmsUsername: ${{ secrets.XENONDEVS_NMS_USERNAME }}
ORG_GRADLE_PROJECT_xenondevsNmsPassword: ${{ secrets.XENONDEVS_NMS_PASSWORD }}
Expand Down Expand Up @@ -104,7 +102,6 @@ jobs:
arguments: |
machines:addonJar
-PoutDir=../artifacts/
-PxenondevsNms
env:
ORG_GRADLE_PROJECT_xenondevsNmsUsername: ${{ secrets.XENONDEVS_NMS_USERNAME }}
ORG_GRADLE_PROJECT_xenondevsNmsPassword: ${{ secrets.XENONDEVS_NMS_PASSWORD }}
Expand Down Expand Up @@ -140,7 +137,6 @@ jobs:
arguments: |
simple-upgrades:addonJar
-PoutDir=../artifacts/
-PxenondevsNms
env:
ORG_GRADLE_PROJECT_xenondevsNmsUsername: ${{ secrets.XENONDEVS_NMS_USERNAME }}
ORG_GRADLE_PROJECT_xenondevsNmsPassword: ${{ secrets.XENONDEVS_NMS_PASSWORD }}
Expand Down Expand Up @@ -176,7 +172,6 @@ jobs:
arguments: |
vanilla-hammers:addonJar
-PoutDir=../artifacts/
-PxenondevsNms
env:
ORG_GRADLE_PROJECT_xenondevsNmsUsername: ${{ secrets.XENONDEVS_NMS_USERNAME }}
ORG_GRADLE_PROJECT_xenondevsNmsPassword: ${{ secrets.XENONDEVS_NMS_PASSWORD }}
Expand Down
54 changes: 24 additions & 30 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,35 @@ group = "xyz.xenondevs.nova.addon"
val mojangMapped = project.hasProperty("mojang-mapped")

plugins {
alias(libs.plugins.paperweight)
alias(libs.plugins.kotlin)
alias(libs.plugins.nova)
alias(libs.plugins.specialsource)
alias(libs.plugins.stringremapper)
}

repositories { configureRepositories() }
dependencies { configureDependencies() }

fun RepositoryHandler.configureRepositories() {
mavenLocal { content { includeGroup("org.spigotmc") } }
mavenLocal { content { includeGroupAndSubgroups("xyz.xenondevs") } }
mavenCentral()
maven("https://repo.xenondevs.xyz/releases")
maven("https://libraries.minecraft.net")

// include xenondevs-nms repository if requested
if (project.hasProperty("xenondevsNms")) {
maven("https://repo.papermc.io/repository/maven-public/") // authlib, brigadier, etc.
maven {
name = "xenondevsNms"
url = uri("https://repo.xenondevs.xyz/nms/")
credentials(PasswordCredentials::class)
}
}
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.xenondevs.xyz/releases/")
}

repositories { configureRepositories() }
fun DependencyHandlerScope.configureDependencies() {
paperweight.paperDevBundle(rootProject.libs.versions.paper)
implementation(rootProject.libs.nova)
}

subprojects {
apply(plugin = rootProject.libs.plugins.kotlin.get().pluginId)
apply(plugin = rootProject.libs.plugins.nova.get().pluginId)
apply(plugin = rootProject.libs.plugins.specialsource.get().pluginId)
apply(plugin = rootProject.libs.plugins.paperweight.get().pluginId)
apply(plugin = rootProject.libs.plugins.stringremapper.get().pluginId)

repositories { configureRepositories() }

dependencies {
implementation(rootProject.libs.nova)
}
dependencies { configureDependencies() }

addon {
id.set(this@subprojects.name)
Expand All @@ -50,24 +43,25 @@ subprojects {
novaVersion.set(rootProject.libs.versions.nova)
}

spigotRemap {
spigotVersion.set(rootProject.libs.versions.spigot.map { it.substringBefore('-') })
sourceJarTask.set(tasks.jar)
}

remapStrings {
remapGoal.set(if (mojangMapped) "mojang" else "spigot")
spigotVersion.set(rootProject.libs.versions.spigot)
gameVersion.set(rootProject.libs.versions.paper.get().substringBefore("-"))
}

tasks {
register<Copy>("addonJar") {
group = "build"
dependsOn("addon", if (mojangMapped) "jar" else "remapObfToSpigot")

from(File(project.buildDir, "libs/${project.name}-${project.version}.jar"))
dependsOn("addon")
if (mojangMapped) {
dependsOn("jar")
from(File(project.buildDir, "libs/${project.name}-${project.version}-dev.jar"))
} else {
dependsOn("reobfJar")
from(File(project.buildDir, "libs/${project.name}-${project.version}.jar"))
}

into((project.findProperty("outDir") as? String)?.let(::File) ?: project.buildDir)
rename { it.replace(project.name, addon.get().addonName.get()) }
rename { "${addon.get().addonName.get()}-${project.version}.jar" }
}

withType<KotlinCompile> {
Expand Down
8 changes: 3 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@ include("vanilla-hammers")

dependencyResolutionManagement {
repositories {
mavenLocal { content { includeGroup("org.spigotmc") } }
mavenCentral()
maven("https://libraries.minecraft.net")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.xenondevs.xyz/releases")
}
versionCatalogs {
create("libs") {
from("xyz.xenondevs.nova:catalog:0.14.1")
from("xyz.xenondevs.nova:catalog:0.15-SNAPSHOT")
}
}
}

pluginManagement {
repositories {
mavenLocal { content { includeGroup("org.spigotmc") } }
gradlePluginPortal()
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.xenondevs.xyz/releases")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") // for nova-gradle-plugin
}
}

0 comments on commit ed55681

Please sign in to comment.