buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = 'SpongePowered' url = 'http://repo.spongepowered.org/maven' } } dependencies { classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT" classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT' classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' } } ext.configFile = file "project.properties" apply plugin: "net.minecraftforge.gradle.forge" apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' configFile.withReader { // read config. it shall from now on be referenced as simply config or as project.config def prop = new Properties() prop.load(it) project.ext.config = new ConfigSlurper().parse prop } version = "${config.minecraft_version}-${config.mod_version}" if (hasProperty('appendBuildNumber')) { version = version + "-" + appendBuildNumber.toString() } group = "${config.group_id}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "${config.mod_id_cap}" minecraft { version = project.forgeVersion runDir = "run" mappings = project.mcpVersion coreMod = "me.zeroeightsix.kami.mixin.MixinLoaderForge" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } repositories { maven { name = 'spongepowered-repo' url = 'http://repo.spongepowered.org/maven/' } maven { name = 'impactdevelopment-repo' url = 'https://impactdevelopment.github.io/maven/' } maven { name = 'swt-repo' url = "http://maven-eclipse.github.io/maven" } maven { name = "jitpack.io" url = "https://jitpack.io" } mavenCentral() } dependencies { //mixin needs to be distributed with the mod, very important compile("org.spongepowered:mixin:0.7.4-SNAPSHOT") { exclude module: 'launchwrapper' exclude module: 'guava' exclude module: 'gson' exclude module: 'commons-io' } compile "com.github.ZeroMemes:Alpine:1.5" compile group: 'net.jodah', name: 'typetools', version: '0.5.0' compile group: 'org.yaml', name: 'snakeyaml', version: '1.19' compile(group: 'org.reflections', name: 'reflections', version: '0.9.11') { exclude group: 'com.google.guava', module: 'guava' } } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include "mcmod.info" // replace version and mcversion expand "version": project.version, "mcversion": project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude "mcmod.info" } // move _at.cfg into META-INF rename '(.+_at.cfg)', 'META-INF/$1' } mixin { defaultObfuscationEnv searge add sourceSets.main, "mixins.kami.refmap.json" } reobf { shadowJar { mappingType = 'SEARGE' classpath = sourceSets.main.compileClasspath } } import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar task shadowDevJar(type: ShadowJar) { classifier = 'dev-shaded' from sourceSets.main.output //from sourceSets.java8.output // Default settings for shadow tasks configurations = [project.configurations.runtime] manifest.inheritFrom tasks.jar.manifest exclude 'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA' } //shadowDevJar shadowConfiguration // Upload shadowDevJar to Maven repository artifacts { archives shadowDevJar } allprojects { // Re-obfuscate only after creating the shadowDevJar tasks.findByName('reobfJar')?.mustRunAfter rootProject.tasks.shadowDevJar } shadowJar { dependencies { include(dependency('org.spongepowered:mixin')) include(dependency('com.github.ZeroMemes:Alpine')) include(dependency('net.jodah:typetools')) include(dependency('org.yaml:snakeyaml')) include(dependency('org.reflections:reflections')) include(dependency('org.javassist:javassist')) } exclude 'dummyThing' exclude 'LICENSE.txt' classifier = 'full' } build.dependsOn(shadowJar) jar { manifest { attributes( "MixinConfigs": 'mixins.kami.json', "tweakClass": 'org.spongepowered.asm.launch.MixinTweaker', "TweakOrder": 0, 'FMLCorePluginContainsFMLMod': 'true', 'FMLCorePlugin': 'me.zeroeightsix.kami.mixin.MixinLoaderForge', 'ForceLoadAsMod': 'true', 'FMLAT': 'kami_at.cfg' ) } } sourceCompatibility = targetCompatibility = "1.8"