buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "https://maven.minecraftforge.net/"
        }
        maven {
            url = "https://plugins.gradle.org/m2/"
        }
        maven {
            name 'FancyGradle'
            url 'https://gitlab.com/api/v4/projects/26758973/packages/maven'
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.69'
        classpath group: 'wtf.gofancy.fancygradle', name: 'wtf.gofancy.fancygradle.gradle.plugin', version: '1.1.+'
    }
}

plugins {
    id "com.github.hierynomus.license" version "0.16.1"
}

apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'wtf.gofancy.fancygradle'

fancyGradle {
    patches {
        resources
        coremods
        codeChickenLib
        asm
    }
}

version = "0.10.15-1.12.2"
group= "pl.asie.foamfix" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "foamfix"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

minecraft {
    mappings channel: "stable", version: "39-1.12"

    runs {
        client {
            workingDirectory project.file('run')
            jvmArgs '-Dfml.coreMods.load=pl.asie.foamfix.coremod.FoamFixCore'

            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
            property 'forge.logging.console.level', 'debug'

            mods {
                foamfix {
                    source sourceSets.main
                }
            }
        }
        server {
            jvmArgs '-Dfml.coreMods.load=pl.asie.foamfix.coremod.FoamFixCore'

            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
            property 'forge.logging.console.level', 'debug'

            mods {
                foamfix {
                    source sourceSets.main
                }
            }
        }
    }

    accessTransformer = file('src/main/resources/foamfix_at.cfg')
}

repositories {
	mavenCentral()
}

license {
/*	sourceSets = [project.sourceSets.main] */
	header = project.file("docs/licenses/COPYING")
	ignoreFailures = true
	exclude '***.lang'
	exclude '***.info'
	exclude '***.mcmeta'

	matching('**pl/asie/foamfix/api**') {
		header = project.file("docs/licenses/LICENSE-API")
	}

	matching('**pl/asie/foamfix/common/WorldNuller.java') {
		header = project.file("docs/licenses/LICENSE-neptunepink")
	}
}

repositories {
	maven {
		name 'DVS1 Maven FS'
		url 'https://dvs1.progwml6.com/files/maven'
	}
}

dependencies {
    minecraft "net.minecraftforge:forge:1.12.2-14.23.5.2860"

    compileOnly fg.deobf("mezz.jei:jei_1.12.2:4.15.0.291")
    compileOnly "org.openjdk.jmh:jmh-generator-annprocess:1.20"
}

processResources {
    inputs.property "version", "${project.version}"
    inputs.property "mcversion", "1.12.2"
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    filesMatching(['mcmod.info']) {
        expand 'version':"${project.version}", 'mcversion':'1.12.2'
    }
}

jar {
    exclude("META-INF/BenchmarkList")
    exclude("META-INF/CompilerHints")
    exclude("assets/foamfix/flamingo.png")
    exclude("pl/asie/foamfix/client/dolphin")
    exclude("pl/asie/foamfix/tests")
    exclude("foamfix_at.cfg")
    manifest {
        attributes FMLCorePlugin: "pl.asie.foamfix.coremod.FoamFixCore"
        attributes FMLCorePluginContainsFMLMod: "true"
    }
}
