pmd-4.2.5.ebuild 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=2
  4. JAVA_PKG_IUSE="doc source test"
  5. inherit java-pkg-2 java-ant-2
  6. DESCRIPTION="A Java source code analyzer"
  7. HOMEPAGE="http://pmd.sourceforge.net"
  8. SRC_URI="mirror://sourceforge/pmd/${PN}-src-${PV}.zip"
  9. LICENSE="pmd"
  10. SLOT="0"
  11. KEYWORDS="amd64 x86 ~x86-fbsd"
  12. IUSE=""
  13. COMMON_DEPEND="
  14. dev-java/ant-core
  15. dev-java/asm:3
  16. dev-java/jaxen:1.1
  17. >=dev-java/junit-4.4:4"
  18. RDEPEND=">=virtual/jre-1.5
  19. ${COMMON_DEPEND}"
  20. DEPEND=">=virtual/jdk-1.5
  21. app-arch/unzip
  22. test? (
  23. dev-java/ant-junit4
  24. dev-java/ant-trax
  25. )
  26. ${COMMON_DEPEND}"
  27. # tests fail
  28. RESTRICT="test"
  29. java_prepare() {
  30. epatch "${FILESDIR}/${P}-build.xml.patch"
  31. find -name "*.jar" | xargs rm -v
  32. cd "${S}/lib"
  33. java-pkg_jar-from ant-core
  34. java-pkg_jar-from asm-3 asm.jar
  35. java-pkg_jar-from jaxen-1.1 jaxen.jar
  36. java-pkg_jar-from junit-4
  37. }
  38. EANT_BUILD_XML="bin/build.xml"
  39. src_test() {
  40. # junit does not like collisions
  41. rm lib/ant.jar
  42. ANT_TASKS="ant-junit4 ant-trax" eant -f bin/build.xml test -DoutputTestResultsToFile=true
  43. }
  44. src_install() {
  45. java-pkg_newjar lib/${P}.jar
  46. java-pkg_register-ant-task
  47. # Create launchers and copy rulesets
  48. java-pkg_dolauncher ${PN} --main net.sourceforge.pmd.PMD --java_args "-Xmx512m" \
  49. -pre "${FILESDIR}"/${P}-launcher-pre-commands
  50. java-pkg_dolauncher ${PN}-designer --main net.sourceforge.pmd.util.designer.Designer
  51. cp -r rulesets "${D}"/usr/share/${PN}
  52. mkdir "${D}"/usr/share/${PN}/etc
  53. cp -r etc/xslt "${D}"/usr/share/${PN}/etc/
  54. use doc && java-pkg_dojavadoc docs/api
  55. use source && java-pkg_dosrc src/net
  56. }
  57. pkg_postinst() {
  58. elog "Example rulesets can be found under"
  59. elog "/usr/share/pmd/rulesets/"
  60. }