plugins {
    //id 'com.github.johnrengelman.shadow' version '7.1.2'
    id 'java'
    id 'modernfix.common-conventions'
}

group 'org.embeddedt'
archivesBaseName = 'modernfix-test-agent'
version '1.0'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
    mavenCentral()
    mavenLocal()
    maven {
        name = 'forge'
        url = 'https://maven.minecraftforge.net/'
    }
}

/*

shadowJar {
    relocate 'net.bytebuddy.agent', 'org.embeddedt.modernfix.testing.shadow.bytebuddyagent'
    relocate 'org.objectweb.asm', 'org.embeddedt.modernfix.testing.shadow.asm'
}



shadowJar {
    project.configurations.implementation.canBeResolved = true
    configurations = [project.configurations.implementation]
}
 */
dependencies {
    compileOnly "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
    implementation "org.ow2.asm:asm-tree:9.1"
    implementation "org.ow2.asm:asm-commons:9.1"
    implementation "org.ow2.asm:asm-util:9.1"

    //implementation('net.bytebuddy:byte-buddy-agent:1.12.22')
}

tasks.withType(JavaCompile) {
    // ensure that the encoding is set to UTF-8, no matter what the system default is
    // this fixes some edge cases with special characters not displaying correctly
    // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
    // If Javadoc is generated, this must be specified in that task too.
    options.encoding = "UTF-8"
}

jar {
    manifest {
        attributes(
                "Premain-Class": "org.embeddedt.modernfix.testing.Agent",
                "Can-Redefine-Classes": false,
                "Can-Set-Native-Method-Prefix": false
        )
    }
}
/*

shadowJar {
    archiveBaseName.set('modernfix-test-agent')
    archiveClassifier.set('')
    archiveVersion.set('v1')
}

 */

configurations {
    agentJar {
        canBeConsumed = true
        canBeResolved = false
    }
}

artifacts {
    agentJar(jar)
}
/*
project.tasks.shadowJar.dependsOn build
defaultTasks 'shadowJar'

 */