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

String modversion = "2.5.4"

if (System.getenv("BUILD_NUMBER") != null && System.getenv("SHOW_BUILD_NUMBER") != null) {
	version = modversion + "_" + System.getenv("BUILD_NUMBER")
} else {
	version = modversion
}
group = "MCMultiPart2"
archivesBaseName = "MCMultiPart"

minecraft {
    version = "1.12.2-14.23.0.2494"
    runDir = "run"
    
    mappings = "snapshot_20171001"
	replace "%VERSION%", project.version
}

dependencies {
	// No deps!
}

processResources
{
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
                
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
        
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

jar {
}
task deobfJar(type: Jar) {
    from(sourceSets.main.output) {
        classifier = "deobf"
    }
}
artifacts {
    archives deobfJar
}

uploadArchives {
	if(System.getenv("LOCAL_MAVEN") != null) {
		repositories {
			mavenDeployer {
				repository(url: "file://" + System.getenv("LOCAL_MAVEN"))
				pom {
					groupId = project.group
					version = project.version
					if (System.getenv("MAVEN_ARTIFACT") != null) {
						artifactId = System.getenv("MAVEN_ARTIFACT")
					} else {
						artifactId = project.archivesBaseName
					}
					project {
						name project.archivesBaseName
						packaging 'jar'
						description 'MCMultiPart'
						url 'https://github.com/amadornes/MCMultiPart'
						scm {
							url 'https://github.com/amadornes/MCMultiPart'
							connection 'scm:git:git@github.com:amadornes/MCMultiPart.git'
							developerConnection 'scm:git:git@github.com:amadornes/MCMultiPart.git'
						}
						issueManagement {
							system 'github'
							url 'https://github.com/amadornes/MCMultiPart/issues'
						}
						licenses {
							license {
								name 'MIT'
								url 'https://github.com/amadornes/MCMultiPart/blob/master/LICENSE'
								distribution 'repo'
							}
						}
						developers {
							developer {
								id 'amadornes'
								name 'amadornes'
								roles { role 'developer' }
							}
						}
					}
				}
			}
		}
	}
}
