aboutsummaryrefslogtreecommitdiff
blob: 3c2e1c222b2377ff80b82f32fb7d627856f1586f (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
#
# Author: Petteri Räty <betelgeuse@gentoo.org>
# Maintained by the java project
#
# The excalibur eclass is a helper for stuff from http://excalibur.apache.org/

JAVA_PKG_IUSE="doc source"

inherit java-pkg-2 java-ant-2

DESCRIPTION="${PN} from Apache Excalibur"
HOMEPAGE="http://excalibur.apache.org/"

[[ "${EXCALIBUR_MODULES}" ]] || SRC_URI="mirror://apache/excalibur/source/${P}-src.tar.gz"

LICENSE="Apache-2.0"

_excalibur_test() {
	[[ "${EXCALIBUR_TESTS}" ]] || return 1
}

[[ -z "${EXCALIBUR_JDK}" ]] && EXCALIBUR_JDK=1.4
[[ -z "${EXCALIBUR_JRE}" ]] && EXCALIBUR_JRE=1.4

DEPEND=">=virtual/jdk-${EXCALIBUR_JDK}"

RDEPEND=">=virtual/jre-${EXCALIBUR_JRE}"

if _excalibur_test; then
	IUSE="${IUSE} test"
	DEPEND="
		${DEPEND}
		dev-java/ant-junit"
fi

EXPORT_FUNCTIONS src_unpack src_test src_install

excalibur_src_prepare() {
	java-ant_ignore-system-classes
	mkdir -p target/lib
	cd target/lib
	for atom in ${EXCALIBUR_JAR_FROM}; do
		java-pkg_jar-from ${atom}
	done
	if _excalibur_test; then
		java-pkg_jar-from --build-only junit
		for atom in ${EXCALIBUR_TEST_JAR_FROM}; do
			java-pkg_jar-from --build-only --with-dependencies ${atom}
		done
	fi
}

excalibur_src_unpack() {
	unpack ${A}
	cd "${S}"
	excalibur_src_prepare
}

excalibur_src_test() {
	if _excalibur_test; then
		ANT_TASKS="ant-junit" eant -DJunit.present=true
	else
		einfo "This package does not support or have unit tests."
	fi
}

excalibur_src_install() {
	java-pkg_newjar target/${P}.jar
	# There might not be any
	for txt in *.txt; do
		dodoc ${txt} || die "dodoc ${txt} failed"
	done
	use doc && java-pkg_dojavadoc dist/docs/api
	use source && java-pkg_dosrc src/java/*
}