/[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.113
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.113 2008/10/01 15:23:17 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
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# ------------------------------------------------------------------------------
1810
1811java-utils-2_src_prepare() {
1812 # Remember that eant will call this unless called via Portage
1813 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1814 echo "Searching for bundled jars:"
1815 java-pkg_find-normal-jars || echo "None found."
1816 echo "Searching for bundled classes (no output if none found):"
1817 find "${WORKDIR}" -name "*.class"
1818 echo "Search done."
1819 fi
1820 touch "${T}/java-utils-2_src_prepare-run"
1821}
1801 1822
1802# ------------------------------------------------------------------------------ 1823# ------------------------------------------------------------------------------
1803# @section-begin build 1824# @section-begin build
1804# @section-summary Build functions 1825# @section-summary Build functions
1805# 1826#
1821# ------------------------------------------------------------------------------ 1842# ------------------------------------------------------------------------------
1822eant() { 1843eant() {
1823 debug-print-function ${FUNCNAME} $* 1844 debug-print-function ${FUNCNAME} $*
1824 1845
1825 if [[ ${EBUILD_PHASE} = compile ]]; then 1846 if [[ ${EBUILD_PHASE} = compile ]]; then
1826 # Used to be done in hooks in java-ant-2.eclass but moved here so that we can 1847 java-ant-2_src_configure
1827 # finally get rid of the hooks without breaking stuff 1848 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 1849 fi
1848 1850
1849 if ! hasq java-ant-2 ${INHERITED}; then 1851 if ! hasq java-ant-2 ${INHERITED}; then
1850 local msg="You should inherit java-ant-2 when using eant" 1852 local msg="You should inherit java-ant-2 when using eant"
1851 java-pkg_announce-qa-violation "${msg}" 1853 java-pkg_announce-qa-violation "${msg}"
1888 echo "more info." 1890 echo "more info."
1889 fi 1891 fi
1890 fi 1892 fi
1891 done 1893 done
1892 1894
1895 # parse WANT_ANT_TASKS for atoms
1896 local want_ant_tasks
1897 for i in ${WANT_ANT_TASKS}; do
1898 if [[ ${i} = */*:* ]]; then
1899 i=${i#*/}
1900 i=${i%:0}
1901 want_ant_tasks+="${i/:/-} "
1902 else
1903 want_ant_tasks+="${i} "
1904 fi
1905 done
1893 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly 1906 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1894 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}" 1907 ANT_TASKS="${ANT_TASKS:-${want_ant_tasks% }}"
1895 1908
1896 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set 1909 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1897 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" 1910 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
1898 1911
1899 # if ant-tasks is not set by ebuild or forced, use none 1912 # if ant-tasks is not set by ebuild or forced, use none
1916 local gcp="${EANT_GENTOO_CLASSPATH}" 1929 local gcp="${EANT_GENTOO_CLASSPATH}"
1917 local getjarsarg="" 1930 local getjarsarg=""
1918 1931
1919 if [[ ${EBUILD_PHASE} = "test" ]]; then 1932 if [[ ${EBUILD_PHASE} = "test" ]]; then
1920 antflags="${antflags} -DJunit.present=true" 1933 antflags="${antflags} -DJunit.present=true"
1921 [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" 1934 [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
1922 getjarsarg="--with-dependencies" 1935 getjarsarg="--with-dependencies"
1923 fi 1936 fi
1924 1937
1925 local cp 1938 local cp
1926 1939
1928 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 1941 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1929 done 1942 done
1930 1943
1931 if [[ ${cp} ]]; then 1944 if [[ ${cp} ]]; then
1932 # It seems ant does not like single quotes around ${cp} 1945 # It seems ant does not like single quotes around ${cp}
1946 cp=${cp#:}
1947 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
1948 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
1933 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\"" 1949 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
1934 fi 1950 fi
1935 1951
1936 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" 1952 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1937 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" 1953 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1938 ant ${antflags} "${@}" || die "eant failed" 1954 ant ${antflags} "${@}" || die "eant failed"
2576# not. 2592# not.
2577# @param $1 (optional) - the file to check, otherwise checks whole ${D} 2593# @param $1 (optional) - the file to check, otherwise checks whole ${D}
2578# ------------------------------------------------------------------------------ 2594# ------------------------------------------------------------------------------
2579java-pkg_verify-classes() { 2595java-pkg_verify-classes() {
2580 #$(find ${D} -type f -name '*.jar' -o -name '*.class') 2596 #$(find ${D} -type f -name '*.jar' -o -name '*.class')
2597
2598 local version_verify="/usr/bin/class-version-verify.py"
2599
2600 if [[ ! -x "${version_verify}" ]]; then
2601 version_verify="/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
2602 fi
2603
2604 if [[ ! -x "${version_verify}" ]]; then
2605 ewarn "Unable to perform class version checks as"
2606 ewarn "class-version-verify.py is unavailable"
2607 ewarn "Please install dev-java/javatoolkit."
2608 return
2609 fi
2610
2581 local target=$(java-pkg_get-target) 2611 local target=$(java-pkg_get-target)
2582 local result 2612 local result
2583 local log="${T}/class-version-verify.log" 2613 local log="${T}/class-version-verify.log"
2584 if [[ -n "${1}" ]]; then 2614 if [[ -n "${1}" ]]; then
2585 class-version-verify.py -v -t ${target} "${1}" > "${log}" 2615 ${version_verify} -v -t ${target} "${1}" > "${log}"
2586 result=$? 2616 result=$?
2587 else 2617 else
2588 ebegin "Verifying java class versions (target: ${target})" 2618 ebegin "Verifying java class versions (target: ${target})"
2589 class-version-verify.py -v -t ${target} -r "${D}" > "${log}" 2619 ${version_verify} -v -t ${target} -r "${D}" > "${log}"
2590 result=$? 2620 result=$?
2591 eend ${result} 2621 eend ${result}
2592 fi 2622 fi
2593 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}" 2623 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
2594 if [[ ${result} != 0 ]]; then 2624 if [[ ${result} != 0 ]]; then
2699is-java-strict() { 2729is-java-strict() {
2700 [[ -n ${JAVA_PKG_STRICT} ]] 2730 [[ -n ${JAVA_PKG_STRICT} ]]
2701 return $? 2731 return $?
2702} 2732}
2703 2733
2734[[ "${EAPI}" = "2" ]] && EXPORT_FUNCTIONS src_prepare
2735
2704# ------------------------------------------------------------------------------ 2736# ------------------------------------------------------------------------------
2705# @eclass-end 2737# @eclass-end
2706# ------------------------------------------------------------------------------ 2738# ------------------------------------------------------------------------------

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

  ViewVC Help
Powered by ViewVC 1.1.20