summaryrefslogtreecommitdiff
blob: 1f7c874c2500d63180e57f7bce8ec3dcf7bef074 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

JAVA_PKG_IUSE="doc source test"
MAVEN_ID="com.tngtech.junit.dataprovider:junit-dataprovider:2.9"
JAVA_TESTING_FRAMEWORKS="junit-4"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="The common core for a TestNG like dataprovider runner for JUnit"
HOMEPAGE="https://github.com/TNG/junit-dataprovider"
SRC_URI="https://github.com/TNG/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm arm64 ppc64 x86"

CP_DEPEND="dev-java/findbugs-annotations:0"

DEPEND="
	>=virtual/jdk-1.8:*
	${CP_DEPEND}
	dev-java/junit:4
	test? (
		dev-java/assertj-core:3
		dev-java/mockito:4
	)
"

RDEPEND="
	>=virtual/jre-1.8:*
	${CP_DEPEND}
"

DOCS=( {CODE-OF-CONDUCT,CONTRIBUTING,README,SECURITY}.md NOTICE )

S="${WORKDIR}/${PN}-${PV}/"

src_compile() {
	einfo "Compiling junit-dataprovider-core"
	JAVA_SRC_DIR="core/src/main/java"
	JAVA_JAR_FILENAME="junit-dataprovider-core.jar"
	java-pkg-simple_src_compile
	JAVA_GENTOO_CLASSPATH_EXTRA+=":junit-dataprovider-core.jar"
	rm -r target || die

	einfo "Compiling junit4-dataprovider"
	JAVA_SRC_DIR="junit4/src/main/java"
	JAVA_JAR_FILENAME="juni4-dataprovider.jar"
	JAVA_CLASSPATH_EXTRA="junit-4"
	java-pkg-simple_src_compile
	rm -r target || die

	if use doc; then
		einfo "Compiling javadocs"
		JAVA_SRC_DIR=(
			"core/src/main/java"
			"junit4/src/main/java"
		)
		JAVA_JAR_FILENAME="ignoreme.jar"
		java-pkg-simple_src_compile
	fi
}

src_test() {
	einfo "Testing junit-dataprovider-core"
	JAVA_TEST_GENTOO_CLASSPATH="assertj-core-3,junit-4,mockito:4"
	JAVA_TEST_SRC_DIR="core/src/test/java"
	java-pkg-simple_src_test

	einfo "Testing junit4-dataprovider"
	JAVA_TEST_SRC_DIR="junit4/src/main/java"
	JAVA_TEST_EXCLUDES=(
		com.tngtech.java.junit.dataprovider.internal.TestGenerator
		com.tngtech.java.junit.dataprovider.internal.TestValidator
	)
	java-pkg-simple_src_test
}

src_install() {
	java-pkg_dojar "junit-dataprovider-core.jar"
	java-pkg_dojar "juni4-dataprovider.jar"

	if use doc; then
		java-pkg_dojavadoc target/api
	fi

	if use source; then
		java-pkg_dosrc "core/src/main/java/*"
		java-pkg_dosrc "junit4/src/main/java/*"
	fi
}