plugins {
    id 'dev.architectury.loom' version '1.10-SNAPSHOT' apply false
    id 'architectury-plugin' version '3.4-SNAPSHOT'
    id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
    id 'co.uzzu.dotenv.gradle' version "4.0.0"
}

architectury {
    minecraft = project.minecraft_version
}

allprojects {
    group = rootProject.maven_group
    version = rootProject.mod_version
}

subprojects {
    apply plugin: 'dev.architectury.loom'
    apply plugin: 'architectury-plugin'

    base {
        archivesName = "$rootProject.archives_name-$project.name"
    }

    repositories {
        maven {
            name = "GitHubPackages"
            url = "https://maven.pkg.github.com/frqnny/omega-config-architectury"
            credentials {
                username = env.gpruser.value ?: System.getenv("USERNAME")
                password = env.gprkey.value ?: System.getenv("TOKEN")
            }
        }
    }

    dependencies {
        minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
        mappings loom.layered {
            it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
            it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
        }
    }

    java {
        withSourcesJar()

        sourceCompatibility = JavaVersion.VERSION_21
        targetCompatibility = JavaVersion.VERSION_21
    }

    tasks.withType(JavaCompile).configureEach {
        it.options.release = 21
    }
}
