# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem              1.0
PortGroup               github 1.0
PortGroup               maven 1.0

github.setup            easymock objenesis 3.6
github.tarball_from     archive

categories              java
license                 Apache-2
platforms               any
supported_archs         noarch
homepage                https://objenesis.org
maintainers             {sethm.id.au:dev @McDaMastR} \
                        openmaintainer

description             Library for instantiating Java objects
long_description        It's pretty easy to instantiate objects in Java \
                        through standard reflection.  However there are many \
                        cases where you need to go beyond what reflection \
                        provides.  For example, if there's no public \
                        constructor, you want to bypass the constructor code, \
                        or set final fields.  There are numerous clever (but \
                        fiddly) approaches to getting around this and this \
                        library provides a simple way to get at them.

java.version            1.8+

checksums               rmd160  ec526fade5d32cf298b74e348be28c4106fd3058 \
                        sha256  3f85dd0af5bf5edc28cabb5148e4c3c37f54be9b32c86835078af64585745965 \
                        size    283086

destroot {
    set destdocdir  ${destroot}${prefix}/share/doc/${name}
    set destjavadir ${destroot}${prefix}/share/java

    xinstall -d ${destjavadir}
    xinstall -m 644 \
        ${worksrcpath}/main/target/${name}-${version}.jar \
        ${destjavadir}/${name}.jar
    xinstall -m 644 \
        ${worksrcpath}/exotic/target/${name}-exotic-${version}.jar \
        ${destjavadir}/${name}-exotic.jar
    xinstall -m 644 \
        ${worksrcpath}/tck/target/${name}-tck-${version}.jar \
        ${destjavadir}/${name}-tck.jar

    xinstall -d ${destdocdir}
    xinstall -m 644 \
        ${worksrcpath}/Benchmarks.md \
        ${worksrcpath}/CONTRIBUTING.md \
        ${worksrcpath}/LICENSE.txt \
        ${worksrcpath}/README.md \
        ${worksrcpath}/SECURITY.md \
        ${worksrcpath}/SupportedJVMs.md \
        ${destdocdir}

    if {[variant_isset doc]} {
        xinstall -d ${destdocdir}/javadoc
        foreach module {exotic main tck} {
            copy \
                ${worksrcpath}/${module}/target/reports/apidocs \
                ${destdocdir}/javadoc/${module}
        }
    }
}

variant doc \
        description {Install javadoc} {
    build.target-append javadoc:javadoc
}
