plugins {
    id 'com.github.johnrengelman.shadow'
    id 'java-library'
    id 'com.diffplug.spotless'
}

repositories {
    mavenCentral()
    maven { url uri("https://maven.fabricmc.net") }
    maven { url "https://maven.neoforged.net/releases" }
}

dependencies {
    annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
    compileOnly 'com.google.auto.service:auto-service:1.1.1'

    implementation 'com.google.code.gson:gson:2.10.1'
    shadow 'com.google.code.gson:gson:2.10.1'
    implementation 'com.google.auto:auto-common:1.2.1'
    shadow 'com.google.auto:auto-common:1.2.1'
    implementation 'com.google.guava:guava:21.0'
    shadow 'com.google.guava:guava:21.0'

    implementation project(":annotations")
    shadow project(":annotations")
    // Shadow annotations
    implementation 'net.fabricmc:sponge-mixin:0.12.5+'
    implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
    implementation 'net.minecraftforge:mergetool:1.1.7'
    implementation 'net.neoforged:mergetool:2.0.2'
}

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

shadowJar {
    dependencies {
        include(dependency('net.fabricmc:sponge-mixin:'))
        include(dependency('net.fabricmc:fabric-loader:'))
        include(dependency(':mergetool:'))
    }
    // shadowJar bug
    include '*.jar'
    include 'META-INF/services/javax.annotation.processing.Processor'
    include 'META-INF/gradle/incremental.annotation.processors'
    include 'org/spongepowered/asm/mixin/Mixin.class'
    include 'org/fury_phoenix/**/*'
    include {it.getName() == 'OnlyIn.class'}
    include {it.getName() == 'Dist.class'}
    include {it.getName() == 'Environment.class'}
    include {it.getName() == 'EnvType.class'}
}

spotless {
    java {
        removeUnusedImports()
    }
}
version = '1.1.4'
