summaryrefslogtreecommitdiff
path: root/libre/junit/PKGBUILD
blob: 24ff83bfbdc912842b758d16740f0de169286efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Maintainer (Arch): Guillaume ALAUX <Guillaume at Arch Linux dot org>
# Rationale: Arch version isn't built from source.
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=junit
_pkgname=junit5
pkgver=5.8.2
pkgrel=1.parabola1
pkgdesc='Simple JVM framework to write repeatable tests'
arch=('any')
url='http://www.junit.org/'
license=('Apache' 'EPL')
depends=('java-runtime' 'java-hamcrest')
makedepends=('apache-ant' 'apiguardian' 'jh')
source=("https://github.com/junit-team/${_pkgname}/archive/r${pkgver}.tar.gz")
sha512sums=('d4e7bf23aa736ab17badef59f690cb0040e438d31368c4727b1209c774a30e0cdfea7f206901eb5af3714c019893ac4768d16e8207219662d885c19a66955f7e')

_artifacts=(junit-platform-commons)
            # junit-jupiter-api
            # junit-jupiter-engine
            # junit-jupiter-migrationsupport
            # junit-jupiter-params
            # junit-platform-console
            # junit-platform-engine
            # junit-platform-jfr
            # junit-platform-launcher
            # junit-platform-reporting
            # junit-platform-runner
            # junit-platform-suite-api
            # junit-platform-suite-commons
            # junit-platform-suite-engine
            # junit-platform-testkit
            # junit-vintage-engine

_artifact_package_name() {
    artifact="$1"
    # remove "^junit-"
    artifact="$(echo ${artifact} | sed 's#^junit-##')"
    left="$(echo ${artifact} | sed 's#-.*##')"
    right="$(echo ${artifact} | sed 's#.*-##')"
    echo "org.${pkgname}.${left}.${right}"
}

prepare() {
  cd "${srcdir}/${_pkgname}-r${pkgver}"

  mkdir -p "${srcdir}/dist"
  for artifact in ${_artifacts[@]}; do
    mkdir -p "build/${artifact}/classes"
    mkdir -p "source/${artifact}/"
  done
}

build() {
    cd "${srcdir}/${_pkgname}-r${pkgver}"

    CLASSPATH="/usr/share/java/apiguardian.jar:../dist"
    for artifact in ${_artifacts[@]}; do
        javac \
            -classpath "${CLASSPATH}" \
            -d "build/${artifact}/classes" \
            -encoding UTF-8 \
            $(find "${artifact}/src/main/java" -name \*.java)

        jar -cvf \
            "${srcdir}/dist/${pkgname}.${artifact}.jar" \
            -C "build/${artifact}/classes" .

        javadoc \
            -classpath "${CLASSPATH}" \
            -d "build/javadoc" \
            -encoding UTF-8 \
            -sourcepath "${artifact}/src/main/java" \
            "$(_artifact_package_name ${artifact})"
    done
}

package() {
    cd "${srcdir}/${_pkgname}-r${pkgver}"

    # Install license files
    install -Dm644 \
            LICENSE.md \
            LICENSE-notice.md \
            -t "${pkgdir}/usr/share/licenses/${pkgname}/"

    install -Dm644 \
            junit-jupiter-params/LICENSE-univocity-parsers.md \
            -t "${pkgdir}/usr/share/licenses/${pkgname}/junit-jupiter-params/"

    install -Dm644 \
            junit-platform-console/LICENSE-picocli.md \
            -t "${pkgdir}/usr/share/licenses/${pkgname}/junit-platform-console/"

    # Install documentation
    # install -d "${pkgdir}/usr/share/doc/${pkgname}"
    # cp -r "${pkgname}${pkgver}/javadoc" "${pkgdir}/usr/share/doc/${pkgname}"

    export DESTDIR="$pkgdir"
    jh mvn-install ${pkgname} ${pkgname} ${pkgver} \
       pom.xml \
       "${pkgname}${pkgver}/${pkgname}-${pkgver}.jar" \
       "${pkgname}.jar"

    ln -s "/usr/share/java/${pkgname}.jar" \
       "${pkgdir}/usr/share/java/${pkgname}-${pkgver}.jar"
}