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

archivesBaseName = "${mod_name}-common-${minecraft_version}"

minecraft {
    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"))
            }
        }
    }
}

repositories {
    maven {
        url "https://cursemaven.com"
        content {
            includeGroup "curse.maven"
        }
    }
}

dependencies {
     compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
     implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'

    // CC: R and TARDIM
    //implementation("curse.maven:cc-restitched-462672:3908334")
    //compileOnly("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
    //compileOnly("curse.maven:tardim-531315:4453925")
    //implementation ("org.squiddev:cc-tweaked-1.19.1:${cc_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
        }
    }

    repositories {
        maven {
            url "file://" + System.getenv("local_maven")
        }
    }
}