|
| 1 | +plugins { |
| 2 | + id("fabric-loom") |
| 3 | + id("io.github.p03w.machete") |
| 4 | +} |
| 5 | + |
| 6 | +group = project.property("maven_group")!! |
| 7 | +version = "${project.property("version")}+${project.property("minecraft_cts8")}" |
| 8 | +base.archivesName = "AxolotlClient" |
| 9 | + |
| 10 | +repositories { |
| 11 | + maven { |
| 12 | + name = "CombatReforged" |
| 13 | + url = uri("https://maven.fabric.rizecookey.net/") |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +loom { |
| 18 | + intermediaryUrl.set("https://maven.fabric.rizecookey.net/net/fabricmc/intermediary/1.16_combat-6/intermediary-1.16_combat-6-v2.jar") |
| 19 | + |
| 20 | + mods { |
| 21 | + create("axolotlclient") { |
| 22 | + sourceSet("main") |
| 23 | + } |
| 24 | + create("axolotlclient-test") { |
| 25 | + sourceSet("test") |
| 26 | + } |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +dependencies { |
| 31 | + minecraft("com.mojang:minecraft:${project.property("minecraft_cts8")}") |
| 32 | + mappings("net.fabricmc:yarn:${project.property("mappings_cts8")}:v2") |
| 33 | + |
| 34 | + modImplementation("net.fabricmc:fabric-loader:${project.property("fabric_loader")}") |
| 35 | + |
| 36 | + modImplementation("net.fabricmc.fabric-api:fabric-networking-api-v1:1.0.5+3cc0f0907d") |
| 37 | + modImplementation("net.fabricmc.fabric-api:fabric-command-api-v1:1.1.3+3cc0f0907d") |
| 38 | + modImplementation("net.fabricmc.fabric-api:fabric-lifecycle-events-v1:1.2.2+3cc0f0907d") |
| 39 | + modImplementation("net.fabricmc.fabric-api:fabric-resource-loader-v0:0.4.8+3cc0f0907d") |
| 40 | + modImplementation("net.fabricmc.fabric-api:fabric-api-base:0.4.0+3cc0f0907d") |
| 41 | + |
| 42 | + modImplementation("io.github.axolotlclient:AxolotlClient-config:${project.property("config")}+1.16") { |
| 43 | + exclude(group = "com.terraformersmc") |
| 44 | + exclude(group = "org.lwjgl") |
| 45 | + } |
| 46 | + include("io.github.axolotlclient:AxolotlClient-config:${project.property("config")}+1.16") |
| 47 | + modImplementation("io.github.axolotlclient.AxolotlClient-config:AxolotlClientConfig-common:${project.property("config")}") |
| 48 | + |
| 49 | + modCompileOnlyApi("io.github.prospector:modmenu:1.14.9+build.14") |
| 50 | + |
| 51 | + implementation(include(project(path = ":common", configuration = "shadow"))!!) |
| 52 | + |
| 53 | + include("org.apache.logging.log4j:log4j-slf4j-impl:2.0-beta9") { |
| 54 | + exclude(group = "org.apache.logging.log4j", module = "log4j-api") |
| 55 | + exclude(group = "org.apache.logging.log4j", module = "log4j-core") |
| 56 | + } |
| 57 | + implementation(include("org.slf4j:slf4j-api:1.7.36")!!) |
| 58 | + localRuntime("org.slf4j:slf4j-jdk14:1.7.36") |
| 59 | + |
| 60 | + api("org.lwjgl:lwjgl-nanovg:3.3.2") |
| 61 | + runtimeOnly("org.lwjgl:lwjgl-nanovg:3.2.2:natives-linux") |
| 62 | + runtimeOnly("org.lwjgl:lwjgl-nanovg:3.2.2:natives-windows") |
| 63 | + runtimeOnly("org.lwjgl:lwjgl-nanovg:3.2.2:natives-macos") |
| 64 | +} |
| 65 | + |
| 66 | +tasks.processResources { |
| 67 | + inputs.property("version", version) |
| 68 | + |
| 69 | + filesMatching("fabric.mod.json") { |
| 70 | + expand("version" to version) |
| 71 | + } |
| 72 | +} |
| 73 | + |
| 74 | +tasks.runClient { |
| 75 | + classpath(sourceSets.getByName("test").runtimeClasspath) |
| 76 | +} |
| 77 | + |
| 78 | +java { |
| 79 | + withSourcesJar() |
| 80 | + |
| 81 | + sourceCompatibility = JavaVersion.VERSION_17 |
| 82 | + targetCompatibility = JavaVersion.VERSION_17 |
| 83 | +} |
| 84 | + |
| 85 | +// Configure the maven publication |
| 86 | +publishing { |
| 87 | + publications { |
| 88 | + create<MavenPublication>("mavenJava") { |
| 89 | + artifactId = project.name |
| 90 | + from(components["java"]) |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + repositories { |
| 95 | + maven { |
| 96 | + name = "owlMaven" |
| 97 | + val repository = if (project.version.toString().contains("beta") || project.version.toString() |
| 98 | + .contains("alpha") |
| 99 | + ) "snapshots" else "releases" |
| 100 | + url = uri("https://moehreag.duckdns.org/maven/$repository") |
| 101 | + credentials(PasswordCredentials::class) |
| 102 | + authentication { |
| 103 | + create<BasicAuthentication>("basic") |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +modrinth { |
| 110 | + token = System.getenv("MODRINTH_TOKEN") |
| 111 | + projectId = "p2rxzX0q" |
| 112 | + versionNumber = "${project.version}" |
| 113 | + versionType = "release" |
| 114 | + uploadFile = tasks.remapJar.get() |
| 115 | + gameVersions.set(listOf("1.16.3")) |
| 116 | + loaders.set(listOf("fabric", "quilt")) |
| 117 | + additionalFiles.set(listOf(tasks.remapSourcesJar)) |
| 118 | + |
| 119 | + // Changelog fetching: Credit LambdAurora. |
| 120 | + // https://github.com/LambdAurora/LambDynamicLights/blob/1ef85f486084873b5d97b8a08df72f57859a3295/build.gradle#L145 |
| 121 | + // License: MIT |
| 122 | + val changelogText = file("../CHANGELOG.md").readText() |
| 123 | + val regexVersion = |
| 124 | + ((project.version) as String).split("\\+")[0].replace("\\.".toRegex(), "/\\./").replace("\\+".toRegex(), "\\+") |
| 125 | + val changelogRegex = "###? ${regexVersion}\\n\\n(( *- .+\\n)+)".toRegex() |
| 126 | + val matcher = changelogRegex.find(changelogText) |
| 127 | + |
| 128 | + if (matcher != null) { |
| 129 | + var changelogContent = matcher.groups[1]?.value |
| 130 | + |
| 131 | + val changelogLines = changelogText.split("\n") |
| 132 | + val linkRefRegex = "^\\[([A-z0-9 _\\-/+.]+)]: ".toRegex() |
| 133 | + for (i in (changelogLines.size - 1)..0 step -1) { |
| 134 | + val line = changelogLines[i] |
| 135 | + if ((linkRefRegex.matches(line))) |
| 136 | + changelogContent += "\n" + line |
| 137 | + else break |
| 138 | + } |
| 139 | + changelog = changelogContent |
| 140 | + } else { |
| 141 | + afterEvaluate { |
| 142 | + tasks.modrinth.configure {isEnabled = false} |
| 143 | + } |
| 144 | + } |
| 145 | +} |
0 commit comments