160 lines
4.3 KiB
Groovy
160 lines
4.3 KiB
Groovy
import me.modmuss50.mpp.ReleaseType
|
|
|
|
plugins {
|
|
id("xyz.jpenilla.quiet-architectury-loom")
|
|
id("me.modmuss50.mod-publish-plugin") version "0.7.2" apply false
|
|
}
|
|
|
|
/*
|
|
* Gets the version name from the latest Git tag
|
|
*/
|
|
// https://stackoverflow.com/questions/28498688/gradle-script-to-autoversion-and-include-the-commit-hash-in-android
|
|
def getGitCommit = { ->
|
|
def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim()
|
|
}
|
|
|
|
|
|
dependencies {
|
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
|
|
api("ca.spottedleaf:concurrentutil:${rootProject.concurrentutil_version}")
|
|
api("org.yaml:snakeyaml:${rootProject.snakeyaml_version}")
|
|
|
|
modImplementation "me.shedaniel.cloth:cloth-config:${rootProject.cloth_version}"
|
|
}
|
|
|
|
File awFile = file("src/main/resources/moonrise.accesswidener")
|
|
|
|
allprojects {
|
|
group = rootProject.maven_group
|
|
version = rootProject.mod_version + "+" + getGitCommit()
|
|
|
|
plugins.apply("xyz.jpenilla.quiet-architectury-loom")
|
|
|
|
java {
|
|
withSourcesJar()
|
|
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal {
|
|
mavenContent {
|
|
includeModule("ca.spottedleaf", "concurrentutil")
|
|
}
|
|
}
|
|
maven {
|
|
url "https://api.modrinth.com/maven"
|
|
mavenContent {
|
|
includeGroup("maven.modrinth")
|
|
}
|
|
}
|
|
maven { url "https://maven.shedaniel.me/" }
|
|
maven { url "https://maven.terraformersmc.com/releases/" }
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
|
mappings loom.officialMojangMappings()
|
|
}
|
|
|
|
// make build reproducible
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
|
preserveFileTimestamps = false
|
|
reproducibleFileOrder = true
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.release = 21
|
|
}
|
|
|
|
tasks.jar.configure {
|
|
from(rootProject.file("LICENSE")) {
|
|
rename { "${it}_${rootProject.base.archivesName.get()}"}
|
|
}
|
|
}
|
|
|
|
loom {
|
|
accessWidenerPath = awFile
|
|
mixin {
|
|
useLegacyMixinAp = false
|
|
}
|
|
}
|
|
}
|
|
|
|
subprojects {
|
|
loom.mods {
|
|
main {
|
|
sourceSet("main")
|
|
sourceSet("main", project.rootProject)
|
|
}
|
|
}
|
|
loom.runs.all {
|
|
ideConfigGenerated true
|
|
property "mixin.debug", "true"
|
|
property "Moonrise.MaxViewDistance", "128"
|
|
}
|
|
|
|
plugins.apply("me.modmuss50.mod-publish-plugin")
|
|
|
|
publishMods {
|
|
file = remapJar.archiveFile
|
|
if (project.version.contains("-beta.")) {
|
|
type = ReleaseType.BETA
|
|
} else {
|
|
type = ReleaseType.STABLE
|
|
}
|
|
changelog = providers.environmentVariable("RELEASE_NOTES")
|
|
|
|
List<String> supportedMcVersions = rootProject.supported_minecraft_versions.split(',')
|
|
|
|
modrinth {
|
|
projectId = "KOHu7RCS"
|
|
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
|
|
minecraftVersions = supportedMcVersions
|
|
}
|
|
|
|
curseforge {
|
|
projectId = "1096335"
|
|
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
|
|
minecraftVersions = supportedMcVersions
|
|
}
|
|
}
|
|
|
|
// Setup a run with lithium for compatibility testing
|
|
sourceSets.create("lithium")
|
|
configurations.create("lithium")
|
|
loom {
|
|
createRemapConfigurations(sourceSets.lithium)
|
|
runs {
|
|
register("lithiumClient") {
|
|
client()
|
|
property "mixin.debug", "true"
|
|
}
|
|
}
|
|
}
|
|
tasks.named("runLithiumClient", net.fabricmc.loom.task.RunGameTask.class) {
|
|
getClasspath().from(configurations.modRuntimeClasspathLithiumMapped)
|
|
}
|
|
dependencies {
|
|
String coordinates = "maven.modrinth:lithium:"
|
|
if (getProject().name == "Moonrise-NeoForge") {
|
|
coordinates += rootProject.neo_lithium_version
|
|
} else {
|
|
coordinates += rootProject.fabric_lithium_version
|
|
}
|
|
modLithiumRuntimeOnly coordinates
|
|
}
|
|
}
|
|
|
|
loom.runs.all {
|
|
ideConfigGenerated false
|
|
}
|