import org.gradle.plugins.ide.eclipse.model.AccessRule

plugins {
    id 'java-library'
    id 'eclipse'
}

dependencies {
    api project(':refdiff-core')
    implementation 'com.eclipsesource.j2v8:j2v8_win32_x86_64:4.6.0'
    implementation 'com.eclipsesource.j2v8:j2v8_linux_x86_64:4.6.0'
    implementation 'com.eclipsesource.j2v8:j2v8_macosx_x86_64:4.6.0'
    
    testImplementation 'junit:junit:4.11'
    testImplementation project(path: ':refdiff-core', configuration: 'testArtifacts')
}

eclipse {
    classpath {
        file {
            whenMerged {
                def jre = entries.find { it.path.contains 'org.eclipse.jdt.launching.JRE_CONTAINER' }
                jre.accessRules.add(new AccessRule('accessible', 'jdk/nashorn/api/**'))
            }
        }
    }
}

java {
    withJavadocJar()
    withSourcesJar()
}

publishing {
    publications {
        refdiffJs(MavenPublication) {
            artifactId = project.name
            from components.java
            pom pomConfig('JavaScript plugin for RefDiff', 'JavaScript language plugin for RefDiff')
        }
    }
}

signing {
    sign publishing.publications.refdiffJs
}
