archivesBaseName = rootProject.name + "-" + project.name

dependencies {
    modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}")
    modApi("me.shedaniel.cloth:cloth-config:${cloth_config_version}")
    modApi("dev.architectury:architectury:${architectury_version}")
}

architectury {
    common(forgeEnabled.toBoolean())
}

remapJar {
    classifier "raw"
}

task fakeJar(type: Jar, dependsOn: remapJar) {
    from remapJar.archiveFile.map { zipTree(it) }
    from(rootProject.file("fake/fabric.mod.json")) {
        into ""
    }
    classifier null
}

task fakeForgeJar(type: Jar, dependsOn: remapJar) {
    from remapJar.archiveFile.map { zipTree(it) }
    from(rootProject.file("fake/fabric.mod.json")) {
        into ""
    }
    from(rootProject.file("fake/REIPlugin.class")) {
        into "me/shedaniel/rei/forge"
    }
    classifier "fake-forge"
}

artifacts {
    apiElements(fakeJar)
    runtimeElements(fakeJar)
}

afterEvaluate {
    configurations.apiElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) }
    configurations.runtimeElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) }
}

publishing {
    publications {
        mavenCommon(MavenPublication) {
            artifactId = rootProject.name + "-" + project.name
            from components.java
        }
    }
}
