plugins {
    id 'java'
    id 'com.github.johnrengelman.shadow' version '7.0.0'
    id 'com.coditory.manifest' version '0.1.14'
}

group 'com.extendedclip.papi.expansion.javascript'
version '2.1.3'
archivesBaseName = "Javascript-Expansion"

sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
    mavenCentral()
    maven {
        url = "https://repo.glaremasters.me/repository/public/"
    }
    maven {
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }

    maven {
        url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
    }
}

dependencies {
    implementation project(':evaluator')
    implementation project(':evaluator-api')
    compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
    compileOnly 'me.clip:placeholderapi:2.10.9'
    compileOnly 'org.jetbrains:annotations:21.0.1'
    testImplementation group: 'junit', name: 'junit', version: '4.12'
}

//shadowJar {
//    dependsOn(project(':evaluator').shadowJar)
//    doFirst {
//        copy {
//            from project(':evaluator').getTasks().getByName("shadowJar").outputs.files.singleFile
//            into layout.buildDirectory.file("resources/main/")
//            include('*.jar')
//        }
//    }
//}

shadowJar {
    doFirst {
        copy {
            from project(':evaluator').getProjectDir().toPath().resolve("libs").toFile()
            into layout.buildDirectory.file("resources/main/")
            include('*.jar')
            rename ('(.*).jar', '$1.isolated-jar')
        }
    }
    relocate 'io.github.slimjar', 'com.extendedclip.papi.expansion.javascript.slimjar'
}
