# -*- 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                checkstyle
github.setup        ${name} ${name} 14.0.0 ${name}-
github.tarball_from archive

categories          java lang
platforms           any
supported_archs     noarch
license             LGPL-2.1
maintainers         nomaintainer

description         CheckStyle is a Java source code analyzer
long_description    Checkstyle is a Java source code analyzer. \
                    It automates the process of checking Java code, \
                    and can be made to support almost any coding \
                    standard.  It can also find class design problems, \
                    duplicate code, or bug patterns like \
                    double checked locking.

homepage            https://checkstyle.org
checksums           rmd160  dc16a1bc5060c39063ac17903ab4eb78ef20a034 \
                    sha256  6dd2580872bc83071a02fb569c7a314916025e8c88b8878ee720840ba6994002 \
                    size    8481680

java.version        21+
java.fallback       openjdk21

build.args-append   --activate-profiles assembly \
                    --activate-profiles no-validations

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

    xinstall -d \
        ${destbindir} \
        ${destdocdir} \
        ${destjavadir} \
        ${destxmldir}

    xinstall -m 755 ${filespath}/${name} ${destbindir}
    reinplace "s|@@PREFIX@@|${prefix}|g" ${destbindir}/${name}

    xinstall -m 644 \
        ${worksrcpath}/LICENSE \
        ${worksrcpath}/README.md \
        ${worksrcpath}/SECURITY.md \
        {*}[glob -directory ${worksrcpath}/docs/ *] \
        ${destdocdir}

    xinstall -m 644 \
        ${worksrcpath}/target/${name}-${version}.jar \
        ${destjavadir}/${name}.jar
    xinstall -m 644 \
        ${worksrcpath}/target/${name}-${version}-all.jar \
        ${destjavadir}/${name}-all.jar

    foreach config [glob -directory ${worksrcpath}/src/main/resources/ *.xml] {
        xinstall -m 644 ${config} ${destxmldir}
    }
}
