buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'

// define the properties file
ext.configFile = file "build.properties"

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)
    ext.config = new ConfigSlurper().parse prop
}

group = "cr0s.warpdrive" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv("BUILD_NUMBER") ?: '-'}"
archivesBaseName = "WarpDrive"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

minecraft {
    version = config.minecraft_version + "-" + config.forge_version
    runDir = "eclipse"
    
    // the mappings can be changed at any time, and must be in the following format.
    // snapshot_YYYYMMDD   snapshot are built nightly.
    // stable_#            stables are built at the discretion of the MCP team.
    // Use non-default mappings at your own risk. they may not allways work.
    // simply re-run your setup task after changing the mappings to update your workspace.
    mappings = "snapshot_20160717"
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

    // replacing
    replace "@version@", project.version
    replaceIn "WarpDrive.java"
    replaceIn "MyDummyModContainer.java"
}

repositories {
    maven { // JEI & Tinkers
        name 'DVS1 Maven FS'
        url 'http://dvs1.progwml6.com/files/maven'
    }
    maven { // WAILA
        name "ProfMobius Maven FS"
        url "http://mobiusstrip.eu/maven"
    }
    maven { // OpenComputers
        name "OpenComputers"
        url "http://maven.cil.li/"
    }
    maven { // TOP
        name 'tterrag maven'
        url "http://maven.tterrag.com/"
    }
    maven { // CraftTweaker (aka MineTweaker3), Immersive Engineering
        name 'jared maven'
        url "http://blamejared.com/maven"
    }
    maven { // MCMultiPart
        name 'amadornes maven'
        url "http://maven.amadornes.com/"
    }
}

dependencies {
    // you may put jars on which you depend on in ./libs
    // or you may define them like so..
    //compile "some.group:artifact:version:classifier"
    //compile "some.group:artifact:version"
      
    // real examples
    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

    compileOnly "blusunrize:ImmersiveEngineering:0.10-+:deobf"
//  compileOnly "mezz.jei:jei_1.10.2:3.13.+"
//  compileOnly "mcp.mobius.waila:Waila:1.7.0-B3_1.9.4"
//  compileOnly "slimeknights.mantle:Mantle:1.10.2-1.+"
//  compileOnly "slimeknights:TConstruct:1.10.2-2.5.6.+"
    deobfCompile "li.cil.oc:OpenComputers:MC1.10.2-1.6.0.+"
//  compileOnly "mcjty.theoneprobe:TheOneProbe:1.10-1.0.13-26"
//  compileOnly "MineTweaker3:MineTweaker3-API:3.0.14.59"
    compileOnly "MCMultiPart:MCMultiPart:1.3.0+:universal"
}

processResources {
    // this will ensure that this task is redone when the versions change.
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version
    
    // skip source assets
    exclude '**/*.pdn'
    exclude '**/*.psd'
    
    // 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'
    }
}

jar {
    manifest {
        attributes FMLAT: "warpdrive_at.cfg"
        attributes FMLCorePlugin: "cr0s.warpdrive.core.FMLLoadingPlugin"
        attributes FMLCorePluginContainsFMLMod: "true"
    }
}

idea {
    module {
        inheritOutputDirs = true
    }
}

runClient {
    jvmArgs "-Xmx2048m", "-Xms2048m"
}

runServer {
    jvmArgs "-Xmx2048m", "-Xms2048m"
}