# -*- 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           maven 1.0

name                jmock2
github.setup        jmock-developers jmock-library 2.14.0
github.tarball_from archive
categories          java
license             BSD
maintainers         nomaintainer
platforms           any
supported_archs     noarch

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/

checksums           rmd160  5474af21c1f1baff09bd704698bfa718c737fec3 \
                    sha256  81eec9509566fd53f5e23ece1e9d4c7df972eabbfb6ae0ff1611b5315bf485e2 \
                    size    114028

java.version        1.8+
java.fallback       openjdk11

# Remove on next update if fixed!
patchfiles          correct-version.diff
post-patch {
    reinplace -W ${worksrcpath} \
        "s|@@VERSION@@|${version}|g" \
        pom.xml \
        jmock/pom.xml \
        jmock-example/pom.xml \
        jmock-imposters/pom.xml \
        jmock-imposters-testdata/pom.xml \
        jmock-imposters-tests/pom.xml \
        jmock-junit3/pom.xml \
        jmock-junit4/pom.xml \
        jmock-junit5/pom.xml \
        jmock-legacy/pom.xml \
        testjar/pom.xml
}

build.args-append   --projects !jmock-example \
                    --projects !jmock-imposters-testdata \
                    --projects !jmock-imposters-tests

destroot {
    set destdocdir  ${destroot}${prefix}/share/doc/${name}
    set destjavadir ${destroot}${prefix}/share/java/${name}
    set modules {
        jmock
        jmock-imposters
        jmock-junit3
        jmock-junit4
        jmock-junit5
        jmock-legacy
    }

    xinstall -d ${destjavadir}
    foreach module ${modules} {
        xinstall -m 644 \
            ${worksrcpath}/${module}/target/${module}-${version}.jar \
            ${destjavadir}/${module}.jar
    }

    xinstall -d ${destdocdir}
    xinstall -m 644 \
        ${worksrcpath}/LICENSE.txt \
        ${worksrcpath}/README.DEVELOPMENT \
        ${worksrcpath}/README.md \
        ${destdocdir}
}
