The config is stored under `moonrise.yaml` in the working directory. Comments document each option.
112 lines
2.5 KiB
Groovy
112 lines
2.5 KiB
Groovy
plugins {
|
|
id 'fabric-loom' version '1.6.9'
|
|
id 'maven-publish'
|
|
id 'io.github.goooler.shadow' version '8.1.7'
|
|
}
|
|
|
|
/*
|
|
* 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()
|
|
}
|
|
|
|
version = project.mod_version + "+fabric." + getGitCommit()
|
|
group = project.maven_group
|
|
|
|
base {
|
|
archivesName = project.archives_base_name
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal {
|
|
mavenContent {
|
|
includeModule("ca.spottedleaf", "concurrentutil")
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations.implementation {
|
|
extendsFrom(configurations.shadow)
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
|
mappings loom.officialMojangMappings()
|
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
|
|
shadow('ca.spottedleaf:concurrentutil:0.0.1-SNAPSHOT')
|
|
shadow('org.yaml:snakeyaml:2.2')
|
|
}
|
|
|
|
processResources {
|
|
inputs.property "version", project.version
|
|
|
|
filesMatching("fabric.mod.json") {
|
|
expand "version": project.version, "minecraft_version": minecraft_version, "loader_version": loader_version, "mod_version": mod_version
|
|
}
|
|
}
|
|
|
|
loom {
|
|
accessWidenerPath = file("src/main/resources/moonrise.accesswidener")
|
|
mixin {
|
|
useLegacyMixinAp = false
|
|
}
|
|
}
|
|
|
|
// make build reproducible
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
|
preserveFileTimestamps = false
|
|
reproducibleFileOrder = true
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
it.options.release = 21
|
|
}
|
|
|
|
java {
|
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
|
// if it is present.
|
|
// If you remove this line, sources will not be generated.
|
|
withSourcesJar()
|
|
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
jar {
|
|
from("LICENSE") {
|
|
rename { "${it}_${project.base.archivesName.get()}"}
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
archiveClassifier = "dev-all"
|
|
destinationDirectory = layout.buildDirectory.dir("devlibs")
|
|
}
|
|
remapJar {
|
|
inputFile = shadowJar.archiveFile
|
|
}
|
|
|
|
shadowJar {
|
|
configurations = [project.configurations.shadow]
|
|
exclude("META-INF")
|
|
}
|
|
|
|
// configure the maven publication
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
from components.java
|
|
}
|
|
}
|
|
}
|
|
|