buildscript {
    repositories {
        mavenCentral()
        jcenter()
        maven {
            name = "forge"
            url = "https://maven.minecraftforge.net"
//            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = 'sponge'
            url = 'https://repo.spongepowered.org/maven'
        }
        maven {
            url = 'https://jitpack.io'
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
        classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
    }
}

apply plugin: 'net.minecraftforge.gradle.tweaker-client'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'java'

version = "Release"
group= "me.eldodebug"
archivesBaseName = "GlideClient"

sourceCompatibility = targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

minecraft {
    version = "1.8.9"
    tweakClass = "me.eldodebug.soar.injection.mixin.GlideTweaker"
    runDir = "run"
    mappings = "stable_22"
    clientJvmArgs = ["-XX:-DisableExplicitGC"]
    makeObfSourceJar = false
}

repositories {
    maven {
        name "jitpack"
        url "https://jitpack.io"
    }

    maven {
        name "spongepowered"
        url "https://repo.spongepowered.org/maven/"
    }
    jcenter()
    mavenCentral()
}

configurations {
    embed
    compile.extendsFrom(embed)
}

dependencies {
    embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
        exclude module: 'launchwrapper'
        exclude module: 'guava'
        exclude module: 'gson'
        exclude module: 'commons-io'
    }
    embed(files('libs/lwjgl-soar.jar'))
    embed(files('libs/lwjgl-soar-natives.jar'))
}

mixin {
    defaultObfuscationEnv = "notch"
    add sourceSets.main, "mixins.soar.refmap.json"
}

processResources {
    inputs.files "src/main/resources"
    outputs.dir "build/classes/main"
    copy {
        from("src/main/resources")
        into("build/classes/main")
    }
}

jar {
    dependsOn configurations.compile
    from {
        configurations.embed.collect {
            it.isDirectory() ? it : zipTree(it)
        }
    }
    exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}

jar {
    manifest.attributes(
            "MixinConfigs": 'mixins.soar.json',
            "TweakClass": 'me.eldodebug.soar.injection.mixin.GlideTweaker',
            "TweakOrder": 0,
            "Manifest-Version": 1.0,
            'FMLAT': 'soar_at.cfg'
    )

    configurations.embed.each { dep ->
        from(project.zipTree(dep)) {
            exclude 'META-INF', 'META-INF/**'
        }
    }
}
