plugins {
    id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
}

base.archivesName.set("${mod_name}-common")

minecraft {
    accessWideners(project.file("src/main/resources/terrablender.accesswidener"))
    version(minecraft_version)
    runs {   
        if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) {
        
            server(project.hasProperty('common_server_run_name') ? project.findProperty('common_server_run_name') : 'vanilla_server') {
                workingDirectory(this.file("run"))
            }
            client(project.hasProperty('common_client_run_name') ? project.findProperty('common_client_run_name') : 'vanilla_client') {
                workingDirectory(this.file("run"))
            }
        }
    }
}

dependencies {
    compileOnly group:'org.spongepowered', name: 'mixin', version: '0.8.5'
    compileOnly("com.electronwill.night-config:toml:${nightconfig_version}")
    compileOnly("com.electronwill.night-config:core:${nightconfig_version}")
}

processResources {
    def buildProps = project.properties.clone()

    filesMatching(['pack.mcmeta']) {
        expand buildProps
    }
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            groupId project.group
            artifactId project.archivesBaseName
            version project.version
            from components.java

            pom {
                name = 'TerraBlender-common'
                description = "A library mod for adding biomes in a simple and compatible manner with Minecraft's new biome/terrain system."
                url = 'https://github.com/Glitchfiend/TerraBlender'
                scm {
                    url = 'https://github.com/Glitchfiend/TerraBlender'
                    connection = 'scm:git:git://github.com/Glitchfiend/TerraBlender.git'
                    developerConnection = 'scm:git:git@github.com:Glitchfiend/TerraBlender.git'
                }
                issueManagement {
                    system = 'github'
                    url = 'https://github.com/Glitchfiend/TerraBlender/issues'
                }
                licenses {
                    license {
                        name = 'LGPLv3'
                        url = 'https://www.gnu.org/licenses/lgpl-3.0.txt'
                    }
                }
                developers {
                    developer {
                        id = 'adubbz'
                        name = 'Adubbz'
                    }
                }
            }
        }
    }
    repositories {
        maven {
            url = "https://maven.minecraftforge.net/releases/"
            credentials {
                username = System.getenv("MAVEN_USER")
                password = System.getenv("MAVEN_PASSWORD")
            }
        }
    }
}

tasks.register("idePostSync")
