plugins {
    id "com.gradleup.shadow"
}

architectury {
    platformSetupLoomIde()
    neoForge()
}

loom {
    accessWidenerPath = project(":common").loom.accessWidenerPath
}

configurations {
    common
    shadowCommon
    compileClasspath.extendsFrom common
    runtimeClasspath.extendsFrom common
    developmentNeoForge.extendsFrom common
}

dependencies {
    neoForge "net.neoforged:neoforge:${forge_version}"

    common(project(path: ":common", configuration: "namedElements")) { transitive = false }
    shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }
}

shadowJar {
    exclude "fabric.mod.json"

    configurations = [project.configurations.shadowCommon]
    archiveClassifier.set "dev-shadow"
}

remapJar {
    atAccessWideners.add(loom.accessWidenerPath.get().asFile.name)

    inputFile.set shadowJar.archiveFile
    dependsOn shadowJar
    archiveClassifier.set null
}

jar {
    archiveClassifier.set "dev"
}

sourcesJar {
    def commonSources = project(":common").sourcesJar
    dependsOn commonSources
    from commonSources.archiveFile.map { zipTree(it) }
}

shadow {
    addShadowVariantIntoJavaComponent = false
}

publishing {
    publications {
        mavenNeoForge(MavenPublication) {
            artifactId = rootProject.archives_base_name
            from components.java
        }
    }
}
