1 |
|
# Copyright 1999-2021 Gentoo Authors
|
|
1 |
# Copyright 1999-2022 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
# Skeleton command:
|
|
5 |
# java-ebuilder --generate-ebuild --workdir . --pom jmock/pom.xml --download-uri https://github.com/jmock-developers/jmock-library/archive/2.12.0.tar.gz --slot 2 --keywords "~amd64 ~arm64 ~ppc64 ~x86" --ebuild jmock-2.12.0.ebuild
|
5 |
6 |
|
6 |
|
JAVA_PKG_IUSE="doc source"
|
|
7 |
EAPI=8
|
|
8 |
|
|
9 |
JAVA_PKG_IUSE="doc source test"
|
|
10 |
MAVEN_ID="org.jmock:jmock:2.12.0"
|
|
11 |
JAVA_TESTING_FRAMEWORKS="junit-4"
|
7 |
12 |
|
8 |
13 |
inherit java-pkg-2 java-pkg-simple
|
9 |
14 |
|
10 |
|
DESCRIPTION="Library for testing Java code using mock objects"
|
|
15 |
DESCRIPTION="An expressive Mock Object library for Test Driven Development"
|
11 |
16 |
HOMEPAGE="http://jmock.org/"
|
12 |
|
SRC_URI="http://jmock.org/downloads/${P}-jars.zip"
|
|
17 |
SRC_URI="https://github.com/${PN}-developers/${PN}-library/archive/${PV}.tar.gz -> ${P}.tar.gz"
|
13 |
18 |
|
14 |
19 |
LICENSE="BSD"
|
15 |
|
SLOT="1.0"
|
16 |
|
KEYWORDS="amd64 ~arm arm64 ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
|
17 |
|
|
18 |
|
CDEPEND="dev-java/junit:0"
|
|
20 |
SLOT="2"
|
|
21 |
KEYWORDS="amd64 ~arm arm64 ppc64 x86"
|
19 |
22 |
|
20 |
|
RDEPEND=">=virtual/jre-1.8:*
|
21 |
|
${CDEPEND}"
|
22 |
|
|
23 |
|
DEPEND="app-arch/unzip
|
|
23 |
DEPEND="
|
|
24 |
dev-java/asm:9
|
|
25 |
dev-java/bsh:0
|
|
26 |
dev-java/hamcrest:0
|
24 |
27 |
>=virtual/jdk-1.8:*
|
25 |
|
${CDEPEND}"
|
|
28 |
test? (
|
|
29 |
dev-java/findbugs-annotations:0
|
|
30 |
dev-java/jaxws-api:0
|
|
31 |
)
|
|
32 |
"
|
|
33 |
|
|
34 |
RDEPEND=">=virtual/jre-1.8:*"
|
|
35 |
|
|
36 |
S="${WORKDIR}/jmock-library-${PV}"
|
|
37 |
|
|
38 |
JAVA_TEST_GENTOO_CLASSPATH="
|
|
39 |
findbugs-annotations
|
|
40 |
jaxws-api
|
|
41 |
junit-4
|
|
42 |
"
|
|
43 |
JAVA_TEST_SRC_DIR="jmock/src/test/java"
|
26 |
44 |
|
27 |
|
S="${WORKDIR}/${P}"
|
|
45 |
src_prepare() {
|
|
46 |
default
|
|
47 |
# We have "signed.jar" directly in ${S}, not in "../testjar/target/".
|
|
48 |
sed \
|
|
49 |
-e 's:\.\.\/testjar\/target\/\(signed.jar\):\1:' \
|
|
50 |
-i jmock/src/test/java/org/jmock/test/unit/lib/JavaReflectionImposteriserTests.java || die
|
|
51 |
}
|
28 |
52 |
|
29 |
|
JAVA_SRC_DIR="src"
|
30 |
|
JAVA_GENTOO_CLASSPATH="junit"
|
|
53 |
src_compile() {
|
|
54 |
if use test; then
|
|
55 |
einfo "Compiling testjar"
|
|
56 |
JAVA_SRC_DIR="testjar/src/main/java"
|
|
57 |
JAVA_CLASSPATH_EXTRA="findbugs-annotations"
|
|
58 |
JAVA_JAR_FILENAME="signed.jar"
|
|
59 |
java-pkg-simple_src_compile
|
|
60 |
cp {,un}signed.jar || die
|
|
61 |
JAVA_GENTOO_CLASSPATH_EXTRA+=":signed.jar:unsigned.jar"
|
|
62 |
rm -r target || die
|
|
63 |
fi
|
|
64 |
|
|
65 |
einfo "Compiling jmock.jar"
|
|
66 |
JAVA_SRC_DIR="jmock/src/main/java"
|
|
67 |
JAVA_CLASSPATH_EXTRA="
|
|
68 |
asm-9
|
|
69 |
bsh
|
|
70 |
hamcrest
|
|
71 |
"
|
|
72 |
JAVA_JAR_FILENAME="jmock.jar"
|
|
73 |
java-pkg-simple_src_compile
|
|
74 |
|
|
75 |
# Code generation according to jmock/pom.xml#L73-L90
|
|
76 |
"$(java-config -J)" \
|
|
77 |
-cp $(java-config --with-dependencies --classpath asm:9):${PN}.jar \
|
|
78 |
org.jmock.ExpectationsCreator
|
31 |
79 |
|
32 |
|
PATCHES=(
|
33 |
|
# This patch isn't changing the behaviour if jmock per se.
|
34 |
|
# Only the formatting is altered.
|
35 |
|
"${FILESDIR}"/${P}-AbstractMo.patch
|
36 |
|
)
|
37 |
|
|
38 |
|
src_unpack() {
|
39 |
|
unpack ${A}
|
40 |
|
unzip "${P}"/jmock-core-"${PV}".jar -d src || die
|
41 |
|
mv src "${P}" || die
|
|
80 |
# Update jmock.jar with updated Expectations.class
|
|
81 |
jar ufv jmock.jar -C target/classes org/jmock/Expectations.class || die
|
42 |
82 |
}
|
43 |
83 |
|
44 |
|
src_prepare() {
|
45 |
|
default
|
46 |
|
find -name "*.class" -delete || die
|
47 |
|
rm *.jar || die
|
|
84 |
src_test() {
|
|
85 |
# ${S}/pom.xml#L131-L143
|
|
86 |
pushd jmock/src/test/java || die
|
|
87 |
local JAVA_TEST_RUN_ONLY=$(find * \
|
|
88 |
\( -wholename "**/*Test.java" \
|
|
89 |
-o -wholename '**/*Tests.java' \)\
|
|
90 |
! -wholename "**/Failing*TestCase.java" \
|
|
91 |
! -wholename "**/VerifyingTestCaseTests$*" \
|
|
92 |
! -wholename "**/Abstract*Test.java" \
|
|
93 |
)
|
|
94 |
popd
|
|
95 |
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//.java}"
|
|
96 |
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//\//.}"
|
|
97 |
java-pkg-simple_src_test
|
48 |
98 |
}
|