/[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.127 Revision 1.146
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.127 2009/05/19 21:23:32 caster Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.146 2011/10/29 13:17:15 caster 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
61# 61#
62# The version of portage we need to function properly. Previously it was 62# The version of portage we need to function properly. Previously it was
63# portage with phase hooks support but now we use a version with proper env 63# portage with phase hooks support but now we use a version with proper env
64# saving. For EAPI 2 we have new enough stuff so let's have cleaner deps. 64# saving. For EAPI 2 we have new enough stuff so let's have cleaner deps.
65# ----------------------------------------------------------------------------- 65# -----------------------------------------------------------------------------
66hasq "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7" 66has "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
67 67
68# ----------------------------------------------------------------------------- 68# -----------------------------------------------------------------------------
69# @variable-internal JAVA_PKG_E_DEPEND 69# @variable-internal JAVA_PKG_E_DEPEND
70# 70#
71# This is a convience variable to be used from the other java eclasses. This is 71# This is a convience variable to be used from the other java eclasses. This is
72# the version of java-config we want to use. Usually the latest stable version 72# the version of java-config we want to use. Usually the latest stable version
73# so that ebuilds can use new features without depending on specific versions. 73# so that ebuilds can use new features without depending on specific versions.
74# ----------------------------------------------------------------------------- 74# -----------------------------------------------------------------------------
75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.1.6 ${JAVA_PKG_PORTAGE_DEP}" 75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.1.9-r1 ${JAVA_PKG_PORTAGE_DEP}"
76hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )" 76has source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
77
78# -----------------------------------------------------------------------------
79# @variable-preinherit JAVA_PKG_WANT_BOOTCLASSPATH
80#
81# The version of bootclasspath the package needs to work. Translates to a proper
82# dependency. The bootclasspath has to be obtained by java-ant_rewrite-bootclasspath
83# -----------------------------------------------------------------------------
84
85if [[ -n "${JAVA_PKG_WANT_BOOTCLASSPATH}" ]]; then
86 if [[ "${JAVA_PKG_WANT_BOOTCLASSPATH}" == "1.5" ]]; then
87 JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} >=dev-java/gnu-classpath-0.98-r1:0.98"
88 else
89 eerror "Unknown value of JAVA_PKG_WANT_BOOTCLASSPATH"
90 # since die in global scope doesn't work, this will make repoman fail
91 JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} BAD_JAVA_PKG_WANT_BOOTCLASSPATH"
92 fi
93fi
77 94
78# ----------------------------------------------------------------------------- 95# -----------------------------------------------------------------------------
79# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 96# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
80# @variable-default yes 97# @variable-default yes
81# 98#
224 ( # dont want to pollute calling env 241 ( # dont want to pollute calling env
225 insinto "${dest}" 242 insinto "${dest}"
226 doins -r "$@" 243 doins -r "$@"
227 ) || die "Installing examples failed" 244 ) || die "Installing examples failed"
228 fi 245 fi
246
247 # Let's make a symlink to the directory we have everything else under
248 dosym "${dest}" "${JAVA_PKG_SHAREPATH}/examples" || die
229} 249}
230 250
231# ----------------------------------------------------------------------------- 251# -----------------------------------------------------------------------------
232# @ebuild-function java-pkg_dojar 252# @ebuild-function java-pkg_dojar
233# 253#
872 892
873 local build_only="" 893 local build_only=""
874 local destdir="." 894 local destdir="."
875 local deep="" 895 local deep=""
876 local virtual="" 896 local virtual=""
897 local record_jar=""
877 898
878 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 899 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
879 900
880 while [[ "${1}" == --* ]]; do 901 while [[ "${1}" == --* ]]; do
881 if [[ "${1}" = "--build-only" ]]; then 902 if [[ "${1}" = "--build-only" ]]; then
916 for pkg in ${target_pkg//,/ }; do 937 for pkg in ${target_pkg//,/ }; do
917 java-pkg_ensure-dep "${build_only}" "${pkg}" 938 java-pkg_ensure-dep "${build_only}" "${pkg}"
918 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" 939 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}"
919 done 940 done
920 # setting this disables further record-jar_ calls later 941 # setting this disables further record-jar_ calls later
921 build_only="build" 942 record_jar="true"
922 else 943 else
923 java-pkg_ensure-dep "${build_only}" "${target_pkg}" 944 java-pkg_ensure-dep "${build_only}" "${target_pkg}"
924 fi 945 fi
925 946
926 # Record the entire virtual as a dependency so that 947 # Record the entire virtual as a dependency so that
927 # no jars are missed. 948 # no jars are missed.
928 if [[ -z "${build_only}" && -n "${virtual}" ]]; then 949 if [[ -z "${build_only}" && -n "${virtual}" ]]; then
929 java-pkg_record-jar_ "${target_pkg}" 950 java-pkg_record-jar_ "${target_pkg}"
930 # setting this disables further record-jars_ calls later 951 # setting this disables further record-jars_ calls later
931 build_only="build" 952 record_jar="true"
932 fi 953 fi
933 954
934 pushd ${destdir} > /dev/null \ 955 pushd ${destdir} > /dev/null \
935 || die "failed to change directory to ${destdir}" 956 || die "failed to change directory to ${destdir}"
936 957
944 # If no specific target jar was indicated, link it 965 # If no specific target jar was indicated, link it
945 if [[ -z "${target_jar}" ]] ; then 966 if [[ -z "${target_jar}" ]] ; then
946 [[ -f "${target_jar}" ]] && rm "${target_jar}" 967 [[ -f "${target_jar}" ]] && rm "${target_jar}"
947 ln -snf "${jar}" \ 968 ln -snf "${jar}" \
948 || die "Failed to make symlink from ${jar} to ${jar_name}" 969 || die "Failed to make symlink from ${jar} to ${jar_name}"
970 if [[ -z "${record_jar}" ]]; then
971 if [[ -z "${build_only}" ]]; then
949 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}" 972 java-pkg_record-jar_ "${target_pkg}" "${jar}"
973 else
974 java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}"
975 fi
976 fi
950 # otherwise, if the current jar is the target jar, link it 977 # otherwise, if the current jar is the target jar, link it
951 elif [[ "${jar_name}" == "${target_jar}" ]] ; then 978 elif [[ "${jar_name}" == "${target_jar}" ]] ; then
952 [[ -f "${destjar}" ]] && rm "${destjar}" 979 [[ -f "${destjar}" ]] && rm "${destjar}"
953 ln -snf "${jar}" "${destjar}" \ 980 ln -snf "${jar}" "${destjar}" \
954 || die "Failed to make symlink from ${jar} to ${destjar}" 981 || die "Failed to make symlink from ${jar} to ${destjar}"
982 if [[ -z "${record_jar}" ]]; then
983 if [[ -z "${build_only}" ]]; then
955 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}" 984 java-pkg_record-jar_ "${target_pkg}" "${jar}"
985 else
986 java-pkg_record-jar_ --build-only "${target_jar}" "${jar}"
987 fi
988 fi
956 popd > /dev/null 989 popd > /dev/null
957 return 0 990 return 0
958 fi 991 fi
959 done 992 done
960 popd > /dev/null 993 popd > /dev/null
1033 1066
1034 for pkg in ${pkgs//,/ }; do 1067 for pkg in ${pkgs//,/ }; do
1035 java-pkg_ensure-dep "${build_only}" "${pkg}" 1068 java-pkg_ensure-dep "${build_only}" "${pkg}"
1036 done 1069 done
1037 1070
1038 # Only record jars that aren't build-only 1071 for pkg in ${pkgs//,/ }; do
1039 if [[ -z "${build_only}" ]]; then 1072 if [[ -z "${build_only}" ]]; then
1040 for pkg in ${pkgs//,/ }; do
1041 java-pkg_record-jar_ "${pkg}" 1073 java-pkg_record-jar_ "${pkg}"
1074 else
1075 java-pkg_record-jar_ --build-only "${pkg}"
1076 fi
1042 done 1077 done
1043 fi
1044 1078
1045 echo "${jars}" 1079 echo "${jars}"
1046} 1080}
1047 1081
1048# ------------------------------------------------------------------------------ 1082# ------------------------------------------------------------------------------
1069java-pkg_getjar() { 1103java-pkg_getjar() {
1070 debug-print-function ${FUNCNAME} $* 1104 debug-print-function ${FUNCNAME} $*
1071 1105
1072 local build_only="" 1106 local build_only=""
1073 local virtual="" 1107 local virtual=""
1108 local record_jar=""
1074 1109
1075 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 1110 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1076 1111
1077 while [[ "${1}" == --* ]]; do 1112 while [[ "${1}" == --* ]]; do
1078 if [[ "${1}" = "--build-only" ]]; then 1113 if [[ "${1}" = "--build-only" ]]; then
1104 java-pkg_ensure-dep "${build_only}" "${pkg}" 1139 java-pkg_ensure-dep "${build_only}" "${pkg}"
1105 1140
1106 # Record the package(Virtual) as a dependency and then set build_only 1141 # Record the package(Virtual) as a dependency and then set build_only
1107 # So that individual jars are not recorded. 1142 # So that individual jars are not recorded.
1108 if [[ -n "${virtual}" ]]; then 1143 if [[ -n "${virtual}" ]]; then
1144 if [[ -z "${build_only}" ]]; then
1109 java-pkg_record-jar_ "${pkg}" 1145 java-pkg_record-jar_ "${pkg}"
1110 build_only="true" 1146 else
1147 java-pkg_record-jar_ --build-only "${pkg}"
1148 fi
1149 record_jar="true"
1111 fi 1150 fi
1112 1151
1113 for jar in ${classpath//:/ }; do 1152 for jar in ${classpath//:/ }; do
1114 if [[ ! -f "${jar}" ]] ; then 1153 if [[ ! -f "${jar}" ]] ; then
1115 die "Installation problem with jar ${jar} in ${pkg} - is it installed?" 1154 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
1116 fi 1155 fi
1117 1156
1118 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then 1157 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then
1119 # Only record jars that aren't build-only 1158 # Only record jars that aren't build-only
1120 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" "${jar}" 1159 if [[ -z "${record_jar}" ]]; then
1160 if [[ -z "${build_only}" ]]; then
1161 java-pkg_record-jar_ "${pkg}" "${jar}"
1162 else
1163 java-pkg_record-jar_ --build-only "${pkg}" "${jar}"
1164 fi
1165 fi
1121 echo "${jar}" 1166 echo "${jar}"
1122 return 0 1167 return 0
1123 fi 1168 fi
1124 done 1169 done
1125 1170
1259 echo "${1}=\"${2}\"" >> ${JAVA_PKG_EXTRA_ENV} 1304 echo "${1}=\"${2}\"" >> ${JAVA_PKG_EXTRA_ENV}
1260 JAVA_PKG_EXTRA_ENV_VARS="${JAVA_PKG_EXTRA_ENV_VARS} ${1}" 1305 JAVA_PKG_EXTRA_ENV_VARS="${JAVA_PKG_EXTRA_ENV_VARS} ${1}"
1261 1306
1262 java-pkg_do_write_ 1307 java-pkg_do_write_
1263} 1308}
1309
1310# ------------------------------------------------------------------------------
1311# @ebuild-function java-pkg_get-bootclasspath
1312#
1313# Returns classpath of a given bootclasspath-providing package version.
1314#
1315# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
1316# of the current JDK
1317# ------------------------------------------------------------------------------
1318
1319java-pkg_get-bootclasspath() {
1320 local version="${1}"
1321
1322 local bcp
1323 case "${version}" in
1324 auto)
1325 bcp="$(java-config -g BOOTCLASSPATH)"
1326 ;;
1327 1.5)
1328 bcp="$(java-pkg_getjars --build-only gnu-classpath-0.98)"
1329 ;;
1330 *)
1331 eerror "unknown parameter of java-pkg_get-bootclasspath"
1332 die "unknown parameter of java-pkg_get-bootclasspath"
1333 ;;
1334 esac
1335
1336 echo "${bcp}"
1337}
1338
1264 1339
1265# This function reads stdin, and based on that input, figures out how to 1340# This function reads stdin, and based on that input, figures out how to
1266# populate jars from the filesystem. 1341# populate jars from the filesystem.
1267# Need to figure out a good way of making use of this, ie be able to use a 1342# Need to figure out a good way of making use of this, ie be able to use a
1268# string that was built instead of stdin 1343# string that was built instead of stdin
1306# @section-begin helper 1381# @section-begin helper
1307# @section-summary Helper functions 1382# @section-summary Helper functions
1308# 1383#
1309# Various other functions to use from an ebuild 1384# Various other functions to use from an ebuild
1310# ------------------------------------------------------------------------------ 1385# ------------------------------------------------------------------------------
1311
1312# ------------------------------------------------------------------------------
1313# @ebuild-function java-pkg_need
1314#
1315# Adds virtual dependencies, which can optionally be controlled by a USE flag.
1316# Currently supported virtuals are:
1317# javamail
1318# jdbc-stdext
1319# jaf
1320# jdbc-rowset
1321# jms
1322#
1323# @param $1 - Optionally indicate that the dependencies are controlled by
1324# a use flag by specifying '--use' Requires $2.
1325# @param $2 - USE flag which will enable the dependencies.
1326# @param $@ - virtual packages to add depenedencies for
1327# ------------------------------------------------------------------------------
1328# TODO rewrite to parse a line based declaration file instead -- karltk
1329#java-pkg_need() {
1330# debug-print-function ${FUNCNAME} $*
1331# local useflag
1332# if [[ ${1} == "--use" ]]; then
1333# useflag="${2}"
1334# shift 2
1335# fi
1336#
1337# if [[ -z ${1} ]]; then
1338# die "Must specify at least one virtual package."
1339# fi
1340#
1341# local depstr newdepstr
1342#
1343# for virtual in ${@}; do
1344# if has ${virtual} ${JAVA_PKG_VNEED}; then
1345# debug-print "Already registered virtual ${virtual}"
1346# continue
1347# fi
1348# case ${virtual} in
1349# javamail)
1350# debug-print "java-pkg_need: adding javamail dependencies"
1351# newdepstr="|| ( dev-java/gnu-javamail dev-java/sun-javamail-bin )"
1352# ;;
1353# jdbc-stdext)
1354# debug-print "java-pkg_need: adding jdbc-stdext dependencies"
1355# newdepstr="|| ( >=virtual/jdk-1.4 dev-java/jdbc2-stdext )"
1356# ;;
1357# jaf)
1358# debug-print "java-pkg_need: adding jaf dependencies"
1359# newdepstr="|| ( dev-java/gnu-jaf dev-java/sun-jaf-bin )"
1360# ;;
1361# jdbc-rowset)
1362# debug-print "java-pkg_need: adding jdbc-rowset dependencies"
1363# newdepstr="|| ( >=virtual/jdk-1.5 dev-java/sun-jdbc-rowset )"
1364# ;;
1365# jms)
1366# debug-print "java-pkg_need: adding jms dependencies"
1367# newdepstr="|| ( dev-java/sun-jms dev-java/openjms )"
1368# ;;
1369# *)
1370# die "Invalid virtual: ${virtual}"
1371# esac
1372#
1373# export JAVA_PKG_VNEED="${JAVA_PKG_VNEED} ${virtual}"
1374#
1375# if [[ -n ${useflag} ]]; then
1376# depstr="${depstr} ${useflag}? ( ${newdepstr} )"
1377# else
1378# depstr="${depstr} ${newdepstr}"
1379# fi
1380# done
1381#
1382# [[ -z ${JAVA_PKG_NV_DEPEND} ]] && export JAVA_PKG_NV_DEPEND="${DEPEND}"
1383# [[ -z ${JAVA_PKG_NV_RDEPEND} ]] && export JAVA_PKG_NV_RDEPEND="${RDEPEND}"
1384#
1385# export DEPEND="${DEPEND} ${depstr}"
1386# export RDEPEND="${RDEPEND} ${depstr}"
1387#}
1388 1386
1389# ------------------------------------------------------------------------------ 1387# ------------------------------------------------------------------------------
1390# @ebuild-function java-pkg_find-normal-jars 1388# @ebuild-function java-pkg_find-normal-jars
1391# 1389#
1392# Find the files with suffix .jar file in the given directory or $WORKDIR 1390# Find the files with suffix .jar file in the given directory or $WORKDIR
1558java-pkg_get-current-vm() { 1556java-pkg_get-current-vm() {
1559 echo ${GENTOO_VM} 1557 echo ${GENTOO_VM}
1560} 1558}
1561 1559
1562java-pkg_current-vm-matches() { 1560java-pkg_current-vm-matches() {
1563 hasq $(java-pkg_get-current-vm) ${@} 1561 has $(java-pkg_get-current-vm) ${@}
1564 return $? 1562 return $?
1565} 1563}
1566 1564
1567# ------------------------------------------------------------------------------ 1565# ------------------------------------------------------------------------------
1568# @ebuild-function java-pkg_get-source 1566# @ebuild-function java-pkg_get-source
1683 die "No GCJ support found!" 1681 die "No GCJ support found!"
1684 fi 1682 fi
1685} 1683}
1686 1684
1687java-pkg_ensure-test() { 1685java-pkg_ensure-test() {
1688 if hasq test ${FEATURES} && ! hasq -test ${FEATURES} \ 1686 if has test ${FEATURES} && ! has -test ${FEATURES} \
1689 && hasq test ${IUSE} && ! use test; 1687 && has test ${IUSE} && ! use test;
1690 then 1688 then
1691 eerror "You specified FEATURES=test, but USE=test is needed" 1689 eerror "You specified FEATURES=test, but USE=test is needed"
1692 eerror "to pull in the additional dependencies for testing" 1690 eerror "to pull in the additional dependencies for testing"
1693 die "Need USE=test enabled" 1691 die "Need USE=test enabled"
1694 fi 1692 fi
1757 else 1755 else
1758 return 0 1756 return 0
1759 fi 1757 fi
1760} 1758}
1761 1759
1760
1762# ------------------------------------------------------------------------------ 1761# ------------------------------------------------------------------------------
1763# @ebuild-function ejunit 1762# @internal-function ejunit_
1764# 1763#
1765# Junit wrapper function. Makes it easier to run the tests and checks for 1764# Internal Junit wrapper function. Makes it easier to run the tests and checks for
1766# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner. 1765# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner.
1767# 1766#
1768# Examples: 1767# @param $1 - junit package (junit or junit-4)
1769# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1770# ejunit org.blinkenlights.jid3.test.AllTests
1771#
1772# @param $1 - -cp or -classpath 1768# @param $2 - -cp or -classpath
1773# @param $2 - classpath; junit and recorded dependencies get appended 1769# @param $3 - classpath; junit and recorded dependencies get appended
1774# @param $@ - the rest of the parameters are passed to java 1770# @param $@ - the rest of the parameters are passed to java
1775# ------------------------------------------------------------------------------
1776ejunit() { 1771ejunit_() {
1777 debug-print-function ${FUNCNAME} $* 1772 debug-print-function ${FUNCNAME} $*
1778 1773
1779 local pkgs 1774 local pkgs
1780 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then 1775 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then
1781 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do 1776 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do
1782 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//") 1777 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//")
1783 done 1778 done
1784 fi 1779 fi
1785 1780
1781 local junit=${1}
1782 shift 1
1783
1786 local cp=$(java-pkg_getjars --with-dependencies junit${pkgs}) 1784 local cp=$(java-pkg_getjars --with-dependencies ${junit}${pkgs})
1787 if [[ ${1} = -cp || ${1} = -classpath ]]; then 1785 if [[ ${1} = -cp || ${1} = -classpath ]]; then
1788 cp="${2}:${cp}" 1786 cp="${2}:${cp}"
1789 shift 2 1787 shift 2
1790 else 1788 else
1791 cp=".:${cp}" 1789 cp=".:${cp}"
1792 fi 1790 fi
1793 1791
1794 local runner=junit.textui.TestRunner 1792 local runner=junit.textui.TestRunner
1793 if [[ "${junit}" == "junit-4" ]] ; then
1794 runner=org.junit.runner.JUnitCore
1795 fi
1795 debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}" 1796 debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}"
1796 java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed" 1797 java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
1798}
1799
1800# ------------------------------------------------------------------------------
1801# @ebuild-function ejunit
1802#
1803# Junit wrapper function. Makes it easier to run the tests and checks for
1804# dev-java/junit in DEPEND. Launches the tests using org.junit.runner.JUnitCore.
1805#
1806# Examples:
1807# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1808# ejunit org.blinkenlights.jid3.test.AllTests
1809# ejunit org.blinkenlights.jid3.test.FirstTest \
1810# org.blinkenlights.jid3.test.SecondTest
1811#
1812# @param $1 - -cp or -classpath
1813# @param $2 - classpath; junit and recorded dependencies get appended
1814# @param $@ - the rest of the parameters are passed to java
1815# ------------------------------------------------------------------------------
1816ejunit() {
1817 debug-print-function ${FUNCNAME} $*
1818
1819 ejunit_ "junit" "${@}"
1820}
1821
1822# ------------------------------------------------------------------------------
1823# @ebuild-function ejunit4
1824#
1825# Junit4 wrapper function. Makes it easier to run the tests and checks for
1826# dev-java/junit:4 in DEPEND. Launches the tests using junit.textui.TestRunner.
1827#
1828# Examples:
1829# ejunit4 -cp build/classes org.blinkenlights.jid3.test.AllTests
1830# ejunit4 org.blinkenlights.jid3.test.AllTests
1831# ejunit4 org.blinkenlights.jid3.test.FirstTest \
1832# org.blinkenlights.jid3.test.SecondTest
1833#
1834# @param $1 - -cp or -classpath
1835# @param $2 - classpath; junit and recorded dependencies get appended
1836# @param $@ - the rest of the parameters are passed to java
1837# ------------------------------------------------------------------------------
1838ejunit4() {
1839 debug-print-function ${FUNCNAME} $*
1840
1841 ejunit_ "junit-4" "${@}"
1797} 1842}
1798 1843
1799# ------------------------------------------------------------------------------ 1844# ------------------------------------------------------------------------------
1800# @section-end helper 1845# @section-end helper
1801# ------------------------------------------------------------------------------ 1846# ------------------------------------------------------------------------------
1867# gentoo.classpath property. Be sure to call 1912# gentoo.classpath property. Be sure to call
1868# java-ant_rewrite-classpath in src_unpack. 1913# java-ant_rewrite-classpath in src_unpack.
1869# EANT_NEEDS_TOOLS - add tools.jar to the gentoo.classpath. Should only be used 1914# EANT_NEEDS_TOOLS - add tools.jar to the gentoo.classpath. Should only be used
1870# for build-time purposes, the dependency is not recorded to 1915# for build-time purposes, the dependency is not recorded to
1871# package.env! 1916# package.env!
1872# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files
1873# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1917# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1874# ------------------------------------------------------------------------------ 1918# ------------------------------------------------------------------------------
1875eant() { 1919eant() {
1876 debug-print-function ${FUNCNAME} $* 1920 debug-print-function ${FUNCNAME} $*
1877 1921
1878 if [[ ${EBUILD_PHASE} = compile ]]; then 1922 if [[ ${EBUILD_PHASE} = compile ]]; then
1879 java-ant-2_src_configure 1923 java-ant-2_src_configure
1880 java-utils-2_src_prepare 1924 java-utils-2_src_prepare
1881 fi 1925 fi
1882 1926
1883 if ! hasq java-ant-2 ${INHERITED}; then 1927 if ! has java-ant-2 ${INHERITED}; then
1884 local msg="You should inherit java-ant-2 when using eant" 1928 local msg="You should inherit java-ant-2 when using eant"
1885 java-pkg_announce-qa-violation "${msg}" 1929 java-pkg_announce-qa-violation "${msg}"
1886 fi 1930 fi
1887 1931
1888 local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore" 1932 local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore"
2318 # Create package.env 2362 # Create package.env
2319 ( 2363 (
2320 echo "DESCRIPTION=\"${DESCRIPTION}\"" 2364 echo "DESCRIPTION=\"${DESCRIPTION}\""
2321 echo "GENERATION=\"2\"" 2365 echo "GENERATION=\"2\""
2322 echo "SLOT=\"${SLOT}\"" 2366 echo "SLOT=\"${SLOT}\""
2367 echo "CATEGORY=\"${CATEGORY}\""
2368 echo "PVR=\"${PVR}\""
2323 2369
2324 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\"" 2370 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
2325 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\"" 2371 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
2326 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" 2372 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
2327 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \ 2373 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
2328 && echo "DEPEND=\"$(cat "${JAVA_PKG_DEPEND_FILE}" | uniq | tr '\n' ':')\"" 2374 && echo "DEPEND=\"$(sort -u "${JAVA_PKG_DEPEND_FILE}" | tr '\n' ':')\""
2329 [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \ 2375 [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
2330 && echo "OPTIONAL_DEPEND=\"$(cat "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | uniq | tr '\n' ':')\"" 2376 && echo "OPTIONAL_DEPEND=\"$(sort -u "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | tr '\n' ':')\""
2331 echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup ! 2377 echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
2378 [[ -f "${JAVA_PKG_BUILD_DEPEND_FILE}" ]] \
2379 && echo "BUILD_DEPEND=\"$(sort -u "${JAVA_PKG_BUILD_DEPEND_FILE}" | tr '\n' ':')\""
2332 ) > "${JAVA_PKG_ENV}" 2380 ) > "${JAVA_PKG_ENV}"
2333 2381
2334 # register target/source 2382 # register target/source
2335 local target="$(java-pkg_get-target)" 2383 local target="$(java-pkg_get-target)"
2336 local source="$(java-pkg_get-source)" 2384 local source="$(java-pkg_get-source)"
2369# ------------------------------------------------------------------------------ 2417# ------------------------------------------------------------------------------
2370# @internal-function java-pkg_record-jar_ 2418# @internal-function java-pkg_record-jar_
2371# 2419#
2372# Record an (optional) dependency to the package.env 2420# Record an (optional) dependency to the package.env
2373# @param --optional - record dependency as optional 2421# @param --optional - record dependency as optional
2422# @param --build - record dependency as build_only
2374# @param $1 - package to record 2423# @param $1 - package to record
2375# @param $2 - (optional) jar of package to record 2424# @param $2 - (optional) jar of package to record
2376# ------------------------------------------------------------------------------ 2425# ------------------------------------------------------------------------------
2377JAVA_PKG_DEPEND_FILE="${T}/java-pkg-depend" 2426JAVA_PKG_DEPEND_FILE="${T}/java-pkg-depend"
2378JAVA_PKG_OPTIONAL_DEPEND_FILE="${T}/java-pkg-optional-depend" 2427JAVA_PKG_OPTIONAL_DEPEND_FILE="${T}/java-pkg-optional-depend"
2428JAVA_PKG_BUILD_DEPEND_FILE="${T}/java-pkg-build-depend"
2379 2429
2380java-pkg_record-jar_() { 2430java-pkg_record-jar_() {
2381 debug-print-function ${FUNCNAME} $* 2431 debug-print-function ${FUNCNAME} $*
2382 2432
2383 local depend_file="${JAVA_PKG_DEPEND_FILE}" 2433 local depend_file="${JAVA_PKG_DEPEND_FILE}"
2384 if [[ "${1}" == "--optional" ]]; then 2434 case "${1}" in
2385 depend_file="${JAVA_PKG_OPTIONAL_DEPEND_FILE}" 2435 "--optional") depend_file="${JAVA_PKG_OPTIONAL_DEPEND_FILE}"; shift;;
2386 shift 2436 "--build-only") depend_file="${JAVA_PKG_BUILD_DEPEND_FILE}"; shift;;
2387 fi 2437 esac
2388 2438
2389 local pkg=${1} jar=${2} append 2439 local pkg=${1} jar=${2} append
2390 if [[ -z "${jar}" ]]; then 2440 if [[ -z "${jar}" ]]; then
2391 append="${pkg}" 2441 append="${pkg}"
2392 else 2442 else
2457# 2507#
2458# ------------------------------------------------------------------------------ 2508# ------------------------------------------------------------------------------
2459java-pkg_setup-vm() { 2509java-pkg_setup-vm() {
2460 debug-print-function ${FUNCNAME} $* 2510 debug-print-function ${FUNCNAME} $*
2461 2511
2462 export LANG="C" LC_ALL="C"
2463
2464 local vendor="$(java-pkg_get-vm-vendor)" 2512 local vendor="$(java-pkg_get-vm-vendor)"
2465 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then 2513 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then
2466 addpredict "/dev/random" 2514 addpredict "/dev/random"
2467 elif [[ "${vendor}" == "ibm" ]]; then 2515 elif [[ "${vendor}" == "ibm" ]]; then
2468 addpredict "/proc/self/maps" 2516 addpredict "/proc/self/maps"
2469 addpredict "/proc/cpuinfo" 2517 addpredict "/proc/cpuinfo"
2518 addpredict "/proc/self/coredump_filter"
2519 elif [[ "${vendor}" == "oracle" ]]; then
2520 addpredict "/dev/random"
2521 addpredict "/proc/self/coredump_filter"
2522 elif [[ "${vendor}" == icedtea* ]] && java-pkg_is-vm-version-ge "1.7" ; then
2523 addpredict "/dev/random"
2524 addpredict "/proc/self/coredump_filter"
2470 elif [[ "${vendor}" == "jrockit" ]]; then 2525 elif [[ "${vendor}" == "jrockit" ]]; then
2471 addpredict "/proc/cpuinfo" 2526 addpredict "/proc/cpuinfo"
2472 fi 2527 fi
2473} 2528}
2474 2529
2481# @return 1 - Package does not depend on virtual/jdk 2536# @return 1 - Package does not depend on virtual/jdk
2482# ------------------------------------------------------------------------------ 2537# ------------------------------------------------------------------------------
2483java-pkg_needs-vm() { 2538java-pkg_needs-vm() {
2484 debug-print-function ${FUNCNAME} $* 2539 debug-print-function ${FUNCNAME} $*
2485 2540
2486 if [[ -n "$(echo ${DEPEND} | sed -e '\:virtual/jdk:!d')" ]]; then 2541 if [[ -n "$(echo ${JAVA_PKG_NV_DEPEND:-${DEPEND}} | sed -e '\:virtual/jdk:!d')" ]]; then
2487 return 0 2542 return 0
2488 fi 2543 fi
2489 2544
2490 return 1 2545 return 1
2491} 2546}
2539 # If you're forcing the VM, I hope you know what your doing... 2594 # If you're forcing the VM, I hope you know what your doing...
2540 debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}" 2595 debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}"
2541 export GENTOO_VM="${JAVA_PKG_FORCE_VM}" 2596 export GENTOO_VM="${JAVA_PKG_FORCE_VM}"
2542 # if we're allowed to switch the vm... 2597 # if we're allowed to switch the vm...
2543 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then 2598 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then
2544 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}} VNEED: ${JAVA_PKG_VNEED}" 2599 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2545 if [[ -n ${JAVA_PKG_VNEED} ]]; then
2546 GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
2547 else
2548 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 2600 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
2549 fi
2550 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then 2601 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
2551 eerror "Unable to determine VM for building from dependencies:" 2602 eerror "Unable to determine VM for building from dependencies:"
2552 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}" 2603 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2553 echo "VNEED: ${JAVA_PKG_VNEED}"
2554 die "Failed to determine VM for building." 2604 die "Failed to determine VM for building."
2555 else 2605 else
2556 export GENTOO_VM 2606 export GENTOO_VM
2557 fi 2607 fi
2558 # otherwise just make sure the current VM is sufficient 2608 # otherwise just make sure the current VM is sufficient
2597# 2647#
2598# Enhanced die for Java packages, which displays some information that may be 2648# Enhanced die for Java packages, which displays some information that may be
2599# useful for debugging bugs on bugzilla. 2649# useful for debugging bugs on bugzilla.
2600# ------------------------------------------------------------------------------ 2650# ------------------------------------------------------------------------------
2601#register_die_hook java-pkg_die 2651#register_die_hook java-pkg_die
2602if ! hasq java-pkg_die ${EBUILD_DEATH_HOOKS}; then 2652if ! has java-pkg_die ${EBUILD_DEATH_HOOKS}; then
2603 EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} java-pkg_die" 2653 EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} java-pkg_die"
2604fi 2654fi
2605 2655
2606java-pkg_die() { 2656java-pkg_die() {
2607 echo "!!! When you file a bug report, please include the following information:" >&2 2657 echo "!!! When you file a bug report, please include the following information:" >&2
2681 2731
2682 local limit_to="${1}" 2732 local limit_to="${1}"
2683 local target_pkg="${2}" 2733 local target_pkg="${2}"
2684 local dev_error="" 2734 local dev_error=""
2685 2735
2736 # remove the version specification, which may include globbing (* and [123])
2686 local stripped_pkg=$(echo "${target_pkg}" | sed \ 2737 local stripped_pkg=$(echo "${target_pkg}" | sed \
2687 's/-[0-9]*\(\.[0-9]\)*$//') 2738 's/-\([0-9*]*\(\[[0-9]*\]\)*\)*\(\.\([0-9*]*\(\[[0-9]*\]\)*\)*\)*$//')
2688 2739
2689 debug-print "Matching against: ${stripped_pkg}" 2740 debug-print "Matching against: ${stripped_pkg}"
2690 2741
2691 if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then 2742 if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then
2692 dev_error="The ebuild is attempting to use ${target_pkg} that is not" 2743 dev_error="The ebuild is attempting to use ${target_pkg} that is not"
2742 java-pkg_announce-qa-violation "installing versioned jar '${jar}'" 2793 java-pkg_announce-qa-violation "installing versioned jar '${jar}'"
2743 fi 2794 fi
2744} 2795}
2745 2796
2746java-pkg_check-jikes() { 2797java-pkg_check-jikes() {
2747 if hasq jikes ${IUSE}; then 2798 if has jikes ${IUSE}; then
2748 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE" 2799 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE"
2749 fi 2800 fi
2750} 2801}
2751 2802
2752java-pkg_announce-qa-violation() { 2803java-pkg_announce-qa-violation() {

Legend:
Removed from v.1.127  
changed lines
  Added in v.1.146

  ViewVC Help
Powered by ViewVC 1.1.20