ViaForge/build.gradle
2021-09-10 17:55:16 +02:00

130 lines
3.7 KiB
Groovy

plugins {
id "java"
id "idea"
id "maven-publish"
id "net.minecraftforge.gradle" version "5.1.+"
id "org.spongepowered.mixin" version "0.7-SNAPSHOT"
id "com.github.johnrengelman.shadow" version "7.0.0"
}
version = "${minecraft_version}-${mod_version}"
group = "${mod_base_package}.${mod_id}"
archivesBaseName = mod_id
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
compileJava.options.encoding = "UTF-8"
minecraft {
mappings channel: mappings_channel, version: mappings_version
runs {
client {
workingDirectory project.file("run")
property 'forge.logging.markers', 'REGISTRIES'
property "forge.logging.console.level", "debug"
// mixin
property 'mixin.debug.export', 'true'
property "mixin.hotSwap", "true"
property "fml.coreMods.load", "de.enzaxd.viaforge.injection.MixinLoader"
if (project.hasProperty('mc_uuid'))
args '--uuid', project.getProperty('mc_uuid')
if (project.hasProperty('mc_username'))
args '--username', project.getProperty('mc_username')
if (project.hasProperty('mc_accessToken'))
args '--accessToken', project.getProperty('mc_accessToken')
args '-mixin.config=' + 'mixins.' + project.getProperty('mod_id') + '.json'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
maven { url = "https://repo.spongepowered.org/repository/maven-public" }
maven { url = "https://repo.viaversion.com" }
}
configurations {
include
implementation.extendsFrom(include)
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
include "org.spongepowered:mixin:${mixin_version}"
include "com.viaversion:viaversion:${viaversion_version}"
include "com.viaversion:viabackwards:${viabackwards_version}"
include "org.yaml:snakeyaml:1.29"
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
mixin {
add sourceSets.main, "mixins.${mod_id}.refmap.json"
}
jar {
manifest.attributes(
"Specification-Title": "viaforge",
"Specification-Vendor": "viaforge",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${archiveVersion}",
"Implementation-Vendor" :"viaforge",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": "0",
"FMLCorePluginContainsFMLMod": "de.enzaxd.viaforge.injection.MixinLoader",
"MixinConfigs": "mixins.${mod_id}.json"
)
enabled = false
}
shadowJar {
archiveFileName = jar.archiveFileName
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations = [project.configurations.include]
exclude "LICENSE.md"
exclude "dummyThing"
exclude "**/module-info.class"
exclude "*.so"
exclude "*.dylib"
exclude "*.dll"
exclude "*.jnilib"
exclude "ibxm/**"
exclude "com/jcraft/**"
exclude "org/lwjgl/**"
exclude "net/java/**"
exclude "META-INF/proguard/**"
exclude "META-INF/maven/**"
exclude "META-INF/versions/**"
exclude "META-INF/com.android.tools/**"
exclude "fabric.mod.json"
exclude "bungee.yml"
exclude "plugin.yml"
exclude "velocity-plugin.json"
exclude "LICENSE.txt"
}
reobf {
shadowJar {}
}
jar.dependsOn("shadowJar")