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

github.setup            apiguardian-team apiguardian 1.1.2 r
github.tarball_from     archive

categories              java devel
license                 Apache-2
platforms               any
supported_archs         noarch
maintainers             {sethm.id.au:dev @McDaMastR} \
                        openmaintainer

description             Java annotation for documenting @API status
long_description        @API Guardian is a Java library that provides the @API \
                        annotation that is used to annotate public types, \
                        methods, constructors, and fields within a framework \
                        or application in order to publish their status and \
                        level of stability and to indicate how they are \
                        intended to be used by consumers of the API.

depends_build-append    port:gradle8

# Building requires Java == 11
# Running requires Java >= 6
java.version            11

set gradle_home         ${workpath}/.home/.gradle

checksums               rmd160  b764d19ef535c0c4d2c916a8497bf1ba7c3fb8f6 \
                        sha256  59655868b2f301868ae85745d3e003e17f7d75608f9d5dac8879c3f5d0e970ec \
                        size    67267

use_configure           no

build.cmd               gradle8
build.target            build
build.args              --no-daemon \
                        --exclude-task=check \
                        --exclude-task=javadocJar \
                        --exclude-task=sourcesJar \
                        --gradle-user-home="${gradle_home}" \
                        --max-workers=${build.jobs}

test.run                yes
test.target             check
test.args               --no-daemon \
                        --gradle-user-home="${gradle_home}" \
                        --max-workers=${build.jobs}

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

    xinstall -d ${destjavadir}
    xinstall -W ${worksrcpath} -m 644 \
        build/libs/${name}-api-${version}.jar \
        ${destjavadir}/${name}-api.jar

    xinstall -d ${destdocdir}
    xinstall -W ${worksrcpath} -m 644 \
        LICENSE \
        README.md \
        ${destdocdir}

    if {[variant_isset doc]} {
        copy ${worksrcpath}/build/docs/javadoc ${destdocdir}
    }
}

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