aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
diff options
context:
space:
mode:
authorXander <xandersmith2008@gmail.com>2022-08-30 16:53:16 +0100
committerXander <xandersmith2008@gmail.com>2022-08-30 16:53:16 +0100
commitd643a44c866504a642f9de0055417a82585d96e5 (patch)
tree199113aaa8b3dfb3c4c3191991c1501673e8da10 /build.gradle.kts
downloadYetAnotherConfigLib-d643a44c866504a642f9de0055417a82585d96e5.tar.gz
YetAnotherConfigLib-d643a44c866504a642f9de0055417a82585d96e5.tar.bz2
YetAnotherConfigLib-d643a44c866504a642f9de0055417a82585d96e5.zip
Initial commit
Diffstat (limited to 'build.gradle.kts')
-rw-r--r--build.gradle.kts159
1 files changed, 159 insertions, 0 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..db614c7
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,159 @@
+plugins {
+ java
+
+ id("fabric-loom") version "1.0.+"
+ id("io.github.juuxel.loom-quiltflower") version "1.7.+"
+
+ id("com.modrinth.minotaur") version "2.4.+"
+ id("me.hypherionmc.cursegradle") version "2.+"
+ id("com.github.breadmoirai.github-release") version "2.+"
+ id("io.github.p03w.machete") version "1.+"
+ `maven-publish`
+}
+
+group = "dev.isxander"
+version = "1.0.0"
+
+repositories {
+ mavenCentral()
+}
+
+val minecraftVersion: String by project
+val fabricLoaderVersion: String by project
+
+dependencies {
+ minecraft("com.mojang:minecraft:$minecraftVersion")
+ mappings("net.fabricmc:yarn:$minecraftVersion+build.+:v2")
+
+ modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
+}
+
+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,
+ )
+ }
+ }
+
+ remapJar {
+ archiveClassifier.set("fabric-$minecraftVersion")
+ }
+
+ remapSourcesJar {
+ archiveClassifier.set("fabric-$minecraftVersion-sources")
+ }
+
+ register("releaseMod") {
+ group = "mod"
+
+ dependsOn("modrinth")
+ dependsOn("modrinthSyncBody")
+ dependsOn("curseforge")
+ dependsOn("publish")
+ dependsOn("githubRelease")
+ }
+}
+
+java {
+ withSourcesJar()
+}
+
+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", "1.19.1", "1.19.2"))
+ loaders.set(listOf("fabric", "quilt"))
+ changelog.set(changelogText)
+ syncBodyFrom.set(file("README.md").readText())
+ }
+}
+
+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")
+ addGameVersion("1.19.1")
+ addGameVersion("1.19.2")
+ addGameVersion("Fabric")
+ addGameVersion("Java 17")
+
+ changelog = changelogText
+ changelogType = "markdown"
+ })
+
+ options(closureOf<me.hypherionmc.cursegradle.Options> {
+ forgeGradleIntegration = false
+ })
+ }
+}
+
+githubRelease {
+ token(findProperty("github.token")?.toString())
+
+ val githubProject: String by project
+ val split = githubProject.split("/")
+ owner(split[0])
+ repo(split[1])
+ tagName("${project.version}")
+ targetCommitish("1.19")
+ body(changelogText)
+ releaseAssets(tasks["remapJar"].outputs.files)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("mod") {
+ groupId = group.toString()
+ artifactId = base.archivesName.get()
+
+ from(components["java"])
+ }
+ }
+
+ repositories {
+ if (hasProperty("xander-repo.username") && hasProperty("xander-repo.password")) {
+ maven(url = "https://maven.isxander.dev/releases") {
+ credentials {
+ username = property("xander-repo.username")?.toString()
+ password = property("xander-repo.password")?.toString()
+ }
+ }
+ } else {
+ println("Xander Maven credentials not satisfied.")
+ }
+ }
+}