aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
diff options
context:
space:
mode:
Diffstat (limited to 'build.gradle.kts')
-rw-r--r--build.gradle.kts260
1 files changed, 74 insertions, 186 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index dde9614..0daff2c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,221 +1,109 @@
plugins {
- java
+ alias(libs.plugins.architectury.plugin)
+ alias(libs.plugins.architectury.loom) apply false
- id("fabric-loom") version "1.1.+" // 1.0.+ but patch must be 16 or higher
- id("io.github.juuxel.loom-quiltflower") version "1.8.+"
-
- id("com.modrinth.minotaur") version "2.6.+"
- id("me.hypherionmc.cursegradle") version "2.+"
- id("com.github.breadmoirai.github-release") version "2.+"
- `maven-publish`
-
- id("io.github.p03w.machete") version "1.+"
- id("org.ajoberstar.grgit") version "5.0.0"
+ alias(libs.plugins.unified.publishing) apply false
+ alias(libs.plugins.github.release)
+ alias(libs.plugins.grgit)
}
-val ciRun = System.getenv().containsKey("GITHUB_ACTIONS")
-
-group = "dev.isxander"
-version = "2.4.2"
-
-if (ciRun)
- version = "$version+${grgit.branch.current().name.replace('/', '.')}-SNAPSHOT"
-
-loom {
- splitEnvironmentSourceSets()
-
- mods {
- register("yet-another-config-lib") {
- sourceSet(sourceSets["main"])
- sourceSet(sourceSets["client"])
- }
- }
+architectury {
+ minecraft = libs.versions.minecraft.get()
}
-val testmod by sourceSets.registering {
- compileClasspath += sourceSets.main.get().compileClasspath
- runtimeClasspath += sourceSets.main.get().runtimeClasspath
- compileClasspath += sourceSets["client"].compileClasspath
- runtimeClasspath += sourceSets["client"].runtimeClasspath
-}
+val changelogText = file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided."
+val snapshotVer = "${grgit.branch.current().name.replace('/', '.')}-SNAPSHOT"
-loom {
- accessWidenerPath.set(file("src/main/resources/yacl.accesswidener"))
+allprojects {
+ apply(plugin = "java")
+ apply(plugin = "maven-publish")
+ apply(plugin = "architectury-plugin")
- runs {
- register("testmod") {
- client()
- ideConfigGenerated(true)
- name("Test Mod")
- source(testmod.get())
- }
+ version = "2.5.0+1.19.4"
+ group = "dev.isxander"
- named("client") { ideConfigGenerated(false) }
- named("server") { ideConfigGenerated(false) }
+ if (System.getenv().containsKey("GITHUB_ACTIONS")) {
+ version = "$version+$snapshotVer"
}
- createRemapConfigurations(testmod.get())
-}
+ pluginManager.withPlugin("base") {
+ val base = the<BasePluginExtension>()
-repositories {
- mavenCentral()
- maven("https://maven.terraformersmc.com")
- maven("https://maven.quiltmc.org/repository/release")
-}
-
-val minecraftVersion: String by project
-val fabricLoaderVersion: String by project
-val qmBuild: String by project
-
-dependencies {
- minecraft("com.mojang:minecraft:$minecraftVersion")
- mappings(loom.layered {
- mappings("org.quiltmc:quilt-mappings:$minecraftVersion+build.$qmBuild:intermediary-v2")
- officialMojangMappings()
- })
- modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
-
- "modClientImplementation"(fabricApi.module("fabric-resource-loader-v0", "0.76.0+1.19.4"))
-
- "testmodImplementation"(sourceSets.main.get().output)
- "testmodImplementation"(sourceSets["client"].output)
-}
-
-java {
- withSourcesJar()
- withJavadocJar()
-}
-
-tasks {
- processResources {
- val modId: String by project
- val modName: String by project
- val modDescription: String by project
- val githubProject: String by project
-
- inputs.property("id", modId)
- inputs.property("group", project.group)
- inputs.property("name", modName)
- inputs.property("description", modDescription)
- inputs.property("version", project.version)
- inputs.property("github", githubProject)
-
- filesMatching(listOf("fabric.mod.json", "quilt.mod.json")) {
- expand(
- "id" to modId,
- "group" to project.group,
- "name" to modName,
- "description" to modDescription,
- "version" to project.version,
- "github" to githubProject,
- )
- }
+ base.archivesName.set("yet-another-config-lib-${project.name}")
}
- register("releaseMod") {
- group = "mod"
+ ext["changelogText"] = changelogText
- dependsOn("modrinth")
- dependsOn("modrinthSyncBody")
- dependsOn("curseforge")
- dependsOn("publishModPublicationToReleasesRepository")
- dependsOn("githubRelease")
- }
-}
-
-val changelogText = file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided."
-
-val modrinthId: String by project
-if (modrinthId.isNotEmpty()) {
- modrinth {
- token.set(findProperty("MODRINTH_TOKEN")?.toString())
- projectId.set(modrinthId)
- versionNumber.set("${project.version}")
- versionType.set("release")
- uploadFile.set(tasks["remapJar"])
- gameVersions.set(listOf("1.19.4"))
- loaders.set(listOf("fabric", "quilt"))
- dependencies {
- required.project("fabric-api")
+ repositories {
+ mavenCentral()
+ maven("https://maven.terraformersmc.com/releases")
+ maven("https://maven.isxander.dev/releases")
+ maven("https://maven.isxander.dev/snapshots")
+ maven("https://maven.quiltmc.org/repository/release")
+ maven("https://api.modrinth.com/maven") {
+ name = "Modrinth"
+ content {
+ includeGroup("maven.modrinth")
+ }
}
- changelog.set(changelogText)
- syncBodyFrom.set(file("README.md").readText())
+ maven("https://jitpack.io")
}
-}
-val curseforgeId: String by project
-if (hasProperty("CURSEFORGE_TOKEN") && curseforgeId.isNotEmpty()) {
- curseforge {
- apiKey = findProperty("CURSEFORGE_TOKEN")
- project(closureOf<me.hypherionmc.cursegradle.CurseProject> {
- mainArtifact(tasks["remapJar"], closureOf<me.hypherionmc.cursegradle.CurseArtifact> {
- displayName = "${project.version}"
- })
-
- id = curseforgeId
- releaseType = "release"
- addGameVersion("1.19.4")
- addGameVersion("Fabric")
- addGameVersion("Java 17")
-
- changelog = changelogText
- changelogType = "markdown"
-
- relations(closureOf<me.hypherionmc.cursegradle.CurseRelation> {
- requiredDependency("fabric-api")
- })
- })
-
- options(closureOf<me.hypherionmc.cursegradle.Options> {
- forgeGradleIntegration = false
- })
+ pluginManager.withPlugin("publishing") {
+ val publishing = the<PublishingExtension>()
+
+ publishing.repositories {
+ val username = "XANDER_MAVEN_USER".let { System.getenv(it) ?: findProperty(it) }?.toString()
+ val password = "XANDER_MAVEN_PASS".let { System.getenv(it) ?: findProperty(it) }?.toString()
+ if (username != null && password != null) {
+ maven(url = "https://maven.isxander.dev/releases") {
+ name = "Releases"
+ credentials {
+ this.username = username
+ this.password = password
+ }
+ }
+ maven(url = "https://maven.isxander.dev/snapshots") {
+ name = "Snapshots"
+ credentials {
+ this.username = username
+ this.password = password
+ }
+ }
+ } else {
+ println("Xander Maven credentials not satisfied.")
+ }
+ }
}
}
githubRelease {
token(findProperty("GITHUB_TOKEN")?.toString())
- val githubProject: String by project
+ val githubProject: String by rootProject
val split = githubProject.split("/")
owner(split[0])
repo(split[1])
tagName("${project.version}")
targetCommitish(grgit.branch.current().name)
body(changelogText)
- releaseAssets(tasks["remapJar"].outputs.files)
+ releaseAssets(
+ { project(":fabric").tasks["remapJar"].outputs.files },
+ { project(":fabric").tasks["remapSourcesJar"].outputs.files },
+ { project(":forge").tasks["remapJar"].outputs.files },
+ { project(":forge").tasks["remapSourcesJar"].outputs.files },
+ )
}
-publishing {
- publications {
- create<MavenPublication>("mod") {
- groupId = "dev.isxander"
- artifactId = "yet-another-config-lib"
+tasks.register("releaseMod") {
+ group = "mod"
- from(components["java"])
- artifact(tasks["remapSourcesJar"])
- }
- }
+ dependsOn("githubRelease")
+}
- repositories {
- val username = "XANDER_MAVEN_USER".let { System.getenv(it) ?: findProperty(it) }?.toString()
- val password = "XANDER_MAVEN_PASS".let { System.getenv(it) ?: findProperty(it) }?.toString()
- if (username != null && password != null) {
- maven(url = "https://maven.isxander.dev/releases") {
- name = "Releases"
- credentials {
- this.username = username
- this.password = password
- }
- }
- maven(url = "https://maven.isxander.dev/snapshots") {
- name = "Snapshots"
- credentials {
- this.username = username
- this.password = password
- }
- }
- } else {
- println("Xander Maven credentials not satisfied.")
- }
- }
+tasks.register("buildAll") {
+ group = "mod"
+
+ dependsOn(project(":fabric").tasks["build"])
+ dependsOn(project(":forge").tasks["build"])
}