/[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.101 Revision 1.115
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.101 2008/01/12 15:03:13 caster Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.115 2008/10/05 16:53:38 betelgeuse 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
34# Summary of variables which control the behavior of building Java packges. 34# Summary of variables which control the behavior of building Java packges.
35# ----------------------------------------------------------------------------- 35# -----------------------------------------------------------------------------
36 36
37# Make sure we use java-config-2 37# Make sure we use java-config-2
38export WANT_JAVA_CONFIG="2" 38export WANT_JAVA_CONFIG="2"
39
40[[ "${EAPI:-0}" == "2" ]] && EXPORT_FUNCTIONS src_prepare
39 41
40# ----------------------------------------------------------------------------- 42# -----------------------------------------------------------------------------
41# @variable-external WANT_ANT_TASKS 43# @variable-external WANT_ANT_TASKS
42# @variable-default "" 44# @variable-default ""
43# 45#
291 done 293 done
292 294
293 java-pkg_do_write_ 295 java-pkg_do_write_
294} 296}
295 297
296
297# ------------------------------------------------------------------------------ 298# ------------------------------------------------------------------------------
298# @internal-function depend-java-query 299# @internal-function depend-java-query
299# 300#
300# Wrapper for the depend-java-query binary to enable passing USE in env. 301# Wrapper for the depend-java-query binary to enable passing USE in env.
301# Using env variables keeps this eclass working with java-config versions that 302# Using env variables keeps this eclass working with java-config versions that
446 if [[ -e "${lib}" ]] ; then 447 if [[ -e "${lib}" ]] ; then
447 # install if it isn't a symlink 448 # install if it isn't a symlink
448 if [[ ! -L "${lib}" ]] ; then 449 if [[ ! -L "${lib}" ]] ; then
449 INSDESTTREE="${JAVA_PKG_LIBDEST}" \ 450 INSDESTTREE="${JAVA_PKG_LIBDEST}" \
450 INSOPTIONS="${LIBOPTIONS}" \ 451 INSOPTIONS="${LIBOPTIONS}" \
451 doins "${lib}" || "failed to install ${lib}" 452 doins "${lib}" || die "failed to install ${lib}"
452 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}" 453 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
453 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}" 454 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
454 # otherwise make a symlink to the symlink's origin 455 # otherwise make a symlink to the symlink's origin
455 else 456 else
456 # TODO use dosym 457 # TODO use dosym
613 614
614 # Let's make a symlink to the directory we have everything else under 615 # Let's make a symlink to the directory we have everything else under
615 dosym ${dest}/api "${JAVA_PKG_SHAREPATH}/api" || die 616 dosym ${dest}/api "${JAVA_PKG_SHAREPATH}/api" || die
616 617
617 if [[ ${symlink} ]]; then 618 if [[ ${symlink} ]]; then
619 debug-print "symlinking ${dest}/{api,${symlink}}"
618 dosym ${dest}/{api,${symlink}} || die 620 dosym ${dest}/{api,${symlink}} || die
619 fi 621 fi
620} 622}
621 623
622# ------------------------------------------------------------------------------ 624# ------------------------------------------------------------------------------
647 649
648 [[ ${#} -lt 1 ]] && die "At least one argument needed" 650 [[ ${#} -lt 1 ]] && die "At least one argument needed"
649 651
650 if ! [[ ${DEPEND} = *app-arch/zip* ]]; then 652 if ! [[ ${DEPEND} = *app-arch/zip* ]]; then
651 local msg="${FUNCNAME} called without app-arch/zip in DEPEND" 653 local msg="${FUNCNAME} called without app-arch/zip in DEPEND"
652 if is-java-strict; then 654 java-pkg_announce-qa-violation ${msg}
653 eerror "${msg}"
654 die "${msg}"
655 else
656 echo "${msg}"
657 echo "Please report this to http://bugs.gentoo.org."
658 fi
659 fi 655 fi
660 656
661 java-pkg_init_paths_ 657 java-pkg_init_paths_
662 658
663 local zip_name="${PN}-src.zip" 659 local zip_name="${PN}-src.zip"
903 899
904 local target_pkg="${1}" target_jar="${2}" destjar="${3}" 900 local target_pkg="${1}" target_jar="${2}" destjar="${3}"
905 901
906 [[ -z ${target_pkg} ]] && die "Must specify a package" 902 [[ -z ${target_pkg} ]] && die "Must specify a package"
907 903
904 if [[ "${EAPI}" == "1" ]]; then
905 target_pkg="${target_pkg//:/-}"
906 fi
907
908 # default destjar to the target jar 908 # default destjar to the target jar
909 [[ -z "${destjar}" ]] && destjar="${target_jar}" 909 [[ -z "${destjar}" ]] && destjar="${target_jar}"
910 910
911 local error_msg="There was a problem getting the classpath for ${target_pkg}." 911 local error_msg="There was a problem getting the classpath for ${target_pkg}."
912 local classpath 912 local classpath
1023 done 1023 done
1024 1024
1025 [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*" 1025 [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*"
1026 1026
1027 1027
1028 local classpath pkgs="${1}" 1028 local pkgs="${1}"
1029
1030 if [[ "${EAPI}" == "1" ]]; then
1031 pkgs="${pkgs//:/-}"
1032 fi
1033
1029 jars="$(java-config ${deep} --classpath=${pkgs})" 1034 jars="$(java-config ${deep} --classpath=${pkgs})"
1030 [[ $? != 0 || -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed" 1035 [[ $? != 0 ]] && die "java-config --classpath=${pkgs} failed"
1031 debug-print "${pkgs}:${jars}" 1036 debug-print "${pkgs}:${jars}"
1032 1037
1033 for pkg in ${pkgs//,/ }; do 1038 for pkg in ${pkgs//,/ }; do
1034 java-pkg_ensure-dep "${build_only}" "${pkg}" 1039 java-pkg_ensure-dep "${build_only}" "${pkg}"
1035 done 1040 done
1036
1037 if [[ -z "${classpath}" ]]; then
1038 classpath="${jars}"
1039 else
1040 classpath="${classpath}:${jars}"
1041 fi
1042 1041
1043 # Only record jars that aren't build-only 1042 # Only record jars that aren't build-only
1044 if [[ -z "${build_only}" ]]; then 1043 if [[ -z "${build_only}" ]]; then
1045 for pkg in ${pkgs//,/ }; do 1044 for pkg in ${pkgs//,/ }; do
1046 java-pkg_record-jar_ "${pkg}" 1045 java-pkg_record-jar_ "${pkg}"
1047 done 1046 done
1048 fi 1047 fi
1049 1048
1050 echo "${classpath}" 1049 echo "${jars}"
1051} 1050}
1052 1051
1053# ------------------------------------------------------------------------------ 1052# ------------------------------------------------------------------------------
1054# @ebuild-function java-pkg_getjar 1053# @ebuild-function java-pkg_getjar
1055# 1054#
1083 if [[ "${1}" = "--build-only" ]]; then 1082 if [[ "${1}" = "--build-only" ]]; then
1084 build_only="build" 1083 build_only="build"
1085 elif [[ "${1}" == "--virtual" ]]; then 1084 elif [[ "${1}" == "--virtual" ]]; then
1086 virtual="true" 1085 virtual="true"
1087 else 1086 else
1088 die "java-pkg_jar-from called with unknown parameter: ${1}" 1087 die "java-pkg_getjar called with unknown parameter: ${1}"
1089 fi 1088 fi
1090 shift 1089 shift
1091 done 1090 done
1092 1091
1093 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*" 1092 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*"
1094 1093
1095 local pkg="${1}" target_jar="${2}" jar 1094 local pkg="${1}" target_jar="${2}" jar
1095
1096 if [[ "${EAPI}" == "1" ]]; then
1097 pkg="${pkg//:/-}"
1098 fi
1099
1096 [[ -z ${pkg} ]] && die "Must specify package to get a jar from" 1100 [[ -z ${pkg} ]] && die "Must specify package to get a jar from"
1097 [[ -z ${target_jar} ]] && die "Must specify jar to get" 1101 [[ -z ${target_jar} ]] && die "Must specify jar to get"
1098 1102
1099 local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?" 1103 local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?"
1100 local classpath 1104 local classpath
1161 1165
1162 local pkgs="${1}" 1166 local pkgs="${1}"
1163 local jar="${2}" 1167 local jar="${2}"
1164 1168
1165 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified" 1169 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1170
1171 if [[ "${EAPI}" == "1" ]]; then
1172 pkgs="${pkgs//:/-}"
1173 fi
1166 1174
1167 if [[ -z "${jar}" ]]; then 1175 if [[ -z "${jar}" ]]; then
1168 for pkg in ${pkgs//,/ }; do 1176 for pkg in ${pkgs//,/ }; do
1169 java-pkg_ensure-dep runtime "${pkg}" 1177 java-pkg_ensure-dep runtime "${pkg}"
1170 java-pkg_record-jar_ "${pkg}" 1178 java-pkg_record-jar_ "${pkg}"
1212 1220
1213 local pkgs="${1}" 1221 local pkgs="${1}"
1214 local jar="${2}" 1222 local jar="${2}"
1215 1223
1216 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified" 1224 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1225
1226 if [[ "${EAPI}" == "1" ]]; then
1227 pkgs="${pkgs//:/-}"
1228 fi
1217 1229
1218 if [[ -z "${jar}" ]]; then 1230 if [[ -z "${jar}" ]]; then
1219 for pkg in ${pkgs//,/ }; do 1231 for pkg in ${pkgs//,/ }; do
1220 java-pkg_record-jar_ --optional "${pkg}" 1232 java-pkg_record-jar_ --optional "${pkg}"
1221 done 1233 done
1722 dodir /usr/share/ant/${TASKS_DIR} 1734 dodir /usr/share/ant/${TASKS_DIR}
1723 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}" 1735 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}"
1724} 1736}
1725 1737
1726# ------------------------------------------------------------------------------ 1738# ------------------------------------------------------------------------------
1727# @internal-function java-pkg_ant-tasks-from-deps
1728#
1729# Function to determine ANT_TASKS from DEPEND variable for backwards
1730# compatibility with ebuilds that don't set ANT_TASKS before calling eant() or
1731# WANT_ANT_TASKS before inheriting java-pkg-2. If the DEPEND string contains
1732# "dev-java/ant" or "dev-java/ant-tasks", then it returns "all", otherwise
1733# "none". It's not smart enough to cope with USE flag depends but that shouldn't
1734# be a problem, the worst it can do is activace all tasks when not needed.
1735# Note that this is called only with JAVA_PKG_STRICT=1, to find ebuilds with
1736# insufficient dependencies, otherwise all available tasks are used for
1737# backwards compatilbility.
1738#
1739# @return "all" or "none"
1740# ------------------------------------------------------------------------------
1741java-pkg_ant-tasks-from-deps() {
1742 local found_ant found_ant_tasks
1743
1744 for dep in ${DEPEND}
1745 do
1746 local ant="$(awk '/(dev-java\/ant)/ { if (match($1, "(dev-java/ant)((-[0-9])+|$)", m)) print m[1] }' <<< ${dep})"
1747 [[ "${ant}" == "dev-java/ant" ]] && found_ant=true
1748 [[ "${dep}" == *"ant-tasks"* ]] && found_ant_tasks=true
1749 done
1750
1751 if [[ -n "${found_ant}" || -n "${found_ant_tasks}" ]]; then
1752 java-pkg_announce-qa-violation --nodie "The ebuild DEPENDS on deprecated ant or ant-tasks"
1753 echo "all"
1754 else
1755 # ebuild doesn't set ANT_TASKS and doesn't depend on ant-tasks or ant
1756 # so we deactivate all tasks that may be installed
1757 echo "none"
1758 fi
1759}
1760
1761# ------------------------------------------------------------------------------
1762# @internal-function java-pkg_ant-tasks-depend 1739# @internal-function java-pkg_ant-tasks-depend
1763# 1740#
1764# Translates the WANT_ANT_TASKS variable into valid dependencies. 1741# Translates the WANT_ANT_TASKS variable into valid dependencies.
1765# ------------------------------------------------------------------------------ 1742# ------------------------------------------------------------------------------
1766java-pkg_ant-tasks-depend() { 1743java-pkg_ant-tasks-depend() {
1768 1745
1769 if [[ -n "${WANT_ANT_TASKS}" ]]; then 1746 if [[ -n "${WANT_ANT_TASKS}" ]]; then
1770 local DEP="" 1747 local DEP=""
1771 for i in ${WANT_ANT_TASKS} 1748 for i in ${WANT_ANT_TASKS}
1772 do 1749 do
1773 if [[ ${i} != ant-* ]]; then 1750 if [[ ${i} = ant-* ]]; then
1751 DEP="${DEP}dev-java/${i} "
1752 elif [[ ${i} = */*:* ]]; then
1753 DEP="${DEP}${i} "
1754 else
1774 echo "Invalid atom in WANT_ANT_TASKS: ${i}" 1755 echo "Invalid atom in WANT_ANT_TASKS: ${i}"
1775 return 1 1756 return 1
1776 fi 1757 fi
1777 DEP="${DEP}dev-java/${i} "
1778 done 1758 done
1779 echo ${DEP} 1759 echo ${DEP}
1780 return 0 1760 return 0
1781 else 1761 else
1782 return 0 1762 return 0
1799# ------------------------------------------------------------------------------ 1779# ------------------------------------------------------------------------------
1800ejunit() { 1780ejunit() {
1801 debug-print-function ${FUNCNAME} $* 1781 debug-print-function ${FUNCNAME} $*
1802 1782
1803 local pkgs 1783 local pkgs
1784 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then
1804 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do 1785 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do
1805 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//") 1786 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//")
1806 done 1787 done
1788 fi
1807 1789
1808 local cp=$(java-pkg_getjars --with-dependencies junit${pkgs}) 1790 local cp=$(java-pkg_getjars --with-dependencies junit${pkgs})
1809 if [[ ${1} = -cp || ${1} = -classpath ]]; then 1791 if [[ ${1} = -cp || ${1} = -classpath ]]; then
1810 cp="${2}:${cp}" 1792 cp="${2}:${cp}"
1811 shift 2 1793 shift 2
1819} 1801}
1820 1802
1821# ------------------------------------------------------------------------------ 1803# ------------------------------------------------------------------------------
1822# @section-end helper 1804# @section-end helper
1823# ------------------------------------------------------------------------------ 1805# ------------------------------------------------------------------------------
1806
1807# ------------------------------------------------------------------------------
1808# @eclass-src_prepare
1809#
1810# src_prepare Searches for bundled jars
1811# ------------------------------------------------------------------------------
1812
1813java-utils-2_src_prepare() {
1814 # Remember that eant will call this unless called via Portage
1815 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1816 echo "Searching for bundled jars:"
1817 java-pkg_find-normal-jars || echo "None found."
1818 echo "Searching for bundled classes (no output if none found):"
1819 find "${WORKDIR}" -name "*.class"
1820 echo "Search done."
1821 fi
1822 touch "${T}/java-utils-2_src_prepare-run"
1823}
1824 1824
1825# ------------------------------------------------------------------------------ 1825# ------------------------------------------------------------------------------
1826# @section-begin build 1826# @section-begin build
1827# @section-summary Build functions 1827# @section-summary Build functions
1828# 1828#
1844# ------------------------------------------------------------------------------ 1844# ------------------------------------------------------------------------------
1845eant() { 1845eant() {
1846 debug-print-function ${FUNCNAME} $* 1846 debug-print-function ${FUNCNAME} $*
1847 1847
1848 if [[ ${EBUILD_PHASE} = compile ]]; then 1848 if [[ ${EBUILD_PHASE} = compile ]]; then
1849 # Used to be done in hooks in java-ant-2.eclass but moved here so that we can 1849 java-ant-2_src_configure
1850 # finally get rid of the hooks without breaking stuff 1850 java-utils-2_src_prepare
1851
1852 [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" && "${JAVA_PKG_BSFIX}" ]] \
1853 && java-ant_ignore-system-classes "${S}/build.xml"
1854
1855 if hasq java-ant-2 ${INHERITED}; then
1856 java-ant_bsfix
1857 fi
1858
1859 # eant can be called multiple times
1860 JAVA_PKG_BSFIX="off"
1861
1862 if [[ -z ${JAVA_PKG_NO_BUNDLED_SEARCH} ]] && is-java-strict; then
1863 echo "Searching for bundled jars:"
1864 java-pkg_find-normal-jars || echo "None found."
1865 echo "Searching for bundled classes (no output if none found):"
1866 find "${WORKDIR}" -name "*.class"
1867 echo "Search done."
1868 JAVA_PKG_NO_BUNDLED_SEARCH=true # eant can be called many times
1869 fi
1870 fi 1851 fi
1871 1852
1872 if ! hasq java-ant-2 ${INHERITED}; then 1853 if ! hasq java-ant-2 ${INHERITED}; then
1873 local msg="You should inherit java-ant-2 when using eant" 1854 local msg="You should inherit java-ant-2 when using eant"
1874 java-pkg_announce-qa-violation "${msg}" 1855 java-pkg_announce-qa-violation "${msg}"
1911 echo "more info." 1892 echo "more info."
1912 fi 1893 fi
1913 fi 1894 fi
1914 done 1895 done
1915 1896
1916 # we use this in src_* so we run ant from / 1897 # parse WANT_ANT_TASKS for atoms
1917 if ROOT=/ has_version ">=dev-java/ant-core-1.7.0"; then 1898 local want_ant_tasks
1918 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly 1899 for i in ${WANT_ANT_TASKS}; do
1919 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}" 1900 if [[ ${i} = */*:* ]]; then
1920 1901 i=${i#*/}
1921 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set 1902 i=${i%:0}
1922 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" 1903 want_ant_tasks+="${i/:/-} "
1923
1924 if is-java-strict; then
1925 # if ant-tasks were not set by ebuild or forced, try to determine them from depends
1926 if [[ -z "${ANT_TASKS}" ]]; then
1927 ANT_TASKS="$(java-pkg_ant-tasks-from-deps)"
1928 fi
1929 else 1904 else
1905 want_ant_tasks+="${i} "
1906 fi
1907 done
1908 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1909 ANT_TASKS="${ANT_TASKS:-${want_ant_tasks% }}"
1910
1911 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1912 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
1913
1930 # if ant-tasks is not set by ebuild or forced, activate all of them 1914 # if ant-tasks is not set by ebuild or forced, use none
1931 ANT_TASKS="${ANT_TASKS:-all}" 1915 ANT_TASKS="${ANT_TASKS:-none}"
1932 fi
1933 1916
1934 # at this point, ANT_TASKS should be "all", "none" or explicit list 1917 # at this point, ANT_TASKS should be "all", "none" or explicit list
1935 if [[ "${ANT_TASKS}" == "all" ]]; then 1918 if [[ "${ANT_TASKS}" == "all" ]]; then
1936 einfo "Using all available ANT_TASKS" 1919 einfo "Using all available ANT_TASKS"
1937 elif [[ "${ANT_TASKS}" == "none" ]]; then 1920 elif [[ "${ANT_TASKS}" == "none" ]]; then
1938 einfo "Disabling all optional ANT_TASKS" 1921 einfo "Disabling all optional ANT_TASKS"
1939 else 1922 else
1940 einfo "Using following ANT_TASKS: ${ANT_TASKS}" 1923 einfo "Using following ANT_TASKS: ${ANT_TASKS}"
1941 fi 1924 fi
1942 1925
1943 export ANT_TASKS 1926 export ANT_TASKS
1944 fi
1945 1927
1946 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug" 1928 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug"
1947 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q" 1929 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q"
1948 1930
1949 local gcp="${EANT_GENTOO_CLASSPATH}" 1931 local gcp="${EANT_GENTOO_CLASSPATH}"
1950 local getjarsarg="" 1932 local getjarsarg=""
1951 1933
1952 if [[ ${EBUILD_PHASE} = "test" ]]; then 1934 if [[ ${EBUILD_PHASE} = "test" ]]; then
1953 antflags="${antflags} -DJunit.present=true" 1935 antflags="${antflags} -DJunit.present=true"
1954 [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" 1936 [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
1955 getjarsarg="--with-dependencies" 1937 getjarsarg="--with-dependencies"
1956 fi 1938 fi
1957 1939
1958 local cp 1940 local cp
1959 1941
1961 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 1943 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1962 done 1944 done
1963 1945
1964 if [[ ${cp} ]]; then 1946 if [[ ${cp} ]]; then
1965 # It seems ant does not like single quotes around ${cp} 1947 # It seems ant does not like single quotes around ${cp}
1948 cp=${cp#:}
1949 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
1950 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
1966 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\"" 1951 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
1967 fi 1952 fi
1968 1953
1969 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" 1954 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1970 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" 1955 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1971 ant ${antflags} "${@}" || die "eant failed" 1956 ant ${antflags} "${@}" || die "eant failed"
2221 done 2206 done
2222 2207
2223 # If it hasn't been defined already, default to javac 2208 # If it hasn't been defined already, default to javac
2224 if [[ -z ${GENTOO_COMPILER} ]]; then 2209 if [[ -z ${GENTOO_COMPILER} ]]; then
2225 if [[ -n ${compilers} ]]; then 2210 if [[ -n ${compilers} ]]; then
2226 einfo "No suitable compiler found: defaulting javac for compilation" 2211 einfo "No suitable compiler found: defaulting to JDK default for compilation"
2227 else 2212 else
2228 # probably don't need to notify users about the default. 2213 # probably don't need to notify users about the default.
2229 :;#einfo "Defaulting to javac for compilation" 2214 :;#einfo "Defaulting to javac for compilation"
2230 fi 2215 fi
2216 if java-config -g GENTOO_COMPILER 2> /dev/null; then
2217 export GENTOO_COMPILER=$(java-config -g GENTOO_COMPILER)
2218 else
2231 export GENTOO_COMPILER=javac 2219 export GENTOO_COMPILER=javac
2220 fi
2232 else 2221 else
2233 einfo "Using ${GENTOO_COMPILER} for compilation" 2222 einfo "Using ${GENTOO_COMPILER} for compilation"
2234 fi 2223 fi
2235 2224
2236} 2225}
2287 "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then 2276 "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then
2288 # Create package.env 2277 # Create package.env
2289 ( 2278 (
2290 echo "DESCRIPTION=\"${DESCRIPTION}\"" 2279 echo "DESCRIPTION=\"${DESCRIPTION}\""
2291 echo "GENERATION=\"2\"" 2280 echo "GENERATION=\"2\""
2281 echo "SLOT=\"${SLOT}\""
2292 2282
2293 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\"" 2283 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
2294 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\"" 2284 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
2295 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" 2285 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
2296 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \ 2286 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
2604# not. 2594# not.
2605# @param $1 (optional) - the file to check, otherwise checks whole ${D} 2595# @param $1 (optional) - the file to check, otherwise checks whole ${D}
2606# ------------------------------------------------------------------------------ 2596# ------------------------------------------------------------------------------
2607java-pkg_verify-classes() { 2597java-pkg_verify-classes() {
2608 #$(find ${D} -type f -name '*.jar' -o -name '*.class') 2598 #$(find ${D} -type f -name '*.jar' -o -name '*.class')
2599
2600 local version_verify="/usr/bin/class-version-verify.py"
2601
2602 if [[ ! -x "${version_verify}" ]]; then
2603 version_verify="/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
2604 fi
2605
2606 if [[ ! -x "${version_verify}" ]]; then
2607 ewarn "Unable to perform class version checks as"
2608 ewarn "class-version-verify.py is unavailable"
2609 ewarn "Please install dev-java/javatoolkit."
2610 return
2611 fi
2612
2609 local target=$(java-pkg_get-target) 2613 local target=$(java-pkg_get-target)
2610 local result 2614 local result
2611 local log="${T}/class-version-verify.log" 2615 local log="${T}/class-version-verify.log"
2612 if [[ -n "${1}" ]]; then 2616 if [[ -n "${1}" ]]; then
2613 class-version-verify.py -v -t ${target} "${1}" > "${log}" 2617 ${version_verify} -v -t ${target} "${1}" > "${log}"
2614 result=$? 2618 result=$?
2615 else 2619 else
2616 ebegin "Verifying java class versions (target: ${target})" 2620 ebegin "Verifying java class versions (target: ${target})"
2617 class-version-verify.py -v -t ${target} -r "${D}" > "${log}" 2621 ${version_verify} -v -t ${target} -r "${D}" > "${log}"
2618 result=$? 2622 result=$?
2619 eend ${result} 2623 eend ${result}
2620 fi 2624 fi
2621 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}" 2625 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
2622 if [[ ${result} != 0 ]]; then 2626 if [[ ${result} != 0 ]]; then
2727is-java-strict() { 2731is-java-strict() {
2728 [[ -n ${JAVA_PKG_STRICT} ]] 2732 [[ -n ${JAVA_PKG_STRICT} ]]
2729 return $? 2733 return $?
2730} 2734}
2731 2735
2736
2732# ------------------------------------------------------------------------------ 2737# ------------------------------------------------------------------------------
2733# @eclass-end 2738# @eclass-end
2734# ------------------------------------------------------------------------------ 2739# ------------------------------------------------------------------------------

Legend:
Removed from v.1.101  
changed lines
  Added in v.1.115

  ViewVC Help
Powered by ViewVC 1.1.20