summaryrefslogtreecommitdiff
path: root/pcr/mockito/PKGBUILD
blob: 7cf557dbe81492b42a21924220a76bbcf9380c0e (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
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=mockito
pkgver=1.10.19
pkgrel=1
pkgdesc="Mocking framework for Java"
arch=('any')
url="https://github.com/mockito/mockito"
license=('MIT')
depends=('java-runtime')
makedepends=('cglib' 'java-environment' 'java-hamcrest' 'jh' 'junit' 'objenesis')
source=("https://github.com/${pkgname}/${pkgname}/archive/v${pkgver}.tar.gz"
        "https://repo1.maven.org/maven2/org/${pkgname}/${pkgname}-core/${pkgver}/${pkgname}-core-${pkgver}.pom"
        "mockito-use_system_libraries.patch"
        "mockito-hamcrest_interfaces.patch")
md5sums=('6e7d57d5f58fc551880d3e4685c7f569'
         'a96d6f1ec0e75e890e98cc4a8d4bed62'
         '802ddd127fdedfa2f8f9390ca0292ca3'
         '00a64b1b14a9ce6e7be878d16dbecaa8')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -Np1 -i "${srcdir}/mockito-use_system_libraries.patch"
  patch -Np1 -i "${srcdir}/mockito-hamcrest_interfaces.patch"
  rm -v $(find . -name \*.jar)
  mkdir -p build/classes
}

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

  CLASSPATH="/usr/share/java/cglib.jar:/usr/share/java/hamcrest-core.jar"
  CLASSPATH="$CLASSPATH:/usr/share/java/junit.jar:/usr/share/java/objenesis.jar"
  javac -classpath $CLASSPATH -d "build/classes" \
    $(find "src" -name \*.java)
  javadoc -classpath $CLASSPATH -d "build/javadoc" \
    -sourcepath "src" -subpackages org

  jar -cvf "${pkgname}.jar" -C "build/classes" .
}

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

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

  # Install Maven artifacts
  export DESTDIR=${pkgdir}
  jh mvn-install "org.mockito" "${pkgname}-core" ${pkgver} \
    "${srcdir}/${pkgname}-core-${pkgver}.pom" \
    "${pkgname}.jar" \
    "${pkgname}.jar"
  ln -s "/usr/share/java/${pkgname}.jar" \
    "${pkgdir}/usr/share/java/${pkgname}-${pkgver}.jar"
}