apply plugin: 'java'
apply plugin: 'maven'
 
ext.channel = 'snapshot'
ext.dlVersion = '0'
ext.mcVersion = '1.15.2'
 
group = 'de.oceanlabs.mcp'
version = dlVersion + '-' + mcVersion
archivesBaseName = 'mcp_' + ext.channel
 
def downloadCSV(name) {
    mkdir 'mcp'
    def out = new File("$projectDir/mcp/" + name)
    new URL('http://export.mcpbot.bspk.rs/' + name).withInputStream{ i -> out.withOutputStream{ it << i }}
}

task downloadCSVs {
    downloadCSV('fields.csv')
    downloadCSV('methods.csv')
    downloadCSV('params.csv')
}

jar {
    extension = 'zip'
    from 'custom/fields.csv'
    from 'custom/methods.csv'
    from 'mcp/params.csv'
}
 
install {
    repositories.mavenInstaller {
        pom.groupId = project.group;
        pom.version = project.version
        pom.artifactId = 'mcp_' + project.channel
    }
}