/[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.135 Revision 1.136
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.135 2010/04/28 19:40:40 caster Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.136 2011/03/15 19:53:05 serkan Exp $
10 10
11# ----------------------------------------------------------------------------- 11# -----------------------------------------------------------------------------
12# @eclass-begin 12# @eclass-begin
13# @eclass-shortdesc Java Utility eclass 13# @eclass-shortdesc Java Utility eclass
14# @eclass-maintainer java@gentoo.org 14# @eclass-maintainer java@gentoo.org
1752 else 1752 else
1753 return 0 1753 return 0
1754 fi 1754 fi
1755} 1755}
1756 1756
1757
1757# ------------------------------------------------------------------------------ 1758# ------------------------------------------------------------------------------
1758# @ebuild-function ejunit 1759# @internal-function ejunit_
1759# 1760#
1760# Junit wrapper function. Makes it easier to run the tests and checks for 1761# Internal Junit wrapper function. Makes it easier to run the tests and checks for
1761# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner. 1762# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner.
1762# 1763#
1763# Examples: 1764# @param $1 - junit package (junit or junit-4)
1764# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1765# ejunit org.blinkenlights.jid3.test.AllTests
1766#
1767# @param $1 - -cp or -classpath 1765# @param $2 - -cp or -classpath
1768# @param $2 - classpath; junit and recorded dependencies get appended 1766# @param $3 - classpath; junit and recorded dependencies get appended
1769# @param $@ - the rest of the parameters are passed to java 1767# @param $@ - the rest of the parameters are passed to java
1770# ------------------------------------------------------------------------------
1771ejunit() { 1768ejunit_() {
1772 debug-print-function ${FUNCNAME} $* 1769 debug-print-function ${FUNCNAME} $*
1773 1770
1774 local pkgs 1771 local pkgs
1775 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then 1772 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then
1776 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do 1773 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do
1777 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//") 1774 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//")
1778 done 1775 done
1779 fi 1776 fi
1780 1777
1778 local junit=${1}
1779 shift 1
1780
1781 local cp=$(java-pkg_getjars --with-dependencies junit${pkgs}) 1781 local cp=$(java-pkg_getjars --with-dependencies ${junit}${pkgs})
1782 if [[ ${1} = -cp || ${1} = -classpath ]]; then 1782 if [[ ${1} = -cp || ${1} = -classpath ]]; then
1783 cp="${2}:${cp}" 1783 cp="${2}:${cp}"
1784 shift 2 1784 shift 2
1785 else 1785 else
1786 cp=".:${cp}" 1786 cp=".:${cp}"
1787 fi 1787 fi
1788 1788
1789 local runner=junit.textui.TestRunner 1789 local runner=junit.textui.TestRunner
1790 debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}" 1790 debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}"
1791 java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed" 1791 java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
1792}
1793
1794# ------------------------------------------------------------------------------
1795# @ebuild-function ejunit
1796#
1797# Junit wrapper function. Makes it easier to run the tests and checks for
1798# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner.
1799#
1800# Examples:
1801# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1802# ejunit org.blinkenlights.jid3.test.AllTests
1803#
1804# @param $1 - -cp or -classpath
1805# @param $2 - classpath; junit and recorded dependencies get appended
1806# @param $@ - the rest of the parameters are passed to java
1807# ------------------------------------------------------------------------------
1808ejunit() {
1809 debug-print-function ${FUNCNAME} $*
1810
1811 ejunit_ "junit" "${@}"
1812}
1813
1814# ------------------------------------------------------------------------------
1815# @ebuild-function ejunit4
1816#
1817# Junit4 wrapper function. Makes it easier to run the tests and checks for
1818# dev-java/junit:4 in DEPEND. Launches the tests using junit.textui.TestRunner.
1819#
1820# Examples:
1821# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1822# ejunit org.blinkenlights.jid3.test.AllTests
1823#
1824# @param $1 - -cp or -classpath
1825# @param $2 - classpath; junit and recorded dependencies get appended
1826# @param $@ - the rest of the parameters are passed to java
1827# ------------------------------------------------------------------------------
1828ejunit4() {
1829 debug-print-function ${FUNCNAME} $*
1830
1831 ejunit_ "junit-4" "${@}"
1792} 1832}
1793 1833
1794# ------------------------------------------------------------------------------ 1834# ------------------------------------------------------------------------------
1795# @section-end helper 1835# @section-end helper
1796# ------------------------------------------------------------------------------ 1836# ------------------------------------------------------------------------------

Legend:
Removed from v.1.135  
changed lines
  Added in v.1.136

  ViewVC Help
Powered by ViewVC 1.1.20