/[gentoo-x86]/eclass/java-utils-2.eclass
Gentoo

Diff of /eclass/java-utils-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.80 Revision 1.84
4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> 4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
5# Copyright (c) 2004-2005, Gentoo Foundation 5# Copyright (c) 2004-2005, Gentoo Foundation
6# 6#
7# Licensed under the GNU General Public License, v2 7# Licensed under the GNU General Public License, v2
8# 8#
9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.80 2007/04/26 23:32:12 caster Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.84 2007/05/06 09:47:36 betelgeuse Exp $
10 10
11 11
12# ----------------------------------------------------------------------------- 12# -----------------------------------------------------------------------------
13# @eclass-begin 13# @eclass-begin
14# @eclass-shortdesc Java Utility eclass 14# @eclass-shortdesc Java Utility eclass
995 classpath="${classpath}:${jars}" 995 classpath="${classpath}:${jars}"
996 fi 996 fi
997 997
998 # Only record jars that aren't build-only 998 # Only record jars that aren't build-only
999 if [[ -z "${build_only}" ]]; then 999 if [[ -z "${build_only}" ]]; then
1000 for pkg in ${pkgs//:/ }; do 1000 for pkg in ${pkgs//,/ }; do
1001 java-pkg_record-jar_ "${pkg}" 1001 java-pkg_record-jar_ "${pkg}"
1002 done 1002 done
1003 fi 1003 fi
1004 1004
1005 echo "${classpath}" 1005 echo "${classpath}"
1616 [[ "${ant}" == "dev-java/ant" ]] && found_ant=true 1616 [[ "${ant}" == "dev-java/ant" ]] && found_ant=true
1617 [[ "${dep}" == *"ant-tasks"* ]] && found_ant_tasks=true 1617 [[ "${dep}" == *"ant-tasks"* ]] && found_ant_tasks=true
1618 done 1618 done
1619 1619
1620 if [[ -n "${found_ant}" || -n "${found_ant_tasks}" ]]; then 1620 if [[ -n "${found_ant}" || -n "${found_ant_tasks}" ]]; then
1621 java-pkg_announce-qa-violation "The ebuild DEPENDS on deprecated ant or ant-tasks" 1621 java-pkg_announce-qa-violation --nodie "The ebuild DEPENDS on deprecated ant or ant-tasks"
1622 echo "all" 1622 echo "all"
1623 else 1623 else
1624 # ebuild doesn't set ANT_TASKS and doesn't depend on ant-tasks or ant 1624 # ebuild doesn't set ANT_TASKS and doesn't depend on ant-tasks or ant
1625 # so we deactivate all tasks that may be installed 1625 # so we deactivate all tasks that may be installed
1626 echo "none" 1626 echo "none"
1651 return 0 1651 return 0
1652 fi 1652 fi
1653} 1653}
1654 1654
1655# ------------------------------------------------------------------------------ 1655# ------------------------------------------------------------------------------
1656# @ebuild-function ejunit
1657#
1658# Junit wrapper function. Makes it easier to run the tests and checks for
1659# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner.
1660#
1661# Examples:
1662# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1663# ejunit org.blinkenlights.jid3.test.AllTests
1664#
1665# @param $1 - -cp or -classpath
1666# @param $2 - classpath, junit gets appended
1667# @param $@ - the rest of the parameters are passed to java
1668# ------------------------------------------------------------------------------
1669ejunit() {
1670 debug-print-function ${FUNCNAME} $*
1671
1672 local cp
1673 if [[ ${1} = -cp || ${1} = -classpath ]]; then
1674 cp=${2}:$(java-pkg_getjars --build-only junit)
1675 shift 2
1676 else
1677 cp=$(java-pkg_getjars --build-only junit):.
1678 fi
1679
1680 local runner=junit.textui.TestRunner
1681 debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}"
1682 java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
1683}
1684
1685# ------------------------------------------------------------------------------
1656# @section-end helper 1686# @section-end helper
1657# ------------------------------------------------------------------------------ 1687# ------------------------------------------------------------------------------
1658 1688
1659# ------------------------------------------------------------------------------ 1689# ------------------------------------------------------------------------------
1660# @section-begin build 1690# @section-begin build
1676# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1706# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1677# ------------------------------------------------------------------------------ 1707# ------------------------------------------------------------------------------
1678eant() { 1708eant() {
1679 debug-print-function ${FUNCNAME} $* 1709 debug-print-function ${FUNCNAME} $*
1680 1710
1681 # FIXME get this working
1682# if is-java-strict && [[ ! ${DEPEND} =~ "dev-java/ant" ]]; then
1683# java-pkg_announce-qa-violation \
1684# "Using eant, but not depending on dev-java/ant or dev-java/ant-core"
1685# fi
1686
1687 if ! hasq java-ant-2 ${INHERITED} && is-java-strict; then 1711 if ! hasq java-ant-2 ${INHERITED}; then
1688 local msg="You should inherit java-ant-2 when using eant" 1712 local msg="You should inherit java-ant-2 when using eant"
1689 java-pkg_announce-qa-violation ${msg} 1713 java-pkg_announce-qa-violation "${msg}"
1690 die ${msg}
1691 fi 1714 fi
1692 1715
1693 local antflags="-Dnoget=true -Dmaven.mode.offline=true" 1716 local antflags="-Dnoget=true -Dmaven.mode.offline=true"
1694 1717
1695 java-pkg_init-compiler_ 1718 java-pkg_init-compiler_
2212# 2235#
2213# ------------------------------------------------------------------------------ 2236# ------------------------------------------------------------------------------
2214java-pkg_setup-vm() { 2237java-pkg_setup-vm() {
2215 debug-print-function ${FUNCNAME} $* 2238 debug-print-function ${FUNCNAME} $*
2216 2239
2240 export LANG="C" LC_ALL="C"
2241
2217 local vendor="$(java-pkg_get-vm-vendor)" 2242 local vendor="$(java-pkg_get-vm-vendor)"
2218 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then 2243 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then
2219 addpredict "/dev/random" 2244 addpredict "/dev/random"
2220 elif [[ "${vendor}" == "ibm" ]]; then 2245 elif [[ "${vendor}" == "ibm" ]]; then
2221 addpredict "/proc/self/maps" 2246 addpredict "/proc/self/maps"
2222 addpredict "/proc/cpuinfo" 2247 addpredict "/proc/cpuinfo"
2223 export LANG="C" LC_ALL="C"
2224 elif [[ "${vendor}" == "jrockit" ]]; then 2248 elif [[ "${vendor}" == "jrockit" ]]; then
2225 addpredict "/proc/cpuinfo" 2249 addpredict "/proc/cpuinfo"
2226 fi 2250 fi
2227} 2251}
2228 2252
2459# @section-end internal 2483# @section-end internal
2460# ------------------------------------------------------------------------------ 2484# ------------------------------------------------------------------------------
2461 2485
2462java-pkg_check-phase() { 2486java-pkg_check-phase() {
2463 local phase=${1} 2487 local phase=${1}
2464 local funcname=${2} 2488 local funcname=${FUNCNAME[1]}
2465 if is-java-strict && [[ ${EBUILD_PHASE} != ${phase} ]]; then 2489 if [[ ${EBUILD_PHASE} != ${phase} ]]; then
2466 java-pkg_announce-qa-violation \
2467 "${funcname} used outside of src_${phase}" 2490 local msg="${funcname} used outside of src_${phase}"
2491 java-pkg_announce-qa-violation "${msg}"
2468 fi 2492 fi
2469} 2493}
2470 2494
2471java-pkg_check-versioned-jar() { 2495java-pkg_check-versioned-jar() {
2472 local jar=${1} 2496 local jar=${1}
2481 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE" 2505 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE"
2482 fi 2506 fi
2483} 2507}
2484 2508
2485java-pkg_announce-qa-violation() { 2509java-pkg_announce-qa-violation() {
2486 if is-java-strict; then 2510 local nodie
2511 if [[ ${1} == "--nodie" ]]; then
2512 nodie="true"
2513 shift
2514 fi
2487 echo "Java QA Notice: $@" >&2 2515 echo "Java QA Notice: $@" >&2
2488 increment-qa-violations 2516 increment-qa-violations
2489 fi 2517 [[ -z "${nodie}" ]] && is-java-strict && die "${@}"
2490} 2518}
2491 2519
2492increment-qa-violations() { 2520increment-qa-violations() {
2493 let "JAVA_PKG_QA_VIOLATIONS+=1" 2521 let "JAVA_PKG_QA_VIOLATIONS+=1"
2494 export JAVA_PKG_QA_VIOLATIONS 2522 export JAVA_PKG_QA_VIOLATIONS

Legend:
Removed from v.1.80  
changed lines
  Added in v.1.84

  ViewVC Help
Powered by ViewVC 1.1.20