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

PortSystem          1.0
PortGroup           github 1.0

github.setup        cpisciotta xcbeautify 1.6.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
categories          devel
license             MIT
maintainers         {landonf @landonf} openmaintainer

description         A beautifier tool for xcodebuild, SPM, and bazel output.
long_description    {*}${description}

checksums           rmd160  c0d47cac4e27c8df0e597ba742f9d620f8c4d108 \
                    sha256  0836fa0d68f7dfec8145ff4456d5fc0fd9c03532896cc58a203b98921da44986 \
                    size    4182321

# TODO: 
set xcodeversion_min_required 11.4
pre-fetch {
    if {[vercmp ${xcodeversion} ${xcodeversion_min_required}] < 0} {
        ui_error "${name} @${version} requires Xcode ${xcodeversion_min_required} or later but you have Xcode ${xcodeversion}."
        ui_error "See https://guide.macports.org/chunked/installing.xcode.html for download links."
        return -code error "incompatible Xcode version"
    }
}

use_configure       no
use_xcode           yes

build.cmd           swift
build.target        build
build.args          --configuration release \
                    --arch ${configure.build_arch} \
                    --disable-sandbox

destroot {
    xinstall -m 0755 ${worksrcpath}/.build/${configure.build_arch}-apple-macosx/release/${name} \
        ${destroot}${prefix}/bin/${name}
}
