plugins {
    id 'rhino.library-conventions'
}

dependencies {
    testImplementation project(':testutils')
}

publishing {
    publications {
        rhino(MavenPublication) {
            from components.java
            artifacts = [jar, sourceJar, javadocJar]
            // We need to use the "withXml" method here, rather than the
            // "pom" element in Gradle, because we can't add the "parent"
            // attribute otherwise, and without it Maven Central verification
            // will fail.
            pom.withXml {
                def root = asNode()

                root.appendNode('description', "Rhino JavaScript runtime jar, excludes XML, tools, and ScriptEngine wrapper")
                root.appendNode("url", "https://mozilla.github.io/rhino/")

                def p = root.appendNode("parent")
                p.appendNode("groupId", "org.sonatype.oss")
                p.appendNode("artifactId", "oss-parent")
                p.appendNode("version", "7")

                def l = root.appendNode("licenses").appendNode("license")
                l.appendNode("name", "Mozilla Public License, Version 2.0")
                l.appendNode("url", "http://www.mozilla.org/MPL/2.0/index.txt")

                def scm = root.appendNode("scm")
                scm.appendNode("connection", "scm:git:git@github.com:mozilla/rhino.git")
                scm.appendNode("developerConnection", "scm:git:git@github.com:mozilla/rhino.git")
                scm.appendNode("url", "git@github.com:mozilla/rhino.git")

                def o = root.appendNode("organization")
                o.appendNode("name", "The Mozilla Foundation")
                o.appendNode("url", "http://www.mozilla.org")
            }
        }
    }
}
