dev-java/icedtea-bin: arm64 stable (bug #720690)
[gentoo.git] / dev-java / commons-validator / commons-validator-1.4.0.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 JAVA_PKG_IUSE="examples source test" # doc
7
8 inherit java-pkg-2 java-ant-2
9
10 MY_P=${P}-src
11
12 DESCRIPTION="Commons component to validate user input, or data input"
13 HOMEPAGE="http://commons.apache.org/validator/"
14 SRC_URI="mirror://apache/commons/validator/source/${P}-src.tar.gz"
15
16 LICENSE="Apache-2.0"
17 SLOT="0"
18 KEYWORDS="amd64 ppc64 x86"
19
20 RDEPEND=">=virtual/jre-1.4
21         >=dev-java/commons-digester-1.6:0
22         >=dev-java/commons-collections-3.1:0
23         >=dev-java/commons-logging-1.0.4:0
24         dev-java/commons-beanutils:1.7"
25
26 DEPEND=">=virtual/jdk-1.4
27         test? ( dev-java/junit:0 )
28         ${RDEPEND}"
29
30 S="${WORKDIR}/${MY_P}"
31
32 java_prepare() {
33         epatch "${FILESDIR}"/validator-1.4.build.xml.patch
34
35         JAVA_ANT_CLASSPATH_TAGS="javac java" java-ant_rewrite-classpath
36
37         echo "commons-digester.jar=$(java-pkg_getjars commons-digester)" >> build.properties
38         echo "commons-beanutils.jar=$(java-pkg_getjars commons-beanutils-1.7)" >> build.properties
39         echo "commons-logging.jar=$(java-pkg_getjar commons-logging commons-logging.jar)" >> build.properties
40         echo "commons-collections.jar=$(java-pkg_getjars commons-collections)" >> build.properties
41 }
42
43 EANT_JAVA_REWRITE_CLASSPATH="true"
44 EANT_GENTOO_CLASSPATH="commons-beanutils-1.7,commons-collections"
45 EANT_TEST_GENTOO_CLASSPATH="${EANT_GENTOO_CLASSPATH},commons-digester,commons-logging,junit"
46
47 EANT_BUILD_TARGET="compile"
48 EANT_EXTRA_ARGS="-Dskip.download=true"
49
50 src_compile() {
51         java-pkg-2_src_compile
52         jar -cf ${PN}.jar -C target/classes/ . || die "Could not create jar."
53
54         if use test ; then
55                 eant compile.tests ${EANT_EXTRA_ARGS} -Dgentoo.classpath="$(java-pkg_getjars --build-only --with-dependencies ${EANT_TEST_GENTOO_CLASSPATH})"
56                 jar -cf ${PN}-test.jar -C target/tests/ . || die "Could not create test jar."
57         fi
58 }
59
60 # Missing test suite org.apache.commons.validator.ValidatorTestSuite; therefore, tests can't be ran.
61 # See https://issues.apache.org/jira/browse/VALIDATOR-323 for a bug report about this.
62 RESTRICT="test"
63
64 src_test() {
65         echo "junit.jar=$(java-pkg_getjars junit)" >> build.properties
66         eant test ${EANT_EXTRA_ARGS} -Dgentoo.classpath="$(java-pkg_getjars --build-only --with-dependencies ${EANT_TEST_GENTOO_CLASSPATH}):${PN}.jar:${PN}-test.jar"
67 }
68
69 src_install() {
70         java-pkg_dojar ${PN}.jar
71
72         dodoc NOTICE.txt RELEASE-NOTES.txt
73
74         # Docs are no longer generated, as they have commented them out;
75         # probably on purpose, since this is the start of a new branch.
76         # use doc && java-pkg_dojavadoc dist/docs/apidocs
77         use examples && java-pkg_doexamples src/example
78         use source && java-pkg_dosrc src/main/java/*
79 }