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

PortSystem          1.0
PortGroup           github 1.0
PortGroup           java 1.0

name                jmock1
github.setup        jmock-developers jmock-library 1.2.0
github.tarball_from archive
livecheck.type      none
revision            1

categories          java
platforms           any
supported_archs     noarch
license             BSD
maintainers         nomaintainer

description         Library for testing Java code using mock objects
long_description    jMock is a library that supports test-driven \
                    development of Java code with mock objects.  Mock \
                    objects help you design and test the interactions \
                    between the objects in your programs.
homepage            https://www.jmock.org/

set stealth_count   1
dist_subdir         ${name}/${version}_${stealth_count}

checksums           rmd160  ca3e50d645efeb6da987997417e60528751470e4 \
                    sha256  80a73edb96df0b73fbe5b8ee3d483089ec3a0c493320b1d76cf46b0730a4b976 \
                    size    481816

depends_build-append \
                    bin:ant:apache-ant

java.version        1.8+
java.fallback       openjdk11

patchfiles          bump-jdk-version.diff \
                    correct-version.diff

post-patch {
    reinplace "s|@@VERSION@@|${version}|g" ${worksrcpath}/build.xml
}

use_configure       no

build.cmd           ant
build.target        jars

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

    xinstall -d ${destjavadir}
    xinstall -m 644 \
        ${worksrcpath}/build/jmock-cglib-${version}.jar \
        ${destjavadir}/jmock-cglib.jar
    xinstall -m 644 \
        ${worksrcpath}/build/jmock-core-${version}.jar \
        ${destjavadir}/jmock-core.jar

    xinstall -d ${destdocdir}
    xinstall -m 644 \
        ${worksrcpath}/LICENSE.txt \
        ${worksrcpath}/overview.html \
        ${destdocdir}
}
