plugins {
    id 'fabric-loom' version '0.12-SNAPSHOT'
    id 'maven-publish'
    id 'idea'
}

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

dependencies {
    minecraft "com.mojang:minecraft:${minecraft_version}"
    mappings loom.officialMojangMappings()
    modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
    modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
    implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
    implementation project(":Common")

    // Blame CC: Restitched for this...
    modApi 'com.electronwill.night-config:core:3.6.3'
    modApi 'com.electronwill.night-config:toml:3.6.3'
    modApi 'org.squiddev:Cobalt:0.5.5'
    modImplementation "io.netty:netty-codec-http:4.1.77.Final"

    modImplementation "curse.maven:tardim-531315:4453924"
    //modImplementation "curse.maven:cc-restitched-462672:3908334"
    //.. maybe?
    modApi "curse.maven:cc-restitched-462672:3908334"
    modCompileOnly "curse.maven:cc-restitched-462672:3908334"

    // Create!
    modCompileOnly "curse.maven:create-fabric-624165:4597892"
}

loom {
    runs {
        client {
            client()
            setConfigName("Fabric Client")
            ideConfigGenerated(true)
            runDir("run")
        }
        server {
            server()
            setConfigName("Fabric Server")
            ideConfigGenerated(true)
            runDir("run")
        }
    }
}


processResources {
    from project(":Common").sourceSets.main.resources
    inputs.property "version", project.version

    filesMatching("fabric.mod.json") {
        expand "version": project.version
    }
}

tasks.withType(JavaCompile) {
    source(project(":Common").sourceSets.main.allSource)
}

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

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