/[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.107 Revision 1.117
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.107 2008/05/03 21:28:45 betelgeuse Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.117 2008/10/11 21:07:13 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
445 if [[ -e "${lib}" ]] ; then 445 if [[ -e "${lib}" ]] ; then
446 # install if it isn't a symlink 446 # install if it isn't a symlink
447 if [[ ! -L "${lib}" ]] ; then 447 if [[ ! -L "${lib}" ]] ; then
448 INSDESTTREE="${JAVA_PKG_LIBDEST}" \ 448 INSDESTTREE="${JAVA_PKG_LIBDEST}" \
449 INSOPTIONS="${LIBOPTIONS}" \ 449 INSOPTIONS="${LIBOPTIONS}" \
450 doins "${lib}" || "failed to install ${lib}" 450 doins "${lib}" || die "failed to install ${lib}"
451 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}" 451 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
452 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}" 452 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
453 # otherwise make a symlink to the symlink's origin 453 # otherwise make a symlink to the symlink's origin
454 else 454 else
455 # TODO use dosym 455 # TODO use dosym
1743 1743
1744 if [[ -n "${WANT_ANT_TASKS}" ]]; then 1744 if [[ -n "${WANT_ANT_TASKS}" ]]; then
1745 local DEP="" 1745 local DEP=""
1746 for i in ${WANT_ANT_TASKS} 1746 for i in ${WANT_ANT_TASKS}
1747 do 1747 do
1748 if [[ ${i} != ant-* ]]; then 1748 if [[ ${i} = ant-* ]]; then
1749 DEP="${DEP}dev-java/${i} "
1750 elif [[ ${i} = */*:* ]]; then
1751 DEP="${DEP}${i} "
1752 else
1749 echo "Invalid atom in WANT_ANT_TASKS: ${i}" 1753 echo "Invalid atom in WANT_ANT_TASKS: ${i}"
1750 return 1 1754 return 1
1751 fi 1755 fi
1752 DEP="${DEP}dev-java/${i} "
1753 done 1756 done
1754 echo ${DEP} 1757 echo ${DEP}
1755 return 0 1758 return 0
1756 else 1759 else
1757 return 0 1760 return 0
1796} 1799}
1797 1800
1798# ------------------------------------------------------------------------------ 1801# ------------------------------------------------------------------------------
1799# @section-end helper 1802# @section-end helper
1800# ------------------------------------------------------------------------------ 1803# ------------------------------------------------------------------------------
1804
1805# ------------------------------------------------------------------------------
1806# @eclass-src_prepare
1807#
1808# src_prepare Searches for bundled jars
1809# Don't call directly, but via java-pkg-2_src_prepare!
1810# ------------------------------------------------------------------------------
1811
1812java-utils-2_src_prepare() {
1813 # Remember that eant will call this unless called via Portage
1814 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1815 echo "Searching for bundled jars:"
1816 java-pkg_find-normal-jars || echo "None found."
1817 echo "Searching for bundled classes (no output if none found):"
1818 find "${WORKDIR}" -name "*.class"
1819 echo "Search done."
1820 fi
1821 touch "${T}/java-utils-2_src_prepare-run"
1822}
1801 1823
1802# ------------------------------------------------------------------------------ 1824# ------------------------------------------------------------------------------
1803# @section-begin build 1825# @section-begin build
1804# @section-summary Build functions 1826# @section-summary Build functions
1805# 1827#
1821# ------------------------------------------------------------------------------ 1843# ------------------------------------------------------------------------------
1822eant() { 1844eant() {
1823 debug-print-function ${FUNCNAME} $* 1845 debug-print-function ${FUNCNAME} $*
1824 1846
1825 if [[ ${EBUILD_PHASE} = compile ]]; then 1847 if [[ ${EBUILD_PHASE} = compile ]]; then
1826 # Used to be done in hooks in java-ant-2.eclass but moved here so that we can 1848 java-ant-2_src_configure
1827 # finally get rid of the hooks without breaking stuff 1849 java-utils-2_src_prepare
1828
1829 [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" && "${JAVA_PKG_BSFIX}" ]] \
1830 && java-ant_ignore-system-classes "${S}/build.xml"
1831
1832 if hasq java-ant-2 ${INHERITED}; then
1833 java-ant_bsfix
1834 fi
1835
1836 # eant can be called multiple times
1837 JAVA_PKG_BSFIX="off"
1838
1839 if [[ -z ${JAVA_PKG_NO_BUNDLED_SEARCH} ]] && is-java-strict; then
1840 echo "Searching for bundled jars:"
1841 java-pkg_find-normal-jars || echo "None found."
1842 echo "Searching for bundled classes (no output if none found):"
1843 find "${WORKDIR}" -name "*.class"
1844 echo "Search done."
1845 JAVA_PKG_NO_BUNDLED_SEARCH=true # eant can be called many times
1846 fi
1847 fi 1850 fi
1848 1851
1849 if ! hasq java-ant-2 ${INHERITED}; then 1852 if ! hasq java-ant-2 ${INHERITED}; then
1850 local msg="You should inherit java-ant-2 when using eant" 1853 local msg="You should inherit java-ant-2 when using eant"
1851 java-pkg_announce-qa-violation "${msg}" 1854 java-pkg_announce-qa-violation "${msg}"
1888 echo "more info." 1891 echo "more info."
1889 fi 1892 fi
1890 fi 1893 fi
1891 done 1894 done
1892 1895
1896 # parse WANT_ANT_TASKS for atoms
1897 local want_ant_tasks
1898 for i in ${WANT_ANT_TASKS}; do
1899 if [[ ${i} = */*:* ]]; then
1900 i=${i#*/}
1901 i=${i%:0}
1902 want_ant_tasks+="${i/:/-} "
1903 else
1904 want_ant_tasks+="${i} "
1905 fi
1906 done
1893 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly 1907 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1894 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}" 1908 ANT_TASKS="${ANT_TASKS:-${want_ant_tasks% }}"
1895 1909
1896 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set 1910 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1897 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" 1911 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
1898 1912
1899 # if ant-tasks is not set by ebuild or forced, use none 1913 # if ant-tasks is not set by ebuild or forced, use none
1916 local gcp="${EANT_GENTOO_CLASSPATH}" 1930 local gcp="${EANT_GENTOO_CLASSPATH}"
1917 local getjarsarg="" 1931 local getjarsarg=""
1918 1932
1919 if [[ ${EBUILD_PHASE} = "test" ]]; then 1933 if [[ ${EBUILD_PHASE} = "test" ]]; then
1920 antflags="${antflags} -DJunit.present=true" 1934 antflags="${antflags} -DJunit.present=true"
1921 [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" 1935 [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
1922 getjarsarg="--with-dependencies" 1936 getjarsarg="--with-dependencies"
1923 fi 1937 fi
1924 1938
1925 local cp 1939 local cp
1926 1940
1928 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 1942 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1929 done 1943 done
1930 1944
1931 if [[ ${cp} ]]; then 1945 if [[ ${cp} ]]; then
1932 # It seems ant does not like single quotes around ${cp} 1946 # It seems ant does not like single quotes around ${cp}
1947 cp=${cp#:}
1948 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
1949 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
1933 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\"" 1950 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
1934 fi 1951 fi
1935 1952
1936 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" 1953 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1937 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" 1954 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1938 ant ${antflags} "${@}" || die "eant failed" 1955 ant ${antflags} "${@}" || die "eant failed"
2041# ----------------------------------------------------------------------------- 2058# -----------------------------------------------------------------------------
2042java-pkg_init() { 2059java-pkg_init() {
2043 debug-print-function ${FUNCNAME} $* 2060 debug-print-function ${FUNCNAME} $*
2044 unset JAVAC 2061 unset JAVAC
2045 unset JAVA_HOME 2062 unset JAVA_HOME
2063
2064 java-config --help >/dev/null || {
2065 eerror ""
2066 eerror "Can't run java-config --help"
2067 eerror "Have you upgraded python recently but haven't"
2068 eerror "run python-updater yet?"
2069 die "Can't run java-config --help"
2070 }
2046 2071
2047 # People do all kinds of weird things. 2072 # People do all kinds of weird things.
2048 # http://forums.gentoo.org/viewtopic-p-3943166.html 2073 # http://forums.gentoo.org/viewtopic-p-3943166.html
2049 local silence="${SILENCE_JAVA_OPTIONS_WARNING}" 2074 local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
2050 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}" 2075 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
2576# not. 2601# not.
2577# @param $1 (optional) - the file to check, otherwise checks whole ${D} 2602# @param $1 (optional) - the file to check, otherwise checks whole ${D}
2578# ------------------------------------------------------------------------------ 2603# ------------------------------------------------------------------------------
2579java-pkg_verify-classes() { 2604java-pkg_verify-classes() {
2580 #$(find ${D} -type f -name '*.jar' -o -name '*.class') 2605 #$(find ${D} -type f -name '*.jar' -o -name '*.class')
2606
2607 local version_verify="/usr/bin/class-version-verify.py"
2608
2609 if [[ ! -x "${version_verify}" ]]; then
2610 version_verify="/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
2611 fi
2612
2613 if [[ ! -x "${version_verify}" ]]; then
2614 ewarn "Unable to perform class version checks as"
2615 ewarn "class-version-verify.py is unavailable"
2616 ewarn "Please install dev-java/javatoolkit."
2617 return
2618 fi
2619
2581 local target=$(java-pkg_get-target) 2620 local target=$(java-pkg_get-target)
2582 local result 2621 local result
2583 local log="${T}/class-version-verify.log" 2622 local log="${T}/class-version-verify.log"
2584 if [[ -n "${1}" ]]; then 2623 if [[ -n "${1}" ]]; then
2585 class-version-verify.py -v -t ${target} "${1}" > "${log}" 2624 ${version_verify} -v -t ${target} "${1}" > "${log}"
2586 result=$? 2625 result=$?
2587 else 2626 else
2588 ebegin "Verifying java class versions (target: ${target})" 2627 ebegin "Verifying java class versions (target: ${target})"
2589 class-version-verify.py -v -t ${target} -r "${D}" > "${log}" 2628 ${version_verify} -v -t ${target} -r "${D}" > "${log}"
2590 result=$? 2629 result=$?
2591 eend ${result} 2630 eend ${result}
2592 fi 2631 fi
2593 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}" 2632 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
2594 if [[ ${result} != 0 ]]; then 2633 if [[ ${result} != 0 ]]; then
2699is-java-strict() { 2738is-java-strict() {
2700 [[ -n ${JAVA_PKG_STRICT} ]] 2739 [[ -n ${JAVA_PKG_STRICT} ]]
2701 return $? 2740 return $?
2702} 2741}
2703 2742
2743
2704# ------------------------------------------------------------------------------ 2744# ------------------------------------------------------------------------------
2705# @eclass-end 2745# @eclass-end
2706# ------------------------------------------------------------------------------ 2746# ------------------------------------------------------------------------------

Legend:
Removed from v.1.107  
changed lines
  Added in v.1.117

  ViewVC Help
Powered by ViewVC 1.1.20