/[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.3 Revision 1.17
33# ----------------------------------------------------------------------------- 33# -----------------------------------------------------------------------------
34 34
35# Make sure we use java-config-2 35# Make sure we use java-config-2
36export WANT_JAVA_CONFIG="2" 36export WANT_JAVA_CONFIG="2"
37 37
38# TODO document
39JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1_pre1"
40
38# ----------------------------------------------------------------------------- 41# -----------------------------------------------------------------------------
39# @variable-internal JAVA_PKG_E_DEPEND 42# @variable-internal JAVA_PKG_E_DEPEND
40# 43#
41# This is a convience variable to be used from the other java eclasses. This is 44# This is a convience variable to be used from the other java eclasses. This is
42# the version of java-config we want to use. We also need a recent version 45# the version of java-config we want to use. We also need a recent version
43# portage, that includes phase hooks. 46# portage, that includes phase hooks.
44# ----------------------------------------------------------------------------- 47# -----------------------------------------------------------------------------
45JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.19-r1 >=sys-apps/portage-2.1_pre1" 48JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.19-r1 ${JAVA_PKG_PORTAGE_DEP}"
46 49
47# ----------------------------------------------------------------------------- 50# -----------------------------------------------------------------------------
48# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 51# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
49# @variable-default yes 52# @variable-default yes
50# 53#
206# Records an already installed jar in the package.env 209# Records an already installed jar in the package.env
207# This would mostly be used if the package has make or a custom script to 210# This would mostly be used if the package has make or a custom script to
208# install things. 211# install things.
209# 212#
210# Example: 213# Example:
211# java-pkg-regjar ${D}/opt/foo/lib/foo.jar 214# java-pkg_regjar ${D}/opt/foo/lib/foo.jar
215#
216# WARNING:
217# if you want to use shell expansion, you have to use ${D}/... as the for in
218# this function will not be able to expand the path, here's an example:
219#
220# java-pkg_regjar /opt/my-java/lib/*.jar
221#
222# will not work, because:
223# * the `for jar in "$@"` can't expand the path to jar file names, as they
224# don't exist yet
225# * all `if ...` inside for will fail - the file '/opt/my-java/lib/*.jar'
226# doesn't exist
227#
228# you have to use it as:
229#
230# java-pkg_regjar ${D}/opt/my-java/lib/*.jar
212# 231#
213# @param $@ - jars to record 232# @param $@ - jars to record
214# ------------------------------------------------------------------------------ 233# ------------------------------------------------------------------------------
215# TODO fix me! 234# TODO should we be making sure the jar is present on ${D} or wherever?
216java-pkg_regjar() { 235java-pkg_regjar() {
217 debug-print-function ${FUNCNAME} $* 236 debug-print-function ${FUNCNAME} $*
218 237
219 java-pkg_check-phase install 238 java-pkg_check-phase install
220 239
224 243
225 local jar jar_dir jar_file 244 local jar jar_dir jar_file
226 for jar in "$@"; do 245 for jar in "$@"; do
227 # TODO use java-pkg_check-versioned-jar 246 # TODO use java-pkg_check-versioned-jar
228 if [[ -e "${jar}" ]]; then 247 if [[ -e "${jar}" ]]; then
248 # nelchael: we should strip ${D} in this case too, here's why:
249 # imagine such call:
250 # java-pkg_regjar ${D}/opt/java/*.jar
251 # such call will fall into this case (-e ${jar}) and will
252 # record paths with ${D} in package.env
229 java-pkg_append_ JAVA_PKG_CLASSPATH "${jar}" 253 java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}"
230 elif [[ -e "${D}${jar}" ]]; then 254 elif [[ -e "${D}${jar}" ]]; then
231 java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}" 255 java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}"
232 else 256 else
233 die "${jar} does not exist" 257 die "${jar} does not exist"
234 fi 258 fi
255 local original_jar="${1}" 279 local original_jar="${1}"
256 local new_jar="${2:-${PN}.jar}" 280 local new_jar="${2:-${PN}.jar}"
257 local new_jar_dest="${T}/${new_jar}" 281 local new_jar_dest="${T}/${new_jar}"
258 282
259 [[ -z ${original_jar} ]] && die "Must specify a jar to install" 283 [[ -z ${original_jar} ]] && die "Must specify a jar to install"
260 [[ ! -f ${original_jar} ]] && die "${new_jar} does not exist!" 284 [[ ! -f ${original_jar} ]] && die "${original_jar} does not exist!"
261 285
262 rm -f "${new_jar_dest}" || die "Failed to remove ${new_jar_dest}" 286 rm -f "${new_jar_dest}" || die "Failed to remove ${new_jar_dest}"
263 cp "${original_jar}" "${new_jar_dest}" \ 287 cp "${original_jar}" "${new_jar_dest}" \
264 || die "Failed to copy ${original_jar} to ${new_jar_dest}" 288 || die "Failed to copy ${original_jar} to ${new_jar_dest}"
265 java-pkg_dojar "${new_jar_dest}" 289 java-pkg_dojar "${new_jar_dest}"
535 done 559 done
536 echo "gjl_package=${JAVA_PKG_NAME}" >> "${target}" 560 echo "gjl_package=${JAVA_PKG_NAME}" >> "${target}"
537 [[ -n "${pre}" ]] && [[ -f "${pre}" ]] && cat "${pre}" >> "${target}" 561 [[ -n "${pre}" ]] && [[ -f "${pre}" ]] && cat "${pre}" >> "${target}"
538 echo "source /usr/share/java-config-2/launcher/launcher.bash" >> "${target}" 562 echo "source /usr/share/java-config-2/launcher/launcher.bash" >> "${target}"
539 563
540 if [[ -n "${into}" ]]; then 564 if [[ -n "${target_dir}" ]]; then
541 DESTTREE="${target_dir}" dobin "${target}" 565 DESTTREE="${target_dir}" dobin "${target}"
542 local ret=$? 566 local ret=$?
543 return ${ret} 567 return ${ret}
544 else 568 else
545 dobin "${target}" 569 dobin "${target}"
618# @ebuild-function java-pkg_jar-from 642# @ebuild-function java-pkg_jar-from
619# 643#
620# Makes a symlink to a jar from a certain package 644# Makes a symlink to a jar from a certain package
621# A lot of java packages include dependencies in a lib/ directory 645# A lot of java packages include dependencies in a lib/ directory
622# You can use this function to replace these bundled dependencies. 646# You can use this function to replace these bundled dependencies.
647# The dependency is recorded into package.env DEPEND line, unless "--build-only"
648# is passed as the very first argument, for jars that have to be present only
649# at build time and are not needed on runtime (junit testing etc).
623# 650#
624# Example: get all jars from xerces slot 2 651# Example: get all jars from xerces slot 2
625# java-pkg_jar-from xerces-2 652# java-pkg_jar-from xerces-2
626# Example: get a specific jar from xerces slot 2 653# Example: get a specific jar from xerces slot 2
627# java-pkg_jar-from xerces-2 xml-apis.jar 654# java-pkg_jar-from xerces-2 xml-apis.jar
628# Example get a specific jar from xerces slot 2, and name it diffrently 655# Example: get a specific jar from xerces slot 2, and name it diffrently
629# java-pkg_jar-from xerces-2 xml-apis.jar xml.jar 656# java-pkg_jar-from xerces-2 xml-apis.jar xml.jar
657# Example: get junit.jar which is needed only for building
658# java-pkg_jar-from --build-only junit junit.jar
630# 659#
660# @param $1 - (optional) "--build-only" makes the jar(s) not added into
661# package.env DEPEND line.
631# @param $1 - Package to get jars from. 662# @param $1 - Package to get jars from.
632# @param $2 - jar from package. If not specified, all jars will be used. 663# @param $2 - jar from package. If not specified, all jars will be used.
633# @param $3 - When a single jar is specified, destination filename of the 664# @param $3 - When a single jar is specified, destination filename of the
634# symlink. Defaults to the name of the jar. 665# symlink. Defaults to the name of the jar.
635# ------------------------------------------------------------------------------ 666# ------------------------------------------------------------------------------
636# TODO could probably be cleaned up a little 667# TODO could probably be cleaned up a little
637java-pkg_jar-from() { 668java-pkg_jar-from() {
638 debug-print-function ${FUNCNAME} $* 669 debug-print-function ${FUNCNAME} $*
670
671 local build_only=""
672
673 if [[ "${1}" = "--build-only" ]]; then
674 build_only="true"
675 shift
676 fi
639 677
640 local target_pkg="${1}" target_jar="${2}" destjar="${3}" 678 local target_pkg="${1}" target_jar="${2}" destjar="${3}"
641 679
642 [[ -z ${target_pkg} ]] && die "Must specify a package" 680 [[ -z ${target_pkg} ]] && die "Must specify a package"
643 681
657 # If no specific target jar was indicated, link it 695 # If no specific target jar was indicated, link it
658 if [[ -z "${target_jar}" ]] ; then 696 if [[ -z "${target_jar}" ]] ; then
659 [[ -f "${target_jar}" ]] && rm "${target_jar}" 697 [[ -f "${target_jar}" ]] && rm "${target_jar}"
660 ln -snf "${jar}" \ 698 ln -snf "${jar}" \
661 || die "Failed to make symlink from ${jar} to ${jar_name}" 699 || die "Failed to make symlink from ${jar} to ${jar_name}"
662 java-pkg_record-jar_ "${target_pkg}" "${jar}" 700 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}"
663 # otherwise, if the current jar is the target jar, link it 701 # otherwise, if the current jar is the target jar, link it
664 elif [[ "${jar_name}" == "${target_jar}" ]] ; then 702 elif [[ "${jar_name}" == "${target_jar}" ]] ; then
665 [[ -f "${destjar}" ]] && rm "${destjar}" 703 [[ -f "${destjar}" ]] && rm "${destjar}"
666 ln -snf "${jar}" "${destjar}" \ 704 ln -snf "${jar}" "${destjar}" \
667 || die "Failed to make symlink from ${jar} to ${destjar}" 705 || die "Failed to make symlink from ${jar} to ${destjar}"
668 java-pkg_record-jar_ "${target_pkg}" "${jar}" 706 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}"
669 return 0 707 return 0
670 fi 708 fi
671 done 709 done
672 # if no target was specified, we're ok 710 # if no target was specified, we're ok
673 if [[ -z "${target_jar}" ]] ; then 711 if [[ -z "${target_jar}" ]] ; then
690# ------------------------------------------------------------------------------ 728# ------------------------------------------------------------------------------
691# @ebuild-function java-pkg_getjars 729# @ebuild-function java-pkg_getjars
692# 730#
693# Get the classpath provided by any number of packages 731# Get the classpath provided by any number of packages
694# Among other things, this can be passed to 'javac -classpath' or 'ant -lib'. 732# Among other things, this can be passed to 'javac -classpath' or 'ant -lib'.
695# 733# The providing packages are recorded as dependencies into package.env DEPEND
734# line, unless "--build-only" is passed as the very first argument, for jars
735# that have to be present only at build time and are not needed on runtime
736# (junit testing etc).
737#
696# Example: Get the classpath for xerces-2, 738# Example: Get the classpath for xerces-2,
697# java-pkg_getjars xerces-2 xalan 739# java-pkg_getjars xerces-2 xalan
698# Example Return: 740# Example Return:
699# /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar 741# /usr/share/xerces-2/lib/xml-apis.jar:/usr/share/xerces-2/lib/xmlParserAPIs.jar:/usr/share/xalan/lib/xalan.jar
700# 742#
743# @param $1 - (optional) "--build-only" makes the jar(s) not added into
744# package.env DEPEND line.
701# @param $@ - list of packages to get jars from 745# @param $@ - list of packages to get jars from
702# ------------------------------------------------------------------------------ 746# ------------------------------------------------------------------------------
703java-pkg_getjars() { 747java-pkg_getjars() {
704 debug-print-function ${FUNCNAME} $* 748 debug-print-function ${FUNCNAME} $*
749
750 local build_only=""
751
752 if [[ "${1}" = "--build-only" ]]; then
753 build_only="true"
754 shift
755 fi
705 756
706 [[ ${#} -lt 1 ]] && die "At least one argument needed" 757 [[ ${#} -lt 1 ]] && die "At least one argument needed"
707 758
708 # NOTE could probably just pass $@ to java-config --classpath. and return it 759 # NOTE could probably just pass $@ to java-config --classpath. and return it
709 local classpath pkg 760 local classpath pkg
715 if [[ -z "${classpath}" ]]; then 766 if [[ -z "${classpath}" ]]; then
716 classpath="${jars}" 767 classpath="${jars}"
717 else 768 else
718 classpath="${classpath}:${jars}" 769 classpath="${classpath}:${jars}"
719 fi 770 fi
720 java-pkg_record-jar_ "${pkg}" 771 # Only record jars that aren't build-only
772 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}"
721 done 773 done
722 echo "${classpath}" 774 echo "${classpath}"
723} 775}
724 776
725# ------------------------------------------------------------------------------ 777# ------------------------------------------------------------------------------
726# @ebuild-function java-pkg_getjar 778# @ebuild-function java-pkg_getjar
727# 779#
728# Get the filename of a single jar from a package 780# Get the filename of a single jar from a package
781# The providing package is recorded as runtime dependency into package.env
782# DEPEND line, unless "--build-only" is passed as the very first argument, for
783# jars that have to be present only at build time and are not needed on runtime
784# (junit testing etc).
729# 785#
730# @example 786# @example
731# java-pkg_getjar xerces-2 xml-apis.jar 787# java-pkg_getjar xerces-2 xml-apis.jar
732# @example-return 788# @example-return
733# /usr/share/xerces-2/lib/xml-apis.jar 789# /usr/share/xerces-2/lib/xml-apis.jar
734# 790#
791# @param $1 - (optional) "--build-only" makes the jar not added into
792# package.env DEPEND line.
735# @param $1 - package to use 793# @param $1 - package to use
736# @param $2 - jar to get 794# @param $2 - jar to get
737# ------------------------------------------------------------------------------ 795# ------------------------------------------------------------------------------
738java-pkg_getjar() { 796java-pkg_getjar() {
739 debug-print-function ${FUNCNAME} $* 797 debug-print-function ${FUNCNAME} $*
798
799 local build_only=""
800
801 if [[ "${1}" = "--build-only" ]]; then
802 build_only="true"
803 shift
804 fi
740 805
741 local pkg="${1}" target_jar="${2}" jar 806 local pkg="${1}" target_jar="${2}" jar
742 [[ -z ${pkg} ]] && die "Must specify package to get a jar from" 807 [[ -z ${pkg} ]] && die "Must specify package to get a jar from"
743 [[ -z ${target_jar} ]] && die "Must specify jar to get" 808 [[ -z ${target_jar} ]] && die "Must specify jar to get"
744 809
745 # TODO check that package is actually installed 810 # TODO check that package is actually installed
746 local classpath=$(java-config --classpath=${pkg}) 811 local classpath=$(java-config --classpath=${pkg})
747 [[ $? != 0 ]] && die "There could not find classpath for ${pkg}. Are you sure its installed?" 812 [[ $? != 0 ]] && die "There could not find classpath for ${pkg}. Are you sure its installed?"
748 for jar in ${classpath//:/ }; do 813 for jar in ${classpath//:/ }; do
749 if [[ ! -f "${jar}" ]] ; then 814 if [[ ! -f "${jar}" ]] ; then
750 die "Installation problems with jars in ${pkg} - is it installed?" 815 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
751 fi 816 fi
752 817
753 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then 818 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then
754 java-pkg_record-jar_ "${pkg}" "${jar}" 819 # Only record jars that aren't build-only
820 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" "${jar}"
755 echo "${jar}" 821 echo "${jar}"
756 return 0 822 return 0
757 fi 823 fi
758 done 824 done
759 825
1027 return 1 1093 return 1
1028 fi 1094 fi
1029 fi 1095 fi
1030} 1096}
1031 1097
1098java-pkg_set-current-vm() {
1099 export GENTOO_VM=${1}
1100}
1101
1102java-pkg_get-current-vm() {
1103 echo ${GENTOO_VM}
1104}
1105
1106java-pkg_current-vm-matches() {
1107 hasq $(java-pkg_get-current-vm) ${@}
1108 return $?
1109}
1110
1032# ------------------------------------------------------------------------------ 1111# ------------------------------------------------------------------------------
1033# @ebuild-function java-pkg_get-source 1112# @ebuild-function java-pkg_get-source
1034# 1113#
1035# Determines what source version should be used, for passing to -source. 1114# Determines what source version should be used, for passing to -source.
1036# Unless you want to break things you probably shouldn't set _WANT_SOURCE 1115# Unless you want to break things you probably shouldn't set _WANT_SOURCE
1139 1218
1140# TODO document 1219# TODO document
1141java-pkg_get-jni-cflags() { 1220java-pkg_get-jni-cflags() {
1142 local flags="-I${JAVA_HOME}/include" 1221 local flags="-I${JAVA_HOME}/include"
1143 1222
1223 # TODO do a check that the directories are valid
1144 # TODO figure out how to cope with other things than linux... 1224 # TODO figure out how to cope with other things than linux...
1145 flags="${flags} -I${JAVA_HOME}/include/linux" 1225 flags="${flags} -I${JAVA_HOME}/include/linux"
1146 1226
1147 echo ${flags} 1227 echo ${flags}
1148} 1228}
1149 1229
1230java-pkg_ensure-gcj() {
1231 if ! built_with_use sys-devel/gcc gcj ; then
1232 ewarn
1233 ewarn "You must build gcc with the gcj support to build with gcj"
1234 ewarn
1235 ebeep 5
1236 die "No GCJ support found!"
1237 fi
1238}
1239
1240java-pkg_ensure-test() {
1241 if hasq test ${FEATURES} && ! hasq -test ${FEATURES} && ! use test; then
1242 eerror "You specified FEATURES=test, but USE=test is needed"
1243 eerror "to pull in the additional dependencies for testing"
1244 die "Need USE=test enabled"
1245 fi
1246}
1247
1150# ------------------------------------------------------------------------------ 1248# ------------------------------------------------------------------------------
1151# @section-end helper 1249# @section-end helper
1152# ------------------------------------------------------------------------------ 1250# ------------------------------------------------------------------------------
1153 1251
1154# ------------------------------------------------------------------------------ 1252# ------------------------------------------------------------------------------
1166# compiler. 1264# compiler.
1167# 1265#
1168# ------------------------------------------------------------------------------ 1266# ------------------------------------------------------------------------------
1169eant() { 1267eant() {
1170 debug-print-function ${FUNCNAME} $* 1268 debug-print-function ${FUNCNAME} $*
1269
1270 # FIXME get this working
1271# if is-java-strict && [[ ! ${DEPEND} =~ "dev-java/ant" ]]; then
1272# java-pkg_announce-qa-violation \
1273# "Using eant, but not depending on dev-java/ant or dev-java/ant-core"
1274# fi
1171 1275
1172 local antflags 1276 local antflags
1173 java-pkg_init-compiler_ 1277 java-pkg_init-compiler_
1174 local compiler="${GENTOO_COMPILER}" 1278 local compiler="${GENTOO_COMPILER}"
1175 1279
1189 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})" 1293 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})"
1190 if [[ -n ${build_compiler_deps} ]]; then 1294 if [[ -n ${build_compiler_deps} ]]; then
1191 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})" 1295 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})"
1192 fi 1296 fi
1193 fi 1297 fi
1298
1299 if is-java-strict; then
1300 einfo "Disabling system classpath for ant"
1301 antflags="${antflags} -Dbuild.sysclasspath=ignore"
1302 fi
1194 1303
1195 if [[ -n ${JAVA_PKG_DEBUG} ]]; then 1304 if [[ -n ${JAVA_PKG_DEBUG} ]]; then
1196 antflags="${antflags} -debug" 1305 antflags="${antflags} -debug"
1197 fi 1306 fi
1198 1307
1210# @param $@ - Arguments to be passed to the compiler 1319# @param $@ - Arguments to be passed to the compiler
1211# ------------------------------------------------------------------------------ 1320# ------------------------------------------------------------------------------
1212ejavac() { 1321ejavac() {
1213 debug-print-function ${FUNCNAME} $* 1322 debug-print-function ${FUNCNAME} $*
1214 1323
1324 # FIXME using get-javac ends up printing stuff with einfo
1215 local compiler_executable=$(java-pkg_get-javac) 1325# local compiler_executable=$(java-pkg_get-javac)
1326 local compiler_executable="javac"
1216 1327
1217 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} $(java-pkg_javac-args) "${@}" 1328 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} $(java-pkg_javac-args) "${@}"
1218 ${compiler_executable} $(java-pkg_javac-args) "${@}" || die "ejavac failed" 1329 ${compiler_executable} $(java-pkg_javac-args) "${@}" || die "ejavac failed"
1219} 1330}
1220 1331
1226# 1337#
1227# @param $@ - compilers to filter 1338# @param $@ - compilers to filter
1228# ------------------------------------------------------------------------------ 1339# ------------------------------------------------------------------------------
1229java-pkg_filter-compiler() { 1340java-pkg_filter-compiler() {
1230 JAVA_PKG_FILTER_COMPILER="${JAVA_PKG_FILTER_COMPILER} $@" 1341 JAVA_PKG_FILTER_COMPILER="${JAVA_PKG_FILTER_COMPILER} $@"
1342}
1343
1344# ------------------------------------------------------------------------------
1345# @ebuild-function java-pkg_force-compiler
1346#
1347# Used to force the use of particular compilers. Should be used in src_compile.
1348# A common use of this would be to force ecj-3.1 to be used on amd64, to avoid
1349# OutOfMemoryErrors that may come up.
1350#
1351# @param $@ - compilers to force
1352# ------------------------------------------------------------------------------
1353java-pkg_force-compiler() {
1354 JAVA_PKG_FORCE_COMPILER="$@"
1231} 1355}
1232 1356
1233# ------------------------------------------------------------------------------ 1357# ------------------------------------------------------------------------------
1234# @ebuild-function use_doc 1358# @ebuild-function use_doc
1235# 1359#
1661 fi 1785 fi
1662 debug-print "Using: $(java-config -f)" 1786 debug-print "Using: $(java-config -f)"
1663 1787
1664 java-pkg_setup-vm 1788 java-pkg_setup-vm
1665 1789
1666 export JAVA=$(java-config -java) 1790 export JAVA=$(java-config --java)
1667 export JAVAC=$(java-config -javac) 1791 export JAVAC=$(java-config --javac)
1668 export JAVACFLAGS="$(java-pkg_javac-args)" 1792 export JAVACFLAGS="$(java-pkg_javac-args)"
1669 [[ -n ${JAVACFLAGS_EXTRA} ]] && export JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}" 1793 [[ -n ${JAVACFLAGS_EXTRA} ]] && export JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}"
1670 1794
1671 export JAVA_HOME="$(java-config -g JAVA_HOME)" 1795 export JAVA_HOME="$(java-config -g JAVA_HOME)"
1672 export JDK_HOME=${JAVA_HOME} 1796 export JDK_HOME=${JAVA_HOME}
1706 echo "GENTOO_VM=${GENTOO_VM} CLASSPATH=\"${CLASSPATH}\" JAVA_HOME=\"${JAVA_HOME}\"" >&2 1830 echo "GENTOO_VM=${GENTOO_VM} CLASSPATH=\"${CLASSPATH}\" JAVA_HOME=\"${JAVA_HOME}\"" >&2
1707 echo "JAVACFLAGS=\"${JAVACFLAGS}\" COMPILER=\"${GENTOO_COMPILER}\"" >&2 1831 echo "JAVACFLAGS=\"${JAVACFLAGS}\" COMPILER=\"${GENTOO_COMPILER}\"" >&2
1708 echo "and of course, the output of emerge --info" >&2 1832 echo "and of course, the output of emerge --info" >&2
1709} 1833}
1710 1834
1835
1836# TODO document
1837# List jars in the source directory, ${S}
1838java-pkg_jar-list() {
1839 if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
1840 einfo "Linked Jars"
1841 find "${S}" -type l -name '*.jar' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR},"
1842 einfo "Jars"
1843 find "${S}" -type f -name '*.jar' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR},"
1844 einfo "Classes"
1845 find "${S}" -type f -name '*.class' -print0 | xargs -0 -r -n 500 ls -ald | sed -e "s,${WORKDIR},\${WORKDIR},"
1846 fi
1847}
1848
1849# TODO document
1850# Verify that the classes were compiled for the right source / target
1851java-pkg_verify-classes() {
1852 ebegin "Verifying java class versions"
1853 #$(find ${D} -type f -name '*.jar' -o -name '*.class')
1854 class-version-verify.py -t $(java-pkg_get-target) -r ${D}
1855 result=$?
1856 eend ${result}
1857 if [[ ${result} == 0 ]]; then
1858 einfo "All good"
1859 else
1860 ewarn "Possible problem"
1861 die "Bad class files found"
1862 fi
1863}
1864
1865
1711# ------------------------------------------------------------------------------ 1866# ------------------------------------------------------------------------------
1712# @section-end internal 1867# @section-end internal
1713# ------------------------------------------------------------------------------ 1868# ------------------------------------------------------------------------------
1714 1869
1715java-pkg_check-phase() { 1870java-pkg_check-phase() {
1716 local phase=${1} 1871 local phase=${1}
1717 local funcname=${2} 1872 local funcname=${2}
1718 # TODO add check for java-stricter
1719 if [[ ${EBUILD_PHASE} != ${phase} ]]; then 1873 if is-java-strict && [[ ${EBUILD_PHASE} != ${phase} ]]; then
1720 java-pkg_announce-qa-violation \ 1874 java-pkg_announce-qa-violation \
1721 "${funcname} used outside of src_${phase}" 1875 "${funcname} used outside of src_${phase}"
1722 fi 1876 fi
1723} 1877}
1724 1878
1735 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE" 1889 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE"
1736 fi 1890 fi
1737} 1891}
1738 1892
1739java-pkg_announce-qa-violation() { 1893java-pkg_announce-qa-violation() {
1740 if hasq java-strict ${FEATURES}; then 1894 if is-java-strict; then
1741 echo "Java QA Notice: $@" >&2 1895 echo "Java QA Notice: $@" >&2
1742 increment-qa-violations 1896 increment-qa-violations
1743 fi 1897 fi
1744} 1898}
1745 1899
1746increment-qa-violations() { 1900increment-qa-violations() {
1747 let "JAVA_PKG_QA_VIOLATIONS+=1" 1901 let "JAVA_PKG_QA_VIOLATIONS+=1"
1748 export JAVA_PKG_QA_VIOLATIONS 1902 export JAVA_PKG_QA_VIOLATIONS
1749} 1903}
1750 1904
1905is-java-strict() {
1906 [[ -n ${JAVA_PKG_STRICT} ]]
1907 return $?
1908}
1909
1751# ------------------------------------------------------------------------------ 1910# ------------------------------------------------------------------------------
1752# @eclass-end 1911# @eclass-end
1753# ------------------------------------------------------------------------------ 1912# ------------------------------------------------------------------------------

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20